|
From: | Hans Aberg |
Subject: | Re: Some seeming context sensitivity, and shift/reduce errors |
Date: | Sun, 9 Dec 2007 00:41:50 +0100 |
On 8 Dec 2007, at 20:20, Jack T Mudge III wrote:[Please keep the cc to the Help-Bison list, as other may want to join in.]
As for resolving shift/reduce conflicts, one can try looking in the .output parser description file that Bison can generate, at the conflicting states, and their parsing position "."s. Then apply tokenprecedences (%left etc) to the tokens immediately and after those "."s.
It's worth a try. The only problem I see with using either left or rightassociation is that this seems to change according to context, e.g. ** *some* *bold* textwhere the two **s at the beginning don't have association, the third and 5th *would have right-association, and the 4th and 6th * would haveleft-association. That's where I run into a problem. Depending where the *is, and whether a * has come before it, changes the meaning of the *.
One can push the context sensitivities into the actions. This way, one can even handle language like C++. An alternate approach is to use the GLR parser (see the manual).
As I said, i'll try the comp.comilers mailing list. I think you're right inthat they may have a suggestion or two.
Look around for some similar languages, which helps avoiding pitfalls, and may give ideas on grammar design.
I went ahead and purchased a copy ofthe Dragon Book's second edition (just hasn't shipped yet....), when that arrives, I'll thumb through that before I try the mailing list. The book mayanswer my question :).
Also look into the FAQ of comp.compilers, which has more suggestions - it is posted there monthly.
Hans Aberg
[Prev in Thread] | Current Thread | [Next in Thread] |