[antlr-interest] Multipass parsing

Monty Zukowski monty at codetransform.com
Sun Mar 28 21:46:50 PST 2004


>
> I think that where I am stuck is that ANTLR allows me to take a text
> stream to a token stream by means of a lexer, then a token stream to a
> tree by means of a parser, and a tree to something else by means of a
> tree parser, but what I want is to turn a token i for language A
> (permissive) into a token stream for language B_i, and then have all
> the B_i conconcatened into a new token stream for language C.
>
>
See my article "Using a Parser as a TokenFilter" 
http://www.codetransform.com/filterexample.html
ANTLR doesn't natively support token stream to token stream parsing, 
but if you know how to properly override consume() and nextToken() as I 
show in my article, then you can do it without too much pain.  If you 
need to lex the contents of a token from the token stream you can do 
that too, just modify consume() appropriately.

Try it out and post more details if you get stuck.  What is this 
language anyhow?

Note to Ter for ANTLR 3 -- must support token stream output from a 
parser!

Monty
www.codetransform.com



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list