Ejemplo n.º 1
0
def main(options={},filename=False):
	yacc.yacc()
	
	data = get_input(filename)
	ast =  yacc.parse(data,lexer = lex.lex(nowarn=1))	
	
	if options.graph:
		from codegen.graph import graph
		graph(ast, filename)
	
	try:
		check(ast)
	except Exception, e:
		print "Error: %s" % e
		sys.exit()
Ejemplo n.º 2
0
def main(options=dict(), filename=None):
    logger = yacc.NullLogger()
    yacc.yacc(debug=logger, errorlog=logger)
    yacc.yacc()

    data = get_input(filename)
    ast = yacc.parse(data, lexer=lex.lex(debug=1))

    if options.has_key("graph"):
        graph(ast)

    try:
        check(ast)
    except Exception, e:
        print "Error in semantic: %s" % e
        sys.exit()