diff options
author | Andreas Nüßlein <nutz@unfoog.de> | 2009-07-02 21:12:49 +0200 |
---|---|---|
committer | Benedikt Böhm <bb@xnull.de> | 2009-07-02 21:12:49 +0200 |
commit | 87b6f874776b253f77f4a1bf4c1844d99a8e544f (patch) | |
tree | 533f15f399da8969f044885851fc97027533d07a /src/front/parser.py | |
parent | 8c9fb246794f7cb94689c348f104b29433416f4e (diff) | |
download | swppy-87b6f874776b253f77f4a1bf4c1844d99a8e544f.tar.gz swppy-87b6f874776b253f77f4a1bf4c1844d99a8e544f.tar.xz swppy-87b6f874776b253f77f4a1bf4c1844d99a8e544f.zip |
implement three-address-code objects instead of printf
Diffstat (limited to '')
-rw-r--r-- | src/front/parser.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/front/parser.py b/src/front/parser.py index 511e929..53818bc 100644 --- a/src/front/parser.py +++ b/src/front/parser.py @@ -93,7 +93,11 @@ class Parser: self.move() return Constant(0, self.lexer.line) if self.token.tag == Tag.IDENT: - return Variable(self.match(Tag.IDENT), self.lexer.line) + line = self.lexer.line + name = self.match(Tag.IDENT) + if not self.scope.contains(name): + raise SyntaxError("%s is not declared in line %d" % (name, line)) + return Variable(name, line) return self.function_call() # function_call = "call" ident "[" [ expression_list ] "]". |