Syntax questions

Lars T Hansen lth at acm.org
Mon Jul 30 04:15:28 PDT 2007


On 7/30/07, David Teller <David.Teller at univ-orleans.fr> wrote:
>
>         Hi,
>  I'm currently exploring the code, as a preliminary to writing a static
> analysis tool. At the moment, I'm stuck in the lexer, where I have two
> questions.
>
> Firstly, embedded comments seem to be forbidden. That is, a block such
> as
>         /* bla /* more bla */ even more bla*/
> will be passed to the parser as
>         even more bla */
> Is that normal ?

Yes.

> Is that desired ?

It's Traditional, at least.  Most languages don't seem to care about
nested comments.  Standard ML and Modula-3 are the only ones that come
to mind right now.

> Secondly, regular expressions. From what I gather, a regular expression
> containing a "x" anywhere can be multiline. Is that it ? It sounds too
> strange to be true.

No, a regular expression that is trailed by an 'x' flag can be multiline, eg

   /a*b
   c*d/x

This introduces an interesting problem for the lexer because it can't
know whether the x flag is present until it's lexed the regular
expression.  The rule is that it must assume the x flag is present,
and, coming to the end and finding it not there after all, must throw
a syntax error.

--lars

>
> Thanks,
>  David
>
> --
> David Teller ------------------------------------------
> Security of Distributed Systems -----------------------
> -- http://www.univ-orleans.fr/lifo/Members/David.Teller
> ----- Laboratoire d'Informatique Fondamentale d'Orleans
>
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es4-discuss
>



More information about the Es4-discuss mailing list