From a274797e58b33153061166b593af9f3e38c7103a Mon Sep 17 00:00:00 2001 From: Nemo Date: Mon, 6 Jul 2020 21:15:19 +0530 Subject: [PATCH] Fixes opening after first statement --- compiler/engine.py | 2 +- .../10/ExpressionLessSquare/Main.jack.xml | 200 +++++++++--------- 2 files changed, 101 insertions(+), 101 deletions(-) diff --git a/compiler/engine.py b/compiler/engine.py index 36ac590..c5f5b21 100644 --- a/compiler/engine.py +++ b/compiler/engine.py @@ -54,7 +54,7 @@ class Engine: # We don't have to move the cursor for LL0 grammar if matchOnly: - assert(lookahead == 1) + return lookup_keys in dictionary for _ in range(lookahead-1): self.advance() diff --git a/projects/10/ExpressionLessSquare/Main.jack.xml b/projects/10/ExpressionLessSquare/Main.jack.xml index 5dcbe67..f444332 100644 --- a/projects/10/ExpressionLessSquare/Main.jack.xml +++ b/projects/10/ExpressionLessSquare/Main.jack.xml @@ -22,18 +22,18 @@ game ; - - let - game - = - - game - - - - ; - + + let + game + = + + game + + + + ; + do game @@ -88,103 +88,103 @@ a ; - - if - ( - - i - - - - ) - { - - let - s - = + + + if + ( i - ; - - - - let - s - = - - j - - - - ; - - - let - a - [ - - i - - - - ] - = - - j - - - - ; - - - } - else - { - - let - i - = - - i - - - - ; - - - - let - j - = - - j - - - - ; - - - let - i - = - - i - - - | + ) + { + + + let + s + = + + i + + + + ; + + + let + s + = j - - ; - - - } - - + + + ; + + + let + a + [ + + i + + + + ] + = + + j + + + + ; + + + } + else + { + + + let + i + = + + i + + + + ; + + + let + j + = + + j + + + + ; + + + let + i + = + + i + + + | + + j + + + ; + + + } + return ;