This is an automated archive made by the Lemmit Bot.

The original was posted on /r/programminglanguages by /u/I_have_good_memes on 2023-10-23 17:57:06.


I want to know how you implement your first interpreter before knowing about parsing, ast, and all of that stuff.

My first interpreter was just a bunch of if else branch checking all possiblity. It was something like this:

for line in lines: if line.startwith("print("): line = line.removeprefix("print(") if line.startwith("\""): ... ... and so on

It was terrible but somehow I managed to get variable working.

Anyway, how did you implement your first interpreter before knowing pl stuff?