Skip to content

Commit

Permalink
Runs program through the compiler before running on VM
Browse files Browse the repository at this point in the history
  • Loading branch information
vtomole committed Mar 27, 2018
1 parent f0462b7 commit dfa24dc
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions app.py
Expand Up @@ -5,6 +5,7 @@
import program
import re
import requests
import os

app = Flask(__name__)

Expand All @@ -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/<uuid>', 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})

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dfa24dc

Please sign in to comment.