Exemplo n.º 1
0
from mudd.parser import ParseError
from mudd.typechecker import MuddTypeChecker, TypeCheckError


if __name__ == "__main__":
    try:
        args = sys.argv
        debug = False

        if len(args) <= 1:
            sys.exit(0)

        if "--debug" in args:
            debug = True

        type_checker = MuddTypeChecker(args[-1], debug)

        if "--tree" in args:
            print(type_checker.parse_tree)

        type_checker.top_down_pass()
        type_checker.bottom_up_pass()

    except IndexError:
        print("[IndexError] No compilable file received as argument.")

    except FileNotFoundError:
        print("[FileNotFoundError] No such file is found.")

    except SyntaxError as syntax_error:
        print("[SyntaxError] %s" % syntax_error)
Exemplo n.º 2
0
from mudd.parser import ParseError
from mudd.typechecker import MuddTypeChecker, TypeCheckError

if __name__ == '__main__':
    try:
        args = sys.argv
        debug = False

        if len(args) <= 1:
            sys.exit(0)

        if '--debug' in args:
            debug = True

        type_checker = MuddTypeChecker(args[-1], debug)

        if '--tree' in args:
            print(type_checker.parse_tree)

        type_checker.top_down_pass()
        type_checker.bottom_up_pass()

    except IndexError:
        print('[IndexError] No compilable file received as argument.')

    except FileNotFoundError:
        print('[FileNotFoundError] No such file is found.')

    except SyntaxError as syntax_error:
        print('[SyntaxError] %s' % syntax_error)
Exemplo n.º 3
0
def set_up():
    checker = MuddTypeChecker('tests/bpl_files/test_typecheck_tdp.bpl')
    checker.top_down_pass()
    return checker
Exemplo n.º 4
0
def set_up():
    checker = MuddTypeChecker('tests/bpl_files/test_typecheck_tdp.bpl')
    checker.top_down_pass()
    return checker