Consider the following grammar S ? L = R | R L ? *R | id R ? L Task 1: Construct the LR(0) automaton and the SLR(1) parsing table for the above grammar (15 Marks)
Added by Barry H.
Close
Step 1
First, let's find the closure of the initial item S -> . L R. The closure of an item is the set of all items that can be derived from it by applying productions. Closure(I0) = {S -> . L R, L -> . R, L -> . R * R, L -> . id L, R -> .} Show more…
Show all steps
Your feedback will help us improve your experience
Supreeta N and 71 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Consider the grammar $S \rightarrow a$ $S \rightarrow a b$ The given grammar is: (A) LR (1) only (B) LL (1) only (C) Both LR (1) and LL (1) (D) LR (1) but not LL (1)
COMPILER DESIGN
LEXICAL ANALYSIS AND PARSING
Consider the finite-state automaton given by the following transition diagram. a) Construct an annotated next-state table for this automaton. b) For each of the following strings, determine whether or not it is accepted by the automaton. Show your work. 0100 01110 101010 10001 c) What is the language accepted by the automaton? d) What is a regular expression that defines the same language?
Shaiju T.
Use top-down parsing to determine whether each of the following strings belongs to the language generated by the grammar in Example $12 .$ $$ \begin{array}{ll}{\text { a) } b a b a} & {\text { b) } a b a b} \\ {\text { c) } c b a b a} & {\text { d) } b b b c b a}\end{array} $$
Modeling Computation
Languages and Grammars
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD