From a4f2a248273064ec464e7d376f8f5778ac808bd6 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Sun, 28 Jun 2009 15:10:57 +0200 Subject: fixed error with not newline at file end moved __init__.py with testcode from src/front to src/ added in lexer "\n\n" at source end to have a newline at file end added unexpected end of file message, if matched token is None --- src/front/__init__.py | 38 -------------------------------------- 1 file changed, 38 deletions(-) (limited to 'src/front/__init__.py') diff --git a/src/front/__init__.py b/src/front/__init__.py index 747efde..e69de29 100644 --- a/src/front/__init__.py +++ b/src/front/__init__.py @@ -1,38 +0,0 @@ -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] ) -end - -# main function -fun main[] - sum = 0 - i = 0 - while (i < 10) - sum = sum + 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() - -if __name__ == "__main__": - main() -- cgit v1.2.3