Let's make a shit JavaScript interpreter! Part one.
Let's make a shit javascript interpreter! Part one. As a learning exercise, I've begun writing a javascript ECMAScript interpreter in python . It doesn't even really exist yet, and when it does it will run really slowly, and not support all js features. So... let's make a "from scratch", all parsing, all dancing, shit interpreter of our very own! Teaching something is a great way to learn. Also writing things on my blog always gets good 'comments', hints, tips, plenty of heart, and outright HATE from people. All useful and entertaining :) Tokenising So to start with, we need something to turn the .js files into a list of tokens. This type of program is called a tokeniser. From some javascript like this: function i_can_has_cheezbrgr () {return 'yum';}; Into a Token list something like this: [ {"type":"name", "value":"function", "from":0, "to":8}, {"type":"n