From dfa24dc8758be425d0a7adeffe2c2e6095457b66 Mon Sep 17 00:00:00 2001 From: vtomole Date: Tue, 27 Mar 2018 13:33:27 -0500 Subject: [PATCH] Runs program through the compiler before running on VM --- app.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index 0560f2a..6f86540 100644 --- a/app.py +++ b/app.py @@ -5,6 +5,7 @@ import program import re import requests +import os app = Flask(__name__) @@ -25,16 +26,22 @@ def qpl(): def vm(): return render_template('vm.html') -@app.route('/tic-tac-toe') -def tic_tac_toe(): - return render_template('tic-tac-toe.html') - - @app.route('/api/add_message/', methods=['GET', 'POST']) def add_message(uuid): content = request.json print (content['mytext']) p = content['mytext'] + os.chdir('compiler/') + print(os.getcwd() ) + text_file = open("program.txt", "w") + text_file.write(p) + text_file.close() + os.system ("bash -c './compile.lisp program.txt'") + os.system ("bash -c 'python preprocessor.py a.ir'") + + with open('a.eg', 'r') as myfile: + p=myfile.read() + wvf, msg = program.run(p) return jsonify({"results" : msg}) @@ -62,7 +69,7 @@ def teleportsend(): else : q1 = int(m[0][1]) q0 = int(m[1][1]) - + print(url) res = requests.post(url, json={ "q0": q0, "q1" : q1