From 77f2f20abe2035e65082c2279a408ccb7c308f25 Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Sat, 26 Sep 2015 08:20:41 -0400 Subject: [PATCH] add compiler purpose/goal --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b45e063..7baf108 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,18 @@ Module(body=[Expr(value=Call(func=Name(id='print', ctx=Load()), args=[Str(s='hel ``` ### Compiler -The compiler will be up after the parser. The compiler will be responsible for converting the parsed AST into Python bytecode. +The purpose of the compiler is to convert an AST into the appropriate Python bytecode. + +The goal is to be able to produce a similar output as running: + +```bash +$ echo "print('hello world')" > test.py +$ python3 -m dis test.py + 1 0 LOAD_CONST 0 (5) + 3 STORE_NAME 0 (num) + 6 LOAD_CONST 1 (None) + 9 RETURN_VALUE +``` ### Interpreter The interpreter will be up after the compiler and will be able to execute on Python bytecode.