making a programming language
Posted
by None
on Stack Overflow
See other posts from Stack Overflow
or by None
Published on 2010-04-16T23:49:56Z
Indexed on
2010/04/16
23:53 UTC
Read the original article
Hit count: 191
I was wondering which way would create a faster programming language, because I have tried both. Writing code that takes the text, splits it by whitespace or newlines or something, then processes each line and has a dictionary for variables. Or writing code that takes text and converts it to another programming language. This is an example of how a very simple version of the first way would be programmed in python:
def run(code):
text = code.split(";")
for t in text:
if t == "hello":
print "hi"
second:
def run(code):
rcode = ""
text = code.split(";")
for t in text:
if t == "hello":
rcode += "print 'hi'"
© Stack Overflow or respective owner