Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

 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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Artificial Intelligence Structures And Strategies For Complex Problem Solving

Authors: George Luger

6th Edition

0321545893, 9780321545893

More Books

Students also viewed these Programming questions

Question

understand what working means to workers;

Answered: 1 week ago