SmaCC question

Brian Murphy-Dye brian at murphydye.com
Tue Feb 19 00:15:08 UTC 2008


I'm not sure how to do conditional code in the parser. I set your
recommend string to <chapverse> in the scanner and then tried this in
the parser.

BibleReference :
	( "Genesis" | "Gn" | "Gen" ) [<chapverse>] { Transcript show: '[',
'1' asString, ']' } ;

But this results in a Shift/Reduce Conflict. What I'm trying to
accomplish is 'Gen 3' to be recognized as a bible reference and 'Gen
hello' as a string (not an error).

Brian.


On Feb 18, 2008 4:26 PM, Lukas Renggli <renggli at gmail.com> wrote:
> > <biblebook> : (Genesis | Gn | Gen | Exodus | Ex | Leviticus | Lv | Lev
> > | Nm | Num | Numbers | Dt | Deuteronomy) \.? \s+ \d+ (\: \d+ (-
> > \d+)?)? ;
>
> You should split that huge expression up. Preferably you just keep \.?
> \s+ \d+ (\: \d+ (-\d+)?)? as part of the scanner and move the rest
> into the parser as literal strings.
>
> This is a problem in Squeak because methods can only have a certain size.
>
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
>
>



More information about the Squeak-dev mailing list