From d33ca73a35742d8dfecaf113a9834e484679d271 Mon Sep 17 00:00:00 2001 From: Andrew Healey Date: Thu, 28 Dec 2023 20:52:28 +0000 Subject: [PATCH] Remove "else" for now --- compiler.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/compiler.py b/compiler.py index e9a5643..dd527ff 100644 --- a/compiler.py +++ b/compiler.py @@ -363,26 +363,11 @@ def visit_if_stmt(node: Tree, context: Context): """(if (then\n""" ) - else_idx = None for i in range(3, len(node.children)): - if node.children[i] == "else": - else_idx = i - break if isinstance(node.children[i], Token): continue visit_declaration(node.children[i], context) - context.write(")\n") - - if else_idx: - context.write("(else\n") - for i in range(else_idx + 1, len(node.children)): - if node.children[i] == "fi": - break - if isinstance(node.children[i], Token): - continue - visit_declaration(node.children[i], context) - context.write(")\n") - context.write(")\n") + context.write(")\n)\n") def compile(source: str, context: Context):