You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Phase 1: Minimal demo with built in print function and integer variables
Phase 2: Add function definitions
Phase 3: Add class definitions
Design
The design follows that of CPython. The code is first parsed into an AST (abstract syntax tree).
Then it is compiled into bytecode. This bytecode is then executed by a virtual machine. The
virtual machine has access to several built-in python types such as int, tuple, list,
set, dict and iter.
Parsing
A handwritten lexer is combined with a LALRPOP
generated parser. To deal with indentation,
the lexer inserts INDENT and DEDENT tokens at the appropriate points.
Compilation
The AST is transformed in bytecode. The available bytecode operations are loosely based upon
the ones in CPython
Ideas / notes
Instead of compiling to bytecode, the abstract syntax tree can be compiled into rust code and
compiled with the language runtime objects. This would give a speedup?
A compatible bytecode would be beneficial in order to be able to exchange bytecode files
between CPython / micropython.