[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Precedence declarations applied to rules
From: |
Hans Aberg |
Subject: |
Re: Precedence declarations applied to rules |
Date: |
Thu, 22 May 2003 13:29:41 +0200 |
I looked a bit how this might be implemented into LR parsing algorithms,
and it does not seem difficult at all:
One has some restrictions on what the RHS nonterminals can expanded to. So
the LR function goto(s, X) is altered so that instead of X being a
nonterminal, it is a rule: If there are no restrictions, goto(s, E ->
E_1...E_n) does not depend on the rule, but only on E, so therefore one
lands on the old LR method in such a case. Similarly, the LR closure
function is altered so that one does not add the rules that are prohibited
in an expansion.
One then gets a whole new set of states, as opposed to the token based
precedence method that tries to alter the behavior of some already computed
states.
Hans Aberg