I see what you meant, woodywood245. I agree with you that there should not a machine code generation invoked every time the input gets partially parsed, since this can change the semantics of a program in a serious way. What about this: - The interpreter expects user input line for line and tries to parse this line, starting with an empty parsing stack. - The input is tried to be parsed into a <statement> node. If the parser needs more tokens, print a symbol like > that prompts the user for another line (easiest way to do this is a blocking readNextToken() method) - If the input is a valid statement, execute it. This can be generalized for the whole language grammar. Most important for this is to specify what exactly is an executable piece of code. Assuming you have a simple formal grammar like this: <statement> -> <expr> := <expr> <statement> -> while (<expr>) <statement> <statement> -> { <statement-list> } <statement-list> -> ε | <statement><statement-list> Then a <statement>, defined like above, is the minimal executable piece of code. I will demonstrate a parsing process using an interactive shell. The parser should start with expecting a <statement> node. The <statement> node then requires reading a { or a "while" or an expression. Let the input of the user be: > while ( The parser sees the "while" keyword and then knows it has to use production 2. (I think that a recursive descent parser is a good option for this kind of user input interpretation). While resolving the right hand side of production 2, it consumes the tokens "while" and "(" and then requires an <expr>. However, since the sequence of remaining tokens is empty, all the parser will do is again printing a prompt: > Assume the user will now enter the expression and closing ")" : > (3 < 4) == !false ) Then the parser can parse the <expression> node and consume the ) token, requiring a <statement> (but knowing that this one is "one level deeper" than the original one). After this statement was also parsed, the production <statement> -> while (<expr>) <statement> is finished and the parser returns to the original "<statement>" call, then producing the required machine code. In this grammar, also a function definition could be modeled as some kind of statement, but one with no side effect or output except that it internally stores the new function. I think I will now first study the parser that you use, I worry everything I wrote is already obvious for you. EDIT Ok, I see that at least on github, the Compiler and CompiledScript files are empty. So if you want, I can give you some directions on how a multi-stage compiler (tokenizer -> syntax parser -> assembly code generator) could be designed.