blob: fdf35a8dc6e4b32de9a49ad40b90236180aa16ec (
plain) (
tree)
|
|
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
@( fib[a-1] + fib[a-2] )
end
# main function
fun main[]
sum = 0
i = 0
while (i < 10)
sum = sum + fib[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(lex)
# parse.program()
if __name__ == "__main__":
main()
|