From 37750908aad87daab769545636520ba10bae3cde Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Fri, 24 Jun 2022 10:07:37 +0200 Subject: [PATCH] Update todo, some python codegen --- code_generating_script.py | 22 ++++++++++++++++++++-- main.cpp | 9 ++++----- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/code_generating_script.py b/code_generating_script.py index 3c48319..28e8759 100644 --- a/code_generating_script.py +++ b/code_generating_script.py @@ -57,7 +57,7 @@ def update_file(filename, comment_name, data_to_write): -if True: +if False: result = "" enum_members = [ "BC_END_OF_INSTRUCTIONS", @@ -96,7 +96,7 @@ if True: # # Generate switch cases # -if True: +if False: result = "" for size in sizes: @@ -152,6 +152,24 @@ if True: update_file("bytecode_interpreter.cpp", "switch_cases", result) +type_table = [ + ["S", ["Int", "SInt", "4sizes"]], + ["U", ["Int", "UInt", "4sizes"]], + ["INT", ["Int", "untyped"]], +] + +for name, flags in type_table: + names = [] + if "4sizes" in flags: + for size in sizes: + names.append(name + size) + if "untyped" in flags: + names.append("UNTYPED_" + name) + + print(names) + + + # # diff --git a/main.cpp b/main.cpp index 9e3596f..fcf8ed9 100644 --- a/main.cpp +++ b/main.cpp @@ -41,11 +41,8 @@ want to export all the symbols, we can namespace them optionally. ------------------------------------------------------------------------------- @todo -[ ] - Add token information to instructions -[ ] - print those token lines nicely +[ ] - Split Bc into builder and interpreter [ ] - Implement functions -[ ] - Improve the python metaprogram - [ ] - Probably need to give Ast_Expr a Value field, then I can express Type nicely [ ] - I would love for String, slice, Any etc. to have their struct declarations in source files, I also would want for stuff like string.str to work without weird special cases @@ -87,6 +84,9 @@ want to export all the symbols, we can namespace them optionally. [ ] - Polymorphism - create declaration of a polymorphic thing, when it's called just copy it, replace types and typecheck normally, when someone calls again you just search for the instantiation again @donzo +[x] - Add token information to instructions +[x] - print those token lines nicely +[x] - Improve the python metaprogram [x] - Implementing type Any [x] - Runtime TypeInfo [x] - Proper type Type support @@ -173,7 +173,6 @@ want to export all the symbols, we can namespace them optionally. #include "bytecode_codegen.cpp" int main(int argument_count, char **arguments){ - #if OS_WINDOWS // Set output mode to handle virtual terminal sequences HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);