summaryrefslogblamecommitdiffstats
path: root/src/front/__init__.py
blob: b72b44017f7792c82c07903b64f860e28552526e (plain) (tree)
1
2
3
4



                               















                                          
                       






                              
 

                         


                          
from front.lexer import Lexer
from front.parser import Parser

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'''

    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()