4 4 votes I read from Dragon Book that Syntax directed translation is used for type checking for instance where performing some reductions and other operation on the string or symbol we perform some additional operations. https://en.wikipedia.org/wiki/L-attributed_grammar Here for instance many things are sorted but still i have some doubts regarding this. Defintion in compiler can be on synthesized and inherited attribute and we all know L definitions have both s and inhertited attributes but some questions interpret it differently for ex : In both of this question The answer is L attributes definition I understand that but it could be Both because L attribute definition is both. Resolve my doubt ! Compiler Design syntax-directed-translation compiler-design + – saxena0612 5.4k views answer comment Share Follow Print See all 4 Comments 4 4 Comments reply joshi_nitish commented Nov 12, 2017 reply Follow flag firstly, 1st SDT is neither L-attributed nor S-attributed because A.x=B.x is not allowed in either of them. secondaly, every S-attributed SDT is L-attribued but converse is not true, therefore 2nd SDT is only L-attributed, because it consists of inherited attributes 6 6 replyShare saxena0612 commented Nov 12, 2017 reply Follow flag True ! that! One more doubt here in the second question we don`t consider constants right? But while making the tree for any derivation for the same c will opt 4 as constant from somewhere .Why we are not counting it as the synthesized attribute? 1 1 replyShare Ananthakrishnan Saji commented Jan 7, 2018 reply Follow flag What do you mean by a.x= b.x is not allowed in either of them? I see rules similiar to a.x =b.x in the second question for eg: M.x=A.x+b.x, ( The parameter of the similiarity is both rules donot take anything from LHS). So, what is the difference between the 2 rules? Can someone please explain in more detail? 0 0 replyShare Deepak Shinde commented Jan 20, 2018 reply Follow flag https://www.youtube.com/watch?v=rdnAJBoFKOw&list=PLEbnTDJUr_IcPtUXFy2b1sGRPsLFMghhS&index=19 you should refer this Ravindrababu Sir's lecture. Points to note here are : Every S attributed SDT is also a L attributed SDT and vice versa is not true. In L attributed SDT every non terminal can inherit from any of it's left sibling or parent or children (Syntesized attribute) but never from right sibling. Hence it's called L-Attributed SDT According to this logic a.x = b.x can't be L attributed (Since a.x is taking the value from b.x which is right sibling and hence it can't be S attributed too. And, in M.x = A.x + B.x M is taking values from it's children A and B which is allowed. 1 1 replyShare Please log in or register to add a comment.