← Back to context

Comment by supriyo-biswas

2 months 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.

Obviously 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('):

There’s a famous presentation by David Beazley where he implements a WASM interpreter in Python in under an hour. Highly recommended.