[antlr-interest] Grammar for lexing/parsing Python

mzukowski at yci.com mzukowski at yci.com
Mon Jul 29 13:12:52 PDT 2002


See this message for the approach I used:
http://groups.yahoo.com/group/antlr-interest/message/3657

There's also this one
http://groups.yahoo.com/group/antlr-interest/message/1476 which mentions
trying a DEDENT token with the dedent count embedded in it.  That won't
really work for parsing, but it would be trivial to write a token stream
which monitors for DEDENT tokens and spews exactly the number needed before
returning the following token.

It was about 5 years ago now that I worked on that little project, and I'm
on a new machine now...  I'll see if I can dig up a CDR backup that has that
stuff on it, but it will probably be quicker for you to just get started and
use that approach.  I didn't have a complete lexer, all I specifically
remember solving was the INDENT/DEDENT problem.

Monty

> -----Original Message-----
> From: Torsten Juergeleit [mailto:tjuergeleit at yahoo.de]
> Sent: Monday, July 29, 2002 7:51 AM
> To: antlr-interest at yahoogroups.com
> Subject: RE: [antlr-interest] Grammar for lexing/parsing Python
> 
> 
> Monty,
> 
> anything left you are willing to share ;-)?
> Lexing is totally fine for me.
> 
> Torsten
> 
> --- mzukowski at yci.com wrote:
> > I figured out how to lex it properly (doing the
> > INDENT/DEDENT stuff) then
> > drifted into Java work and never finished the
> > parser.
> > 
> > Monty
> > 
> > > -----Original Message-----
> > > From: Terence Parr [mailto:parrt at jguru.com]
> > > Sent: Sunday, July 28, 2002 10:22 AM
> > > To: antlr-interest at yahoogroups.com
> > > Subject: Re: [antlr-interest] Grammar for
> > lexing/parsing Python
> > > 
> > > 
> > > I believe Monty was working on one.  Monty?
> > > 
> > > Ter
> > > 
> > > On Saturday, July 27, 2002, at 08:23  AM, Torsten
> > Juergeleit wrote:
> > > 
> > > > Hi,
> > > >
> > > > does anyone know about an ANTLR grammar for a
> > Python
> > > > lexer/parser?
> > > >
> > > > I'm working on a Python-aware text editor
> > > > (syntax-highlight, outline view) plugin for the
> > > > Eclipse IDE.
> > > > My current approach for the outline view is to
> > use
> > > > Jython (JavaCC-based Python parser) for parsing
> > and
> > > > visit Jython's internal AST to collect the
> > outline
> > > > information.
> > > >
> > > > An ANTLR-based lexer/parser with embedded Java
> > code to
> > > > collect the information necessary for an outline
> > view
> > > > while lexing/parsing seems to be more efficient
> > than
> > > > visiting a full-blown AST.
> > > --
> > > Co-founder, http://www.jguru.com
> > > Creator, ANTLR Parser Generator:
> > http://www.antlr.org
> > > 
> > > 
> > >  
> > > 
> > > Your use of Yahoo! Groups is subject to 
> > > http://docs.yahoo.com/info/terms/ 
> > > 
> > > 
> > 
> >  
> > 
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/ 
> > 
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - Feel better, live better
> http://health.yahoo.com
> 
>  
> 
> Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/ 
> 
> 

 

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



More information about the antlr-interest mailing list