As a self project I'm creating an interpreter for a programming language I "made up" (It's really just a tiny extension of the JavaScript programming language) but I'm a little lost as to how an interpreter really works and how I should execute the programs that are written in my language. My questions are:
1: Because this is an interpreter, should I be executing statements as I walk my parse tree, or should I instead be generating code in a different language - say, python - and then using a subprocess call to compile and run that generated python file?
2: Am I suppose to execute each statement as I read it? or should I be constructing the entire program's parse tree -> AST in memory before walking the tree and generating / executing code? (Depending on what the answer to question 1 is)