[Python-ideas] Hooking between lexer and parser
Nick Coghlan
ncoghlan at gmail.com
Sat Jun 6 08:21:14 CEST 2015
On 6 June 2015 at 15:30, Andrew Barnert via Python-ideas
<python-ideas at python.org> wrote:
> The repetition is really a different issue. A different implementation of the same basic design Python already has could make it so you only have to write explicit code for the 3 places the CST->AST node doesn't follow the same rules as everywhere else and the dozen or so places where the AST has to be post-validated, instead of having to write explicit code for both sides of every single node type. And that kind of cleanup could be done without breaking backward compatibility, because the interfaces on each side of the code would be unchanged. But that's also a lot less fun of a change than writing a whole new parser, so I wouldn't be surprised if nobody ever did it…
Eugene Toder had a decent go at introducing more autogeneration into
the code generation code a few years ago as part of building out an
AST level optimiser: http://bugs.python.org/issue11549
The basic concepts Eugene introduced still seem sound to me, there'd
just be some work in bringing the patches up to date to target 3.6.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list