The Gateway to Computer Science Excellence
0 votes

I know that every S attributed grammar is L attributed but not vice versa. Can anybody give example of the case if i print the semantic rules using L attributed the result will be different from the S attributed evaluation ? And how should i print the rules in both cases.

Explain both case in this example :


in Compiler Design by Loyal (7k points) | 116 views
L- attributed evaluation is like, on first time you are seeing it, evaluate its semantic rule.

S- attributed evaluation is like, on last time you are seeing it, evaluate its semantic rule.

but in this example, there is no L-attribute or S- attribute ===> just use Post order traversal or Depth first search from left to right ===> 9 5 + 2 +
So brother are u saying that in L attributed the moment I hit the production execute its semantic rule and in S attributed when the reduction occurs then execute the rule?

Brother are u sure because I feel its the other way around (not sure though).

Can you please verify once :)
L attributed means, it can take values from it's left side and parent ===> when you first time hit it, then you already completed it's parent and left side variable.

1 Answer

0 votes
B is the ans
by Junior (659 points)
What is the difference between S attributed and L attributed evaluation ?. if a grammar is L attributed i can simply solve it and thats would also be the result if S attributed were perfomed. But if i grammar is S attributed then how its solved ?

Related questions

0 votes
1 answer
asked Dec 26, 2018 in Compiler Design by smsubham Boss (11.6k points) | 272 views
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,339 answers
105,203 users