From: | "Clint Olsen" <clint@0lsen.net> |
Newsgroups: | comp.compilers |
Date: | 25 Sep 2002 23:50:30 -0400 |
Organization: | AT&T Broadband |
References: | 02-09-087 02-09-110 02-09-121 02-09-128 |
Keywords: | lex |
Posted-Date: | 25 Sep 2002 23:50:30 EDT |
Joachim Durchholz wrote:
> comment ::= "/*" {token} "*/"
> token ::= comment
> | string | integer | ... (literals)
> | "if" | "then" | ... (keywords)
> | <error>
>
> (The <error> token is meant to be whatever the lexer returns if a
> character sequence is not a legal token.)
Your example does show how the comment would appear in your grammar in
the first place. Comments in most free form languages can appear
_anywhere_ except where they might split tokens (e.g. quoted strings).
-Clint
Return to the
comp.compilers page.
Search the
comp.compilers archives again.