3 ms·
Sure, I think I wrote my first interpreter when I was about 15. It's not hard at all. The trick is finding the right resources. IIRC I studied http://javascript
by PeCaN 10y ago
Sure, I think I wrote my first interpreter when I was about 15. It's not hard at all. The trick is finding the right resources. IIRC I studied http://javascript.crockford.com/tdop/tdop.html http://javascript.crockford.com/tdop/tdop.html for lexing + parsing (I wouldn't understand LL or LR parsing for years… you really don't need to) and wrote a very naïve AST-walking interpreter (the idea of compiling to bytecode and interpreting that did not occur to me).
Now I'm sort of a serial language designer/implementor and pump out virtual machines on a regular basis. This stuff is really easy until you want to make it fast, then it gets really hard. ;-)
Just for starting out, I think you should basically make parsing as simple as you can. It's probably the most confusingly computer-sciency part of language implementation… and also probably the least important. So just avoid it. Maybe write a Lisp or Forth if you want. I actually advocate just using a very small simple (pascal-like) syntax though, and writing an operator-precedence parser. You'll learn more that way.