Using a following grammar and semantic rules, draw a annotated parser tree of a sentence 1 0
No answer yet for this question.
Ask a Tutor
Question:
Using a following grammar and semantic rules, draw a annotated parser tree of a sentence 1 0 1 1 1 and determine what these semantic rules are for?
A.
N -> L { N.dval = L.dval }
L -> L B { L.dval = L.dval * 2 + B.dval }
L -> B { L.dval = B.dval }
B -> 0 { B.dval = 0 }
B -> 1 { B.dval = 1 }
B.
Q 2 - Consider the following grammar,
S' S
S L = R
S R
L *R
L id
R L
The non-terminals are S', S, L, R and the terminals are =, *, id.
A) Compute the canonical collection of sets LR(1) items.
B) Construct the LR(1) and LALR(1) parsing table (action and goto)
C) Your task is to show the contents of the stack for input string *id = id using above table.
Related Book For
Artificial Intelligence Structures And Strategies For Complex Problem Solving
ISBN: 9780321545893
6th Edition
Authors: George Luger
Posted Date: