[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Weird Rule Matching
From: |
Hans Åberg |
Subject: |
Re: Weird Rule Matching |
Date: |
Thu, 7 Apr 2022 10:49:16 +0200 |
> 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).