help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weird Rule Matching


From: tom2
Subject: Re: Weird Rule Matching
Date: Thu, 7 Apr 2022 11:00:56 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0

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 <tom@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).






reply via email to

[Prev in Thread] Current Thread [Next in Thread]