[antlr-interest] parsing only inside of C Comments?

Martin Kortmann email at kortmann.de
Tue Jul 31 11:10:24 PDT 2007


Hello Jim,

Jim Idle schrieb:
> Martin,
> 
> I should think that the easiest way to do this is to write the grammar
> that parses those patterns, then write a separate filtering lexer that
> invokes the parser on the discovered text in the way that island
> grammars do when you can invoke them from the lexing phase. There is an
> example of using islan grammars with the Java and C targets (others?) in
> the dowloadable examples jar at the download page:

I have already a handwritten lexer that skips everything
outside the c-comments and tokenized everything inside the
comments to feed the (also handwritten) parser. Now i would
like to replace the handwritten parser with some other code.
I wonder about the fact that it is simple to ignore everything
inside an comment but it seems not so easy to ignore
everything outside.

I'm just starting with ANTLR (as you can see on my other
problems ;-) and i think that the whole starting process
may be easier when i adapt an already running system to
an ANTLR parser.

Martin


More information about the antlr-interest mailing list