[antlr-interest] antlr python-grammar

Terence Parr parrt at cs.usfca.edu
Tue Apr 18 17:12:28 PDT 2006


On Apr 18, 2006, at 4:59 PM, Loring Craymer wrote:
> I can do something about that.  However, I have to ask what you  
> intend to
> use it for--just for pretty printing (minimal tree structure  
> requirements)
> or for custom analysis (probably with specific structure  
> requirements).  How
> I annotate the parser grammar depends on the answer--there are  
> multiple
> possible tree structures.
>
> I did the original version of the parser grammar as a machine  
> translation of
> the grammar that comes with the Python distro; Ter modified it a  
> bit and
> added the lexer for use in the classroom.  Neither of us took it  
> far enough
> to need a tree grammar:  at the time, I just wanted to do a BNF  
> translator
> as a matter of sheer elegance; Ter needed something simple for  
> classroom
> use.

Yep, my students did the translation as part of a lab:

http://www.cs.usfca.edu/~parrt/course/652/labs/python.html

Wasn't too bad.  Fun!  Note that I have translated the stuff to  
v3...it may be in the examples-v3 tarball.  No tree stuff as Loring  
says.

Ter


More information about the antlr-interest mailing list