I have heard of an AST, and, against my better judgement, thought they
were to complex for my needs and decided to represent the instructions
as one long list, that gets edited by loops/conditionals.
I see the error of my ways now, but I am too close to the deadline of
this project for me to go back and change it now...
Tom.
On 4/7/22 09:49, Hans Åberg wrote:
On 7 Apr 2022, at 10:14, tom2 <t...@tomflux.xyz> wrote:
It does actually cause an issue because I am rely on the idea that the rule
will be matched before the next if token is found, in order to have nested
conditionals.
Typically, one build an AST (abstract syntax/semantic tree) that can be
executed after the parse. This is necessary for loops. Sometimes it is
necessary to avoid lookahead when the lexer has context switches that are set
in the parser; this can be done by have a distinct lookahead token for such
contexts (there is more info about it in the Bison manual somewhere).