I'm trying to convert English into a python code, and here is how I do it:
english.eng:
the following line is a comment: This is a demo of english programming language
set a new variable dorito as "yum"
if dorito is "yum" then do
print in the terminal ("dorito is")
main.py:
f = open("english.eng", "r")
pe = f.read()
pe = pe.replace("the following line is a comment:", "#")
pe = pe.replace("as", "=")
pe = pe.replace("set a new variable ", "")
pe = pe.replace(" is ", " == ")
pe = pe.replace(" then do", ":")
pe = pe.replace("print in the terminal ", "print")
print(pe)
eval(pe)
But then: the following error occurs:
Traceback (most recent call last):
File "main.py", line 10, in <module>
eval(pe)
File "<string>", line 2
dorito = "yum"
^
SyntaxError: invalid syntax