From 8c9fb246794f7cb94689c348f104b29433416f4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20N=C3=BC=C3=9Flein?= Date: Tue, 30 Jun 2009 20:57:09 +0200 Subject: implemented scope and most of ast --- src/__init__.py | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'src/__init__.py') 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() -- cgit v1.2.3