Bottom-Up Parsing/Example 4: LALR(1): Difference between revisions

From Wiki**3

Root (talk | contribs)
No edit summary
Root (talk | contribs)
Line 2: Line 2:
= Problem =
= Problem =


S -> L = R | R
Initial symbol: '''S'''
L -> * R | id
R -> L


Initial symbol: S
Terminals: '''{ =, *, id }'''
 
Terminals: { =, *, id }


Input:  
Input:  


Compact.
S → L = R | R
L → * R | id
R → L


Is this an SLR(1) grammar?
Is this an SLR(1) grammar?
Compute and compact the parse table.


== Solution ==
== Solution ==

Revision as of 09:41, 2 May 2024

Problem

Initial symbol: S

Terminals: { =, *, id }

Input:

S → L = R | R
L → * R | id
R → L

Is this an SLR(1) grammar?

Compute and compact the parse table.

Solution