New submission from Eli Bendersky:

It was mentioned in one of the recent python-dev threads that making the Python 
code-base simpler to encourage involvement of contributors is a goal, so I 
figured this may be relevant.

I've recently written a new parser for the ASDL specification language from 
scratch and think it may be beneficial to replace the existing parser we use:

* The existing parser uses an external parser-generator (Spark) that we carry 
around in the Parser/ directory; the new parser is a very simple stand-alone 
recursive descent, which makes it easier to maintain and doesn't require a 
familiarity with Spark.
* The new code is significantly smaller. ~400 LOC for the whole stand-alone 
parser (asdl.py) as opposed to >1200 LOC for the existing parser+Spark.
* The existing asdl.py is old code and was only superficially ported to Python 
3.x - this shows, and isn't a good example of using modern Python techniques. 
My asdl.py uses Python 3.4 with modern idioms like dict comprehensions, 
generators and enums.

For a start, it may be easier to review the parser separately and not as a 
patch file. I split it to a stand-alone project here: 
https://github.com/eliben/asdl_parser

The asdl.py there is a drop-in replacement for Parser/asdl.py; asdl_c.py is for 
Parser/asdl_c.py - with tiny modifications to interface the new parser (mainly 
getting rid of some Spark-induced quirks). The AST .c and .h files produced are 
identical. The repo also has some tests for the parser, which we may find 
useful in adding to the test suite or the Parser directory.

----------
assignee: eli.bendersky
components: Build
messages: 203376
nosy: brett.cannon, eli.bendersky, ncoghlan
priority: normal
severity: normal
stage: patch review
status: open
title: Replace the ASDL parser carried with CPython
type: enhancement
versions: Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19655>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to