Computer Science, asked by shanmukhsai852, 1 year ago

what is the difference between s attribute and l attribute

Answers

Answered by gauravdeshmukh
1

Synthesized attributes

A Synthesized attribute is an attribute of the nonterminal on the left-hand side of a production.

All of the attributes that we have used so far have been synthesized. Synthesized attributes represent information that is being passed up the parse tree.


Inherited attributes

In general, attribute equations are allowed to define attributes of any of the nonterminals in a production, even those on the right-hand side.

An attribute of a nonterminal on the right-hand side of a production is called an inherited attribute.

Recall that a top-down parser needs a left-factored grammar. Let's look at such a grammar and derive attribute equations for it. The grammar is as follows.

Similar questions