What IS an LL/LR/SLR/LALR etc. grammar?

Joe Hotchkiss <joe.hotchkiss@gecm.com>
18 Feb 1999 10:47:30 -0500

          From comp.compilers

Related articles
What IS an LL/LR/SLR/LALR etc. grammar? joe.hotchkiss@gecm.com (Joe Hotchkiss) (1999-02-18)
Re: What IS an LL/LR/SLR/LALR etc. grammar? dwight@pentasoft.com (1999-02-21)
Re: What IS an LL/LR/SLR/LALR etc. grammar? paul.janssens@skynet.be.NOSPAM (JPA) (1999-02-21)
Re: What IS an LL/LR/SLR/LALR etc. grammar? bromage@cs.mu.OZ.AU (1999-02-21)
Re: What IS an LL/LR/SLR/LALR etc. grammar? jamz@my-dejanews.com (1999-02-24)
Re: What IS an LL/LR/SLR/LALR etc. grammar? mslamm@mscc.huji.ac.il (Ehud Lamm) (1999-02-24)
| List of all articles for this month |
From: Joe Hotchkiss <joe.hotchkiss@gecm.com>
Newsgroups: comp.compilers
Date: 18 Feb 1999 10:47:30 -0500
Organization: GEC-Marconi Avionics Ltd
Keywords: parse, question

I have been writing a small recursive descent parser, mostly for my own
amusement, and have been trying to document it for others to use. In
doing so I have tried to give definitions of some terms, but I can't
actually find a clear definition of the various types of grammar.


So far,
      LL(1) = scans input left-to-right, produces output for the
left-most bits first, and looks ahead at most 1 symbol at a time.
      LR(1) = scans input left-to-right, produces output for the
right-most bits first (but does so in reverse order for some reason!),
and looks ahead at most 1 symbol at a time.
      LALR(1) = Look-Ahead LR(1), but the (1) indicates that it looks
ahead 1 symbol anyway, so what is the difference? I have seen clear
statements that LR(1) is NOT the same as LALR(1).


Then there are SLR and SLALR grammars and quite possibly others that I
have not come across yet. All the books I have read use at least some
of these terms but I can find no systematic attempt to say what the
differences are.


Can anyone help or at least suggest a book with clear definitions?


Thank you.
            Joe


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.