[pypy-dev] Parsing in PyPy (and runicode)

Jim Baker jbaker at zyasoft.com
Thu Feb 26 21:18:53 CET 2009


Please feel free to use our Python parser, it's licensed under the original
BSD license from Terrence Parr.
https://jython.svn.sourceforge.net/svnroot/jython/trunk/jython/grammar/

I don't know where the 3.0 work is currently located, in any event it's
something we have put on hold for the moment as we get the 2.5 release out.
I cc-ed in Frank to ensure he is in the loop here.

In terms of the parser itself: there's a modest amount of Java code in the
actions, but that should be easy to convert. Supporting RPython generation
in Antlr then makes even more sense in this case: as I understand it, Antlr
uses TP's other project, StringTemplate, to simplify the construction of
multiple backends.

- Jim

On Thu, Feb 26, 2009 at 12:55 PM, Leonardo Santagada <santagada at gmail.com>wrote:

>
> On Feb 26, 2009, at 3:44 PM, Jim Baker wrote:
>
> Perhaps consider Antlr? We've had good success with this for Jython, and
> it's now also used by NetBeans support for Python in general. I took a look
> at http://www.antlr.org/grammar/list, and there are a number of options
> for JS. Most importantly, Antlr supports the parser chain in Python, so it's
> possible this could be more readily converted to RPython.
>
>
> Yep this could be done, if so I would use this grammar file
> http://research.xebic.com/es3/ and then put the code for JS 1.5+ in it as
> we start supporting those features.
>
>
> Some potential issues:
> Chris Lambrou has a parser for EcmaScript 3.0. But there's no license here,
> so you'd definitely have to contact him on this. Like standalone grammars in
> general, it's rather unlikely to have been extensively tested. With Jython
> we started with a reference parser that Terrence Parr had made, and taking
> CPython as reference here as to what the AST should be, over time we
> targeted that by explicitly comparing ASTS. Some time later, including
> incremental parse support and various syntax errors, we're pretty confident
> that it's basically done.
>
>
> The thing that would be great is if pypy and jython would use the same
> parser using antlr so the work to support python 3.0 (and 2.7, 2.8, etc)
> could be partially shared :)
>
> --
> Leonardo Santagada
> santagada at gmail.com
>
>
>
>


-- 
Jim Baker
jbaker at zyasoft.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20090226/e2f668b3/attachment.html>


More information about the Pypy-dev mailing list