Python interpreter: creating your own programming language?

Remember that this is using python. Well, today I played with an application that I made called Pyline. This is a command line interface, with some interesting features. However, I had the idea: "Since this is similar to the" OS ", does it have its own language?

Well, I saw some articles on the Internet about how to make an interpreter, parser and compiler, but for me it was not entirely clear. All that I saw was a code error. I am one of those guys who need comments or a reading form or SOME or messages for a user without the code itself, so I think that Qaruju is great for a teenager like me. Can i get help?

+6
compiler-construction python parsing interpreter
source share
4 answers

First you need grounding to create a programming language. I highly recommend compiling a copy of Programming Language Pragmatics , which is readable (much more than the Dragon Book ) and is suitable for self-study.

Once you are ready to start messing with parsers, ANTLR is the gold standard for parser generators in terms of usability (although flex + bison / yacc is quite capable).

+10
source share

I just came Xtext , a language development framework. Perhaps this is what you might want to take a look at.

Given Python, you might find it instructive to implement a version of Logo . If you want, you can skip the parsing / vocabulary step for now and come up with an object-oriented version first so you can go if your OOP skills match that. You can later connect it to some graphics library to actually draw something.

In addition to the logo, you can check the L-systems. See, In particular, Algorithmic beauty of plants for inspiration.

+2
source share

Like theatrus, I suggest starting with a good book on this. I can definitely recommend Teren Parr’s Language Implementation Templates (the person behind ANTLR, the general parser generator).

+1
source share

See Peter Norvig 's two-page Python schema interpreter for more explanation. There is also a more interesting version that is worth reading if you just tried the simpler option.

+1
source share

All Articles