In Syntax Directed Definition, two attributes are used one is Synthesized attribute and another is inherited attribute. An attribute is said to be Synthesized attribute if its parse tree node value is determined by the attribute value at child nodes whereas An attribute is said to be Inherited attribute if its parse tree node value is determined by the attribute value at parent and/or siblings node.
Now, we shall see the comparison between Synthesized Attributes and Inherited Attributes.
The comparison between these two attributes are given below:
|S.NO||Synthesized Attributes||Inherited Attributes|
|1.||An attribute is said to be Synthesized attribute if its parse tree node value is determined by the attribute value at child nodes.||An attribute is said to be Inherited attribute if its parse tree node value is determined by the attribute value at parent and/or siblings node.|
|2.||The production must have non-terminal as its head.||The production must have non-terminal as a symbol in its body.|
|3.||A synthesized attribute at node n is defined only in terms of attribute values at the children of n itself.||A Inherited attribute at node n is defined only in terms of attribute values of n’s parent, n itself, and n’s siblings.|
|4.||It can be evaluated during a single bottom-up traversal of parse tree.||It can be evaluated during a single top-down and sideways traversal of parse tree.|
|5.||Synthesized attributes can be contained by both the terminals or non-terminals.||Inherited attributes can’t be contained by both, It is only contained by non-terminals.|
|6.||Synthesized attribute is used by both S-attributed SDT and L-attributed STD.||Inherited attribute is used by only L-attributed SDT.|
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Types of Attributes in ER Model
- Attributes to Relationships in ER Model
- Differences between TCP and UDP
- Differences between Data paths
- Differences between IPv4 and IPv6
- Differences between POP3 and IMAP
- What are the differences between HTTP, FTP, and SMTP?
- Differences between Pure and Slotted Aloha
- Differences between Synchronous and Asynchronous Counter
- Differences between Intradomain and Interdomain Routing
- Differences between Associative and Cache Memory
- Differences between Multiple Cycle Datapath and Pipeline Datapath
- Differences between Single Cycle and Multiple Cycle Datapath
- Differences between Computer Architecture and Computer Organization
- Differences between Single Datapath and Pilpeline Datapath
- Differences between Magnetic Tape and Magnetic Disk
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.