[antlr-interest] ANTLR based Python parser

shyamgopale shyam at persistent.co.in
Sat Sep 14 12:09:06 PDT 2002


Hi,
   I am in the process of writing a parser
for Python using antlr for a project. I have
handled most of the Python grammar but am having
problems specifying parts of it in the antlr
format.
   This grammar is successfully accepted by other
Python based parsers. The part that I am talking
about is as follows:

/* Start of Grammar */

primary : 
             atom | attributeref
              | subscription | slicing | call;

attributeref : 
             primary "." IDENTIFIER;

subscription : 
             primary "[" expression_list "]";

slicing : 
             simple_slicing | extended_slicing;
  
simple_slicing : 
             primary "[" short_slice "]";
  
extended_slicing : 
             primary "[" slice_list "]" ;
             
call : 
             primary "(" (argument_list)? ")";  

/* End of Grammar */

Any help than anyone can provide would
be appreciated very much.

Thanks,
Shyam


 

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



More information about the antlr-interest mailing list