[antlr-interest] dynamic addition to a lexer rule.

Paul Eames peames at nexagent.com
Wed Sep 26 09:01:59 PDT 2007


Hi,
 
I'm evaluating whether I can use ANTLR to parse sentences in structured
English.
 
I have a number of rules around the valid combination of noun concepts,
verb parts, and rule keywords in my example grammar which I think I know
how to implement. My problem is that I cannot define the full grammar
until runtime as users of our system are able to define concepts of
interest to them. Is there a way to add to the alternatives of a lexer
rule at runtime?
 
As an example, imagine I had defined the following lexer rule in my
grammar:
 
NOUN : ( 'cat' | 'dog') ;
 
A user of our application may wish to define 'rodrigues fruit bat' as a
noun and when they do so I'd like to add that to the list of
alternatives for the lexer to match.
 
Many thanks,
Paul.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070926/120fb0a8/attachment.html 


More information about the antlr-interest mailing list