[antlr-interest] Could you advise me ?

johnclarke72 johnclarke at hotmail.com
Fri Apr 19 16:33:37 PDT 2002


I am working on a parser for a simple language. I am new to ANTLR 
and just have a couple of questions regarding grammar issues. 

1 ) In my code I use ( 'a'..'z' | 'A'..'Z' ) to refer to all of the 
letters from a - z. Is there any way to add something that will make 
it accept anything (eg all puntuation,etc) without having to define 
every item ? 

2) In my grammar an item may have parameters or it may not have 
parameters. The values for these parameters may have quotes or they 
may not. A given item can potentially have more than 1 parameter. 
For example : 

No parameters : <dodar> 
Parameters (Quotes) : <dodar Param1="value" Param2="Value"> 
Parameters (No Quotes) : <dodar Param1=value Param2=Value> 

How can I describe this using Antlr ? 

3) An item must have a start tag but the end tag is optional. Eg 
either <dodar> or <dodar></dodar> is acceptable. How can I describe 
this using Antlr ? 

I would be grateful for any advice you can offer. 

Thanks in advance 

John Clarke 



 

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



More information about the antlr-interest mailing list