From 4aedc5d76250fae734af1cd89256ec70e165ab18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20B=C3=B6hm?= Date: Mon, 29 Jun 2009 12:28:01 +0200 Subject: fix function_call - function_call is now an expression and a statement - call keyword is required to make lookahead = 1 work --- src/__init__.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src/__init__.py') diff --git a/src/__init__.py b/src/__init__.py index 747efde..ad0278b 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -1,13 +1,12 @@ from front.lexer import Lexer from front.parser import Parser -#from front.symbols import SymbolTable def main(): source = '''fun fib[a] if a < 2 @1 end - @( fib[a-1] + fib[a-2] ) + @( call fib[a-1] + call fib[a-2] ) end # main function @@ -15,24 +14,13 @@ fun main[] sum = 0 i = 0 while (i < 10) - sum = sum + fib[i] + sum = sum + call fib[i] i = i + 1 end @sum end''' - #symbols = SymbolTable() - #lex = Lexer(source) - - # testing - #while True: - # token = lex.scan() - # print token.__repr__() - # if not token: - # break - - parse = Parser(Lexer(source)) - print parse.parse() + print Parser(Lexer(source)).parse() if __name__ == "__main__": main() -- cgit v1.2.3