mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
dsl: add 'int ;' declarations
This commit is contained in:
parent
51ec14b78d
commit
3e2a5c20f9
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user