diff options
author | Benedikt Böhm <bb@xnull.de> | 2009-06-29 12:28:01 +0200 |
---|---|---|
committer | Benedikt Böhm <bb@xnull.de> | 2009-06-29 12:28:01 +0200 |
commit | 4aedc5d76250fae734af1cd89256ec70e165ab18 (patch) | |
tree | 9f9c290f7d31a9aa966045019972670382596d45 /src/__init__.py | |
parent | 17fab2bc59945045a8df39ece8c845d1565245da (diff) | |
download | swppy-4aedc5d76250fae734af1cd89256ec70e165ab18.tar.gz swppy-4aedc5d76250fae734af1cd89256ec70e165ab18.tar.xz swppy-4aedc5d76250fae734af1cd89256ec70e165ab18.zip |
fix function_call
- function_call is now an expression and a statement
- call keyword is required to make lookahead = 1 work
Diffstat (limited to 'src/__init__.py')
-rw-r--r-- | src/__init__.py | 18 |
1 files changed, 3 insertions, 15 deletions
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() |