help-bison
[Top][All Lists]
Advanced

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

Re: Preceding action


From: Péter
Subject: Re: Preceding action
Date: Mon, 13 Nov 2017 18:22:44 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0


So, does it stand, regarding bison that (at least):

If one does not define
 %define lr.type
so it remains the default "lalr",

and does *not* try to resume from errors (yyerror() is fatal, it exits),

and bison is called with warning swithes
 -Wall -Werror
(and there is no "-Wno-conflicts-sr" nor "-Wno-conflicts-rr")

and there are no "%expect-rr" nor "%expect" directives,

and there are no midrule-actions,

and there are no precedences nor associativities,


then for each action (call it "action0"), one can be sure that, for example, if 
the rule is
...
| alfa "+" beta ";" {action0}
...
;

then the preceding action was one of beta's actions (the last nonterminal), 
i.e. if beta can be produced by three rules:
beta: .... {action1} | .... {action2} | .... {action3} ;
then the last action before action0 have to be one of action1, action2 or 
action3
?


Hans Åberg:
If the grammar is unambiguous relative to the parser algorithm, by default 
LALR(1), then the grammar rules are treated as a set and




reply via email to

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