Skip to content

Change the grammar of the if statement #54

@gregofi

Description

@gregofi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions