コード例 #1
0
def run_code(code, mid=0):
    toks = lex.make(code)
    code_tree = tree.tree(toks)
    # ret = run.run(code_tree)
    # view.view(code_tree)

    ret = gen.make(code_tree)
    f = open('core/emit/interm.rion', 'w')
    f.write(ret)
    f.close()
    run.run(ret)
コード例 #2
0
def main(filename):
    input = open(filename)

    parser = Parser()

    try:
        tree = parser.parse(tokenize(input))
        #print_tree(tree, parser.terminals)

        run(tree)

    except parser.ParseErrors, e:
        for token, expected in e.errors:
            print 'Found', token, 'when', expected, 'was expected'
コード例 #3
0
ファイル: app.py プロジェクト: barbiyong/ML_FOR_TFEX
def main():
    function_name = request.args.get('function_name')
    if function_name == 'LP':
        message = run(function_name)
        print(message)
        message = {"messages": [{"text": message}]}
        return jsonify(message)
    elif function_name == 'NOW':
        message = run(function_name)
        print(message)
        message = {"messages": [{"text": u" LAST PREDICT !! "}]}
        return jsonify(message)
    else:
        message = {"messages": [{"text": u" NOT HAVE THIS FEATURE ! "}]}
        return jsonify(message)
コード例 #4
0
    # ret = run.run(code_tree)
    # view.view(code_tree)

    ret = gen.make(code_tree)
    f = open('core/emit/interm.rion', 'w')
    f.write(ret)
    f.close()
    run.run(ret)
    # print('done')


def repl():
    while 1:
        uin = input('>>> ')
        ran = run_code(uin)['data']
        if ran is not None:
            print(ran)


if len(sys.argv) > 1:
    if sys.argv[1][0] != '-':
        if sys.argv[1] == 'BC':
            run.run(open('core/emit/interm.rion', 'r').read())
        else:
            run_code(open(sys.argv[1]).read())
    else:
        f = open(sys.argv[2]).read()
        run.run(f)
else:
    repl()
コード例 #5
0
 def _view(path):
     source = requests.get(_source_url(repo_url, path))
     return runtime.run(flask.request, source.text)
コード例 #6
0
ファイル: ycad.py プロジェクト: sapir/ycad
    args = parser.parse_args()

    if not args.output:
        args.output = os.path.splitext(args.filename)[0] + '.stl'
    
    startTime = time.time()

    try:
        print('Initializing...', file=sys.stderr)
        import grammar
        import runtime
        timeAfterInit = time.time()
        print('Initialization time: {0:.2f}s'.format(timeAfterInit - startTime))

        print('Parsing...', file=sys.stderr)
        try:
            parsed = grammar.parseFile(args.filename)
        finally:
            timeAfterParsing = time.time()
            print('Parse time: {0:.2f}s'.format(timeAfterParsing - timeAfterInit))

        print('Running...', file=sys.stderr)
        try:
            runtime.run(os.path.abspath(args.filename), parsed, args.output)
        finally:
            timeAfterRunning = time.time()
            print('Execution time: {0:.2f}s'.format(timeAfterRunning - timeAfterParsing))
    finally:
        endTime = time.time()
        print('Total time: {0:.2f}s'.format(endTime - startTime))
コード例 #7
0
import runtime

runtime.run()
コード例 #8
0
ファイル: gas.py プロジェクト: LiveG-Development/Assembler
        if len(args) > 2:
            filename = args[2]
            size = useIntOrDefault(storage.read("size"), 6144)
            built = False
            debugging = False

            if len(args) > 3:
                if args[3] == "--built":
                    built = True
                if args[3] == "--debug":
                    debugging = True

                if len(args) > 4:
                    if args[4] == "--built":
                        built = True
                    if args[4] == "--debug":
                        debugging = True
            
            if built: os.chdir("build")
            
            runtime.run(filename, size, debugging)

            if built: os.chdir("..")
        else:
            output.error(_("invalidCommandStructure"))
            sys.exit(1)
    else:
        output.error(_("invalidCommand"))
        sys.exit(1)

sys.exit(0)
コード例 #9
0
ファイル: ycad.py プロジェクト: sapir/ycad
        args.output = os.path.splitext(args.filename)[0] + '.stl'

    startTime = time.time()

    try:
        print('Initializing...', file=sys.stderr)
        import grammar
        import runtime
        timeAfterInit = time.time()
        print('Initialization time: {0:.2f}s'.format(timeAfterInit -
                                                     startTime))

        print('Parsing...', file=sys.stderr)
        try:
            parsed = grammar.parseFile(args.filename)
        finally:
            timeAfterParsing = time.time()
            print('Parse time: {0:.2f}s'.format(timeAfterParsing -
                                                timeAfterInit))

        print('Running...', file=sys.stderr)
        try:
            runtime.run(os.path.abspath(args.filename), parsed, args.output)
        finally:
            timeAfterRunning = time.time()
            print('Execution time: {0:.2f}s'.format(timeAfterRunning -
                                                    timeAfterParsing))
    finally:
        endTime = time.time()
        print('Total time: {0:.2f}s'.format(endTime - startTime))
コード例 #10
0
def init(layermap):
   runtime.run(layermap,skill,run,layout)
コード例 #11
0
ファイル: engine.py プロジェクト: bortels/airscript-engine
 def _view(path):
     source = requests.get(_source_url(repo_url, path))
     return runtime.run(flask.request, source.text)