On Mon, 2003-10-20 at 22:50, Jim Freeze wrote:

> > or new line into XS instead.  btw, isn't X XS preferred?
> 
> I don't know. In all the examples I have read, it is XS : X | XS X;

I'm reaching deep into the my personal memory banks from the days I
actually took a compiler theory course (mumble, mumble) years ago.  So
be aware the information may be a bit old.

The parse tree generated from the two expressions will have different
associativity.  

(1)  XS : X | XS X;    =>   ((X X) X)
(2)  XS : X | X XS;    =>   (X (X X))

So if associativity matters, choose appropriately.

Also, I seem to recall that some parser generators have problems with
infinite recursion when the expansion is first (as in (1)), but I'm not
sure I see the problem here.  Perhaps that problem only happens with
grammers like (3).

(3)  XS : <empty> | XS X;

As I said, its been a long time since I looked at this stuff.

-- 
-- Jim Weirich       jweirich / one.net      http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct, 
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)