Pyparsing

Published Dec 01, 2017
Pyparsing

Hey! My name is Chris and I come from Athens, Greece. I am 25 years old.

Why I wanted to learn pyparsing

I wanted to create a mini domain-specific language to handle some heavily repetitive tasks. The language had to be as simple as possible, and pyparsing is a great option for that.

How I approached learning pyparsing

I decided to work on a small project (a mini-language that does addition and subtraction, etc.) to get the ins and outs of pyparsing's API.

Challenges I faced

Before pyparsing, the process was completely manual. What I mean is that I coded the DSL from scratch. While the end result was working, the problem now was the size of the module and difficulty of extending it. This just kept getting worse the more features I added.

Key takeaways

I realized that I could write much less code by leveraging things such as Formal Grammars, Automatons, and other concepts taken from Compilers.

Tips and advice

Start by trying to create a language that does simple calculations. Check source code on GitHub. For the really curious: go to Stanford Online and take the compiler's class to see how this really works.

On to my next learning goal!

Discover and read more posts from Christos Christofidis
get started