From 3e2a5c20f9df03c9db51c3f2213398eade26e851 Mon Sep 17 00:00:00 2001 From: Alex Bates Date: Sat, 6 Feb 2021 05:20:19 +0000 Subject: [PATCH] dsl: add 'int ;' declarations --- tools/compile_dsl_macros.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/compile_dsl_macros.py b/tools/compile_dsl_macros.py index 379c27eb4f..c96b206d6f 100755 --- a/tools/compile_dsl_macros.py +++ b/tools/compile_dsl_macros.py @@ -39,6 +39,7 @@ script_parser = Lark(r""" | stmt_no_semi ?stmt: call + | var_decl | "goto" label -> label_goto | "return" -> return_stmt | "break" -> break_stmt @@ -103,6 +104,8 @@ script_parser = Lark(r""" loop_stmt: "loop" [expr] block loop_until_stmt: "loop" block "until" "(" expr cond_op expr ")" + var_decl: ("int"|"float") variable + ?expr: c_const_expr | ESCAPED_STRING | SIGNED_INT @@ -597,6 +600,9 @@ class Compile(Transformer): name = tree.children[0] return self.alloc.variables.index(name) - 30000000 + def var_decl(self, tree): + return [] + def label_decl(self, tree): if len(tree.children) == 1: label = tree.children[0]