- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference between Synthesized and Inherited Attributes
Both Synthesized and Inherited Attribute are the part of semantics of a language that provide meaning to its constructs, like tokens and syntax structure. Semantics help interpret symbols, their types, and their relations with each other and its analysis judges whether the syntax structure constructed in the source program derives any meaning or not. Now on the basis of features of attributes we can distinguish between Synthesized and Inherited Attributes
Following are the important differences between Synthesized and Inherited Attributes.
|Sr. No.||Key||Synthesized Attribute||Inherited Attribute|
|1||Definition||Synthesized attribute is an attribute whose parse tree node value is determined by the attribute value at child nodes.To illustrate, assume the following production S → ABC if S is taking values from its child nodes (A, B, C), then it is said to be a synthesized attribute, as the values of ABC are synthesized to S.||On other hand 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. In case of S → ABC if A can get values from S, B and C. B can take values from S, A, and C. Likewise, C can take values from S, A, and B then S is said to be Inherited Attribute.|
|2||Design||As mentioned above in case of Synthesized attribute the production must have non-terminal as its head.||On other hand in case of Inherited attribute the production must have non-terminal as a symbol in its body.|
|3||Evaluation||Synthesized attribute can be evaluated during a single bottom-up traversal of parse tree.||While on other hand Inherited attribute can be evaluated during a single top-down and sideways traversal of parse tree.|
|4||Terminal||Both terminal and Non terminals can contain the Synthesized attribute.||On other hand only Non terminals can contain the Inherited attribute.|
|5||Usage||Synthesized attribute is used by both S-attributed SDT and L-attributed STD.||On other hand Inherited attribute is used by only L-attributed SDT.|
- What is the difference between novalidate and formnovalidate attributes?
- What is the difference between attributes and properties in python?
- What is the difference between id and name attributes in HTML?
- What is the difference between FromBody and FromUri attributes in C# ASP.NET\nWebAPI?
- What is the difference between “lang” and “type” attributes in a script tag?
- Explain attributes and the different types of attributes in DBMS?
- Is constructor inherited in Java?
- Difference between JCoClient and JCoDestination
- Difference between String and StringBuffer.
- Difference between StringBuffer and StringBuilder.
- Difference between C# and .Net
- Difference between Process and Thread
- Difference between Concurrency and Parallelism
- Difference between localhost and 127.0.0.1?