[antlr-interest] Parse guided by preceding input

Bob temporaryemail at comcast.net
Tue Jun 14 17:55:52 PDT 2011


With bison/flex the lexical analyzer pipelines tokens on demand to the
parser

as the grammar rules are processed.

 

It appears in Antlr (3) that lexical analysis tokenizes the input stream

before any grammar rules are activated.

 

By pipelining, it's possible to influence the parse from preceding input at 

the lexical level.

 

For example, an identifier rule ( 'a'..'z' )* can lookup

the string in a table built from grammar rules of preceding input and 

return either an identifier-token or a table-token to guide subsequent

rule activation.

 

If Antlr does not pipeline, the equivalent would have to be done

somehow in the grammar rules, not the lex rules.

 

Is there a way to do this?



More information about the antlr-interest mailing list