lex / yacc for Python

Bjorn Pettersen bjorn at roguewave.com
Wed Sep 1 02:30:51 EDT 1999


There is of course also possible to do the lexing and parsing in flex/bison
;-)  The nodes in C++, SWIG to wrap them, and implement compiler passes in
python.  If you know lex/yacc and don't feel like learning error tracking
for a new system (in addition to extra syntax etc.)  You might want to give
it a try.  It actually works remarkably well (couple of rough spots, but
what'd you expect ;-)

If you'd like to take a quick look at a very premature project (the parts
you are interested in are working), let me know and I can send you a copy.

Quick question to other language implementors: I'm almost done writing the
core language evaluator (using a rather interesting version of the visitor
pattern that is much simpler, and can't be modeled in less dynamic
language).  The question is what do I do next?

Type inference has been an intest of mine for some years now, so I was
wondering if it should go first, probably followed by the pretty printer
(does anyone know of any current reasearch on minimizing the generated
interface descriptions? -- where I should go to find it?)

If going to a third language, the options are Python (I'm even starting to
understand the internals *sigh*),  i.e. something similar to P-code, wher I
either write the runtime envionment or use someone elses.  I could also use
C, C++,... if I wanted speed rather than quality at this point.

I'm planning to table optimizations for the time being, but I will still do
some fairly complete records of how the core language operates on the python
evaluator....

<bjorn's-object-oriented-language>  => Bool  :-)

> -----Original Message-----
> From:	Mike Fletcher [SMTP:mcfletch at vrtelecom.com]
> Sent:	Tuesday, August 31, 1999 7:50 PM
> To:	python-list at python.org
> Subject:	RE: lex / yacc for Python
> 
> Normally I point new users not to mcf.pars (which I haven't touched in
> ages
> (though I still use it daily at work)) and point them to simpleparse,
> which
> generates tuples for use with the mxTextTools engine.
> 
> Neither system is a lexx/yacc style system.  They use very similar general
> pattern matching machinery which does not use lexxing machinery at all
> (i.e.
> no tokenisation pass).  Both systems are targeted at (moderately) fast
> parsing of a very limited class of grammars.
> 
> http://members.home.com/mcfletch/programming/simpleparse/simpleparse.html
> 
> As noted on your page, mcf.pars is still available as part of mcf.vrml,
> but
> the version of mcf.vrml on starship.python.net is actually an old version
> of
> that package.  I would have to check to see if the mcf.pars package
> changed
> between that version and later versions of mcf.vrml.
> 
> Cheers,
> Mike
> 
> -----Original Message-----
> From: python-list-request at cwi.nl [mailto:python-list-request at cwi.nl]On
> Behalf Of Andrew M. Kuchling
> Sent: August 31, 1999 5:50 PM
> To: python-list at cwi.nl
> Subject: Re: lex / yacc for Python
> 
> 
> "Jacques Oosthuizen" <jacques at integra.co.za> writes:
> > Any one know if there is such a beast
> 
> Quite a few, actually; many Python users seem to be language geeks.
> A list of parsing systems is at:
> 
> http://starship.python.net/crew/amk/python/string.html#parsing
> 
> I've never used any of them, and don't know which ones are still
> maintained, which are toys, and which are the most powerful.  Good luck!
> 
> --
> A.M. Kuchling			http://starship.python.net/crew/amk/
> This isn't life in the fast lane, it's life in the oncoming traffic.
>     -- Terry Pratchett, in alt.fan.pratchett
> 
> 
> 
> 
> -- 
> http://www.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list