diff options
author | Andreas Nüßlein <nutz@unfoog.de> | 2009-06-30 20:57:09 +0200 |
---|---|---|
committer | Andreas Nüßlein <nutz@unfoog.de> | 2009-06-30 20:57:09 +0200 |
commit | 8c9fb246794f7cb94689c348f104b29433416f4e (patch) | |
tree | e32ae136f1baacafc0cc266382846ab3ae007e47 /src/__init__.py | |
parent | 4aedc5d76250fae734af1cd89256ec70e165ab18 (diff) | |
download | swppy-8c9fb246794f7cb94689c348f104b29433416f4e.tar.gz swppy-8c9fb246794f7cb94689c348f104b29433416f4e.tar.xz swppy-8c9fb246794f7cb94689c348f104b29433416f4e.zip |
implemented scope and most of ast
Diffstat (limited to 'src/__init__.py')
-rw-r--r-- | src/__init__.py | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/__init__.py b/src/__init__.py index ad0278b..89bcdc6 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -1,26 +1,12 @@ from front.lexer import Lexer from front.parser import Parser +from front.scope import Scope +import sys def main(): - source = '''fun fib[a] - if a < 2 - @1 - end - @( call fib[a-1] + call fib[a-2] ) -end - -# main function -fun main[] - sum = 0 - i = 0 - while (i < 10) - sum = sum + call fib[i] - i = i + 1 - end - @sum -end''' - - print Parser(Lexer(source)).parse() + ast = Parser(Lexer(sys.stdin.read())).parse() + scope = Scope() + ast.generate() if __name__ == "__main__": main() |