shift devaluate conflict
i'm carrying problem bargain shift/reduce confict rupturing i know ambiguity. box else form nonetheless it's 'dangling else' problem given i have needed finish clauses delimiting formula blocks.
here rupturing gppg (its bison compiler compiler ... an echo):
%output=program.cs
%start program
%token for
%token end
%token things
%token while
%token set
%token if
%token elseif
%token else
%%
program : statements
;
statements : /*empty */
| statements stmt
;
stmt : flow
| things
;
flow : '#' '(' ')' statements else
;
else : '#' end
| '#' else statements '#' end
| elseifs
;
elseifs : elseifs '#' elseif statements else
| '#' elseif statements else
;
here dispute output:
// parser dispute information rupturing record "program.y"
shift/reduce dispute representation "'#'", parser shift
devaluate 10: else -> elseifs
change "'#'": state-22 -> state-23
equipment from-state state 22
10 else: elseifs .
-lookahead: '#', things, eof
11 elseifs: elseifs . '#' elseif statements else
equipment next-state state 23
11 elseifs: elseifs '#' . elseif statements else
// finish dispute information parser
i already switched arround everything, i know solve it, nonetheless fortitude involves giving adult left recursion 'elseif' right recursion.
ive by scarse support i have found internet per emanate (i post links during end) still have found an glorious solution. i know antlr i don't wish cruise right now. greatfully border your fortitude yacc/bison parsers.
i conclude glorious solutions, i managed eleminating /* lifeless */ manners duplication all indispensable an lifeless list nonetheless incomparable rupturing im operative only ends adult 'sparghetti rupturing syndrome'.
here links:
Comments
Post a Comment