Ifs are currently written like this:
if COND { expr1 } else { expr2 },
change the grammar so they can be written like
if (COND) expr1 else expr2.
With this, the dangling else comes into play, that needs to be fixed at the grammar level because LALRPOP apparently doesn't offer any support for shifting before reducing.
Also, another ambiguity comes from if (COND) expr1 else expr + 1,
this (probably!) can be fixed by just using right rule and not the general Expr rule.
Alternatively, just handwrite the entire parser from scratch. It would however be better to stay away from this for the time being until the grammar settles.
Ifs are currently written like this:
if COND { expr1 } else { expr2 }
, change the grammar so they can be written likeif (COND) expr1 else expr2
.With this, the dangling else comes into play, that needs to be fixed at the grammar level because LALRPOP apparently doesn't offer any support for shifting before reducing. Also, another ambiguity comes from
if (COND) expr1 else expr + 1
, this (probably!) can be fixed by just using right rule and not the generalExpr
rule.Alternatively, just handwrite the entire parser from scratch. It would however be better to stay away from this for the time being until the grammar settles.