[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tell a rule to shift instead of reduce?
From: |
Hans Aberg |
Subject: |
Re: Tell a rule to shift instead of reduce? |
Date: |
Tue, 17 Dec 2013 23:26:40 +0100 |
On 17 Dec 2013, at 09:25, Adam Smalin <address@hidden> wrote:
> I still need help with this. I rewrote it maybe this will be more clear?
>
> I want to allow this
>
> var = var
> var, var = var
> var = var, var
If you can do dynamic type checking, it suffices to write rules (as in the
Bison manual calculator example):
expr:
expr "op0" expr
| expr "op1" expr
...
;
And then add precedence rules:
%left ","
%nonassoc "then"
%nonassoc "else"
%right "≔"
It works fine to resolve dangling "else" with precedences as well. The normal
way to break precedences is with matched pairs () [] {} etc.
Hans
Re: Tell a rule to shift instead of reduce?, Akim Demaille, 2013/12/22