[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: syntax howto question
From: |
Sean Middleditch |
Subject: |
Re: syntax howto question |
Date: |
03 Nov 2002 10:13:48 -0500 |
Ugh. That sounds less than intuitive. ~,^ I'll mess around and see if
I can get it working. Thankies.
On Sun, 2002-11-03 at 09:04, Thomas Troeger wrote:
> Hello,
>
> The problem is between rule #2 and #3. After parsing "expr '.' name",
> there is a s/r conflict. The canonical collection is somewhat like
> this:
>
> ...
> state 7
> [EX := EX . NAM . ( ARG ) , (] *** s/r ***
> [EX := EX . NAM . ( ARG ) , .] *** s/r ***
> [EX := EX . NAM . ( ARG ) , #] *** s/r ***
> [EX := EX . NAM . , (] *** s/r ***
> [EX := EX . NAM . , .]
> [EX := EX . NAM . , #]
> ...
>
> So the parser doesn't know if it should reduce from here, or shift
> over the next '(' token to complete with "expr '.' name '(' args ')'".
> Maybe you could insert a special token which is generated by
> the lexer if it has read "expr '.' name" and the next symbol is NOT
> '('. Then you could modify your rules like this:
>
> expr: ...
> | expr '(' args ')' { ... }
> | expr '.' name '(' args ')' { ... }
> | expr '.' name SPECIAL_TOKEN { ... }
>
> I hope this approach does work (any comments if this is or isn't
> reasonable pls).
>
> mfg.
>
> --tst.
>
> --
> /"\ "They that give up essential liberty to
> \ / ASCII Ribbon Campaign obtain a little temporary safety
> X Against HTML Mail deserve neither liberty nor safety." --
> / \ Benjamin Franklin, 1759