예제 #1
0
def middle(solver, program, options):
    try:
        checks.resolve_and_type_check(program)
    except NameNotFoundException as e:
        stderr_print(e)
        return False
    try:
        instantiate_vars(solver, program, options)
    except NameNotFoundException as e:
        stderr_print(e)
        return False
    return True
예제 #2
0
def middle(solver, program, options):
    try:
        checks.resolve_and_type_check(program)
    except NameNotFoundException as e:
        stderr_print(e)
        return False
    try:
        instantiate_vars(solver, program, options)
    except NameNotFoundException as e:
        stderr_print(e)
        return False
    return True
예제 #3
0
def front(FILE):
    l = lex.lex(module=lexer)
    with open(FILE, "rb") as read_file:
        contents = read_file.read()
    l.input(contents)
    try:
        yy = yacc.yacc(module=parser)
        ast = yy.parse(lexer=l)
    except (ParserException, LexerException, GraphOrderException, OperationNotSupportedException) as e:
        stderr_print(e)
        return (False, None)
    program = Program(ast)
    #print(program.toStr(0))
    return (True, program)
예제 #4
0
def front(FILE):
    l = lex.lex(module=lexer)
    with open(FILE, "rb") as read_file:
        contents = read_file.read()
    l.input(contents)
    try:
        yy = yacc.yacc(module=parser)
        ast = yy.parse(lexer=l)
    except (ParserException, LexerException, GraphOrderException,
            OperationNotSupportedException) as e:
        stderr_print(e)
        return (False, None)
    program = Program(ast)
    #print(program.toStr(0))
    return (True, program)