[antlr-interest] Re: How do I specify start-of-line (^ in [F]Lex in ANTLR Lexers?
jsrs701
jsrs701 at yahoo.com
Wed May 29 11:44:43 PDT 2002
--- In antlr-interest at y..., "clinton_olsen" <clinton_olsen at y...>
wrote:
> I'd like to qualify this with the fact that _any_ parser is
> typically not suited to to do a pre-processor. This needs to be
> done in the lexer for the reasons stated by Greg.
Well, that does depend on what kind of preprocessor you're doing.
One of these days, I'm gonna take a crack at rebuilding James
Gosling's ACE preprocessor using ANTLR. ACE is not a character-
stream preprocessor (the way the original cpp is), but a syntax tree
preprocessor. (You can get more info on it at his homepage,
http://java.sun.com/people/jag/ . I HIGHLY recommend EVERYONE on
this list read the paper; it is HIGHLY relevant to ANTLR. After
seeing this, you'll want all of your preprocessors to operate on
syntax trees instead of character streams!)
> Besides, you need
> the replaced input to be lexed before it can be passed to the
> parser.
It seems that that you're intending for the preprocessor to be
running in the same process as the final parser? Why not just build
a separate preprocessor application, and shell out to it, the way cc
calls cpp?
And really, for a character-stream preprocessor, ANTLR is probably
overkill. Or is your preprocessor significantly more complex than
cpp?
(Please note, C++ afficionados, that I'm referring to the C
PreProcessor when I say "cpp".)
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list