コード例 #1
0
ファイル: interpreterTest.py プロジェクト: kongxun/CMM_Python
def interpreter(path):
    try:
        stream = open(path, 'r')
        codes = Generator.generate(Parser.parser_analysis(Lexer.lexer_analysis(stream)))
        stream.close()
        return Interpreter.interpret(codes)
    except Exception as e:
        print e
コード例 #2
0
def interpreter(path):
    try:
        stream = open(path, 'r')
        codes = Generator.generate(
            Parser.parser_analysis(Lexer.lexer_analysis(stream)))
        stream.close()
        return Interpreter.interpret(codes)
    except Exception as e:
        print e
コード例 #3
0
def generator(path):
    result = []
    try:
        stream = open(path, 'r')
        codes = Generator.generate(Parser.parser_analysis(Lexer.lexer_analysis(stream)))
        stream.close()
        for i in codes:
            result.append(i.to_string())
        return result
    except Exception as e:
        print e
コード例 #4
0
ファイル: parserTest.py プロジェクト: kongxun/CMM_Python
def parser(path):
    result = []
    try:
        stream = open(path, 'r')
        token_list = Lexer.lexer_analysis(stream)
        node_list = Parser.parser_analysis(token_list)
        stream.close()
        for i in node_list:
            result.append(i.to_string())
        return result
    except Exception as e:
        print e