Within the Python docs essays section is a wonderful article by Guido van Rossum on optimizing code with Python.
You should read the whole thing but I’m highlighting the bits I found most interesting and include a Python 3 version of the working code at the end.
If I had to do it all over again I might opt for a more powerful parsing engine, perhaps a version of LALR(1) (i.e. There are several areas of the grammar where something more powerful than LL(1) would be helpful, e.g.
keyword args: the rule 'arg: [NAME =] expr' is not a valid rule, since NAME occurs in the FIRST-set of expr and the algorithm doesn't handle that. But keyword args were several years in the future when I wrote the first version of pgen, and I didn't want to redo the parser at that point.
To get to the about page simply click the “about” tab on the python homepage.
https:// The about page looks like this: You can get more information by scrolling down Pippy teaches python programming by providing access to Python code samples and a fully interactive Python interpreter.For more information go to: This is what the homepage should look on your browser.The homepage describes many things you can do on python.Its goal is to introduce children to computer programming.The Pippy wiki page gives you information about Pippy on your OLPC: Using Pippy on the OLPC To open Pippy on your XO, just search it in the search bar and click it open. All you have to do is click on each of the numbers to learn more.You can also read through the “Python Info Wiki Beginners Guide” here: https://wiki.python.org/moin/Beginners Guide To go the “Frequently Asked Questions (FAQs) page on the python website, all you have to do is click on the “docs” tab on the homepage, and click the “FAQs” options, and you will find many different questions you might have with answers.The specific computer science problem he tries to solve is, How do you efficiently convert a list of integers that are ASCII values into a string.It’s fascinating to see even Guido himself reason through the problem in normal fashion, starting with a simple solution and then trying out various optimizations.I had used Yacc in college and was familiar with how it worked from the Dragon book, but for some reason I didn't like it much; IIRC I found it hard to reason about what the limitations on an LALR(1) grammar would be.I was also familiar with LL(1) parsers and had written some serious recursive-descent LL(1) parsers by hand -- I liked that fine but I was also familiar (again from the Dragon book) with LL(1) parser generation techniques, and I had one improvement over that that I wanted to try out: using regular expressions (sort of) instead of the standard BNF format.