2 b lalr(1)

mckeeman at wivax.UUCP mckeeman at wivax.UUCP
Wed May 23 02:12:36 AEST 1984


>	Anyone who is a serious student of programming linguistics,
>    should realize that a delimiter is neccessary to separate the
>    expression from the statement in all conditional language-constucts
>    -- if you want to keep your grammer LALR(1) (almost a given).

Curiously enough, LALR(1) does not require a delimiter for
most reasonable languages.  PLZ/SYS (Snook et al, Springer,
1978) happens to have THEN but allows ' ' ';' ',' TAB CR
interchangeably.  That is, blank is delimiter enough.  What
happens is that either the keyword starting the statement,
or the pair <expr> <ident> where an <assignment> is
following is enough to make decisions possible.  (I don't
know if PLZ/SYS is in fact LALR(1), but I am pretty sure it
could be with the usual fiddling around.)

Even more interesting, reserved words are not necessary for
LALR(1).  One can put in a rule
<ident> ::= IF | THEN | DO ...
which will turn the reserved word back into <ident> into a
grammar and still get the LALR(1) tables in most cases.

Now, none of this should be construed as an argument for or
against any style of language design or programming.  It is
just a fact that LALR does not force these decisions on us.

/s/ Bill   McKeeman.Wang-Inst at CSNet-Relay
           ...decvax!wivax!mckeeman
           Wang Institute of Graduate Studies, Tyngsboro, MA 01879



More information about the Comp.lang.c mailing list