3 ms·
Heh, now I wonder how much JavaScript it actually interprets and given that it’s < 1000 lines, whether it could be used towards an introductory course in compil
by supriyo-biswas 1y ago
Heh, now I wonder how much JavaScript it actually interprets and given that it’s < 1000 lines, whether it could be used towards an introductory course in compilers.
- kccqzy 1y agoObviously not. An introductory course would introduce concepts like lexers, parsers, AST, etc, instead of working on strings. Here are lines 431 through 433: if expr.startswith('new '): obj = expr[4:] if obj.startswith('Date('):
- deleted 1y ago[deleted]
- Too 1y agoThere’s a famous presentation by David Beazley where he implements a WASM interpreter in Python in under an hour. Highly recommended.
- bangaladore 1y agoBytecode interpreters are quite simple compared to the actual lexer / parser.