Bottom-Up Parsing/Example 3: SLR(1): Difference between revisions

From Wiki**3

Root (talk | contribs)
Created page with "{{TOCright}} = Problem = S -> x A y | x B y | x A z B -> k A w S | k Initial symbol: S Terminals: { k, w, x, y, z } == Solution == category:Teaching [[category:Compil..."
 
Root (talk | contribs)
 
(4 intermediate revisions by the same user not shown)
Line 2: Line 2:
= Problem =
= Problem =


S -> x A y | x B y | x A z
Initial symbol: '''S'''
B -> k
A w S | k


Initial symbol: S
Terminals: '''{ k, w, x, y, z }'''


Terminals: { k, w, x, y, z }
Input: '''xwxkyy'''
 
S → x A y | x B y | x A z
B → k
A → w S | k
 
Is this an SLR(1) grammar?
 
Derive the SLR(1) parser for this grammar. Compact the parse table.
Describe the processing of the input string by the compacted parser.


== Solution ==
== Solution ==


[[category:Teaching]]
[[category:Compiladores]]
[[category:Compilers]]
[[category:Ensino]]

Latest revision as of 09:39, 2 May 2024

Problem

Initial symbol: S

Terminals: { k, w, x, y, z }

Input: xwxkyy

S → x A y | x B y | x A z
B → k
A → w S | k

Is this an SLR(1) grammar?

Derive the SLR(1) parser for this grammar. Compact the parse table. Describe the processing of the input string by the compacted parser.

Solution