You are on page 1of 3

1. Define SDD.

= SDD: Specifies the values of attributes by associating semantic rules with the
productions.
2. What is SDT?
= Self-determination theory (SDT) is a macro theory of human motivation and personality
that concerns people's innate growth tendencies and innate psychological needs. It
pertains to the motivation behind people's choices in the absence of external influences
and distractions
3. "S-attributed uses top-up parser". State true or false. annotated parse tree
= True: Synthesized attributes are computed from the values of the attributes of the
children nodes.
5. Define annotated parse tree.
=AN ANNOTATED PARSE TREE. is a parse tree showing the values of the attributes at
each node. The process of computing the attribute values at the nodes is called annotating
or decorating the parse tree
6. What is dependency graph?
= According to Pablo Azero of Jalasoft, “A dependency graph is a graph that represents
dependencies between objects of some application domain.” That is, it's a tool that maps
out relationships between the different components of an application
7. Define L-attributed grammar.
= L-Attributed definitions are the L-Attribute class of Syntax Directed Definitions (SDD). The
idea behind this class is that dependency-graph edges between attributes associated with
a production body can go from left to right, but not right to left, thus L-attribute.
8. State two steps to implement SDT's.
= Any SDT can be implemented as follows: Ignoring the actions, parse the input and
produce a parse tree as a result. Then, examine each interior node N, say one for
production A -± a. Add additional children to N for the actions in a, so the children of N from
left to right have exactly the symbols and actions of a.
9. What are the two classes of SDD's?
= SDD is a CFG along with attributes and rules. An attribute is associated with grammar
symbols (attribute grammar).
10. S-attributed uses which type of parser
= If an SDT uses only synthesized attributes, it is called as S-attributed SDT. S-attributed
SDTs are evaluated in bottom-up parsing, as the values of the parent nodes depend upon
the values of the child nodes
11. What is an L-attributed definition?
= If an SDT uses both synthesized attributes and inherited attributes with a restriction that
inherited attribute can inherit values from left siblings only, it is called as L-attributed SDT
12. When do we use the inherited attributes?
= You customize an inherited attribute domain by editing its definition at the subclass level.
When you edit an inherited attribute definition, the changes propagate to all members of the
subclass, including other subclasses under that subclass.
13. List any two applications of SDT.
= SDT is used for Executing Arithmetic Expression.
In the conversion from infix to postfix expression.
In the conversion from infix to prefix expression.
It is also used for Binary to decimal conversion.
In counting number of Reduction.
14. Enlist SDT schemes.
= The syntax directed translation scheme is used to evaluate the order of semantic rules. In
translation scheme, the semantic rules are embedded within the right side of the
productions. The position at which an action is to be executed is shown by enclosed
between braces.
Synthesized Translation.
Inherited Translation.
Translation on Parse Tree.
15. For each parse-tree node (say X) the dependency graph attribute associated with
that node. State True/False.
= True. For each parse-tree node, say a node labeled by grammar symbol X ,
the dependency graph has a node for each attribute associated with X .
1. What is SDD? Which two notations used by SDD?
= SDD: Specifies the values of attributes by associating semantic rules with the
productions.
2. What is attributed grammar? Define it. Explain with example.
= Attribute grammar is a medium to provide semantics to the context-free grammar and it
can help specify the syntax and semantics of a programming language. Attribute grammar
(when viewed as a parse-tree) can pass values or information among the nodes of a tree.
Example: E → E + T { E. value = E.
3. What is inherited attribute? Explain with example.
= They allow contextual information to flow into a symbol from above or from the side, so
that the rules of that production can be enforced in different ways (or generate different
values) depending on surrounding context.
EXAMPLE:The attribute can take value either from its parent or from its siblings (variables
in the LHS or RHS of the production). For example, let's say A -> BC is a production of a
grammar and B's attribute is dependent on A's attributes or C's attributes then it will be
inherited attribute.
4. What is annotated parse tree? How to evaluate it? Explain with example.
= An annotated parse tree is one in which various facts about the program have been
attached to parse tree nodes. For example, one might compute the set of identifiers that
each subtree mentions, and attach that set to the subtree.
5. Explain dependency graph with example.
= A dependency graph is used to represent the flow of information among the attributes in a
parse tree. The underlying structure of a dependency graph is a directed graph where each
node points to the node on which it depends.
6. Write a short note on: Ordering the evaluation of attributes.
= An edge( i.e. first node to the second node) in the dependency graph represents that the
attribute of the second node is dependent on the attribute of the first node for further
evaluation. This order of evaluation gives a linear order called topological order.
7. With the help of example describe L- and S-attributed definitions.
= If an SDT uses both synthesized attributes and inherited attributes with a restriction that
inherited attribute can inherit values from left siblings only, it is called as L-attributed SDT.
Attributes in L-attributed SDTs are evaluated by depth-first and left-to-right parsing manner.
9. What is syntax tree? How to construct it? Describe with example.
= The syntax tree is shortened form of the Parse Tree. Example1 − Draw Syntax Tree for
the string a + b ∗ c − d. Each node in a syntax tree can be executed as data with multiple
fields. In the node for an operator, one field recognizes the operator and the remaining field
includes a pointer to the nodes for the operands.
10. Write a short note on: Structure of a type.
= Structure types have value semantics. That is, a variable of a structure type contains an
instance of the type. By default, variable values are copied on assignment, passing an
argument to a method, and returning a method result. For structure-type variables, an
instance of the type is copied. For more information, see Value types.
Typically, you use structure types to design small data-centric types that provide little or no
behavior. For example, .NET uses structure types to represent a number (both integer and
real), a Boolean value, a Unicode character, a time instance. If you're focused on the
behavior of a type, consider defining a class. Class types have reference semantics. That
is, a variable of a class type contains a reference to an instance of the type, not the
instance itself.
11. Describe SDT schemes in detail.
= The Syntax directed translation scheme is a context -free grammar.
The syntax directed translation scheme is used to evaluate the order of semantic rules.
In translation scheme, the semantic rules are embedded within the right side of the
productions.
The position at which an action is to be executed is shown by enclosed between braces. It
is written within the right side of the production.
12. Explain Postfix Translation Schemes with the help of example.
= In postfix notation, the operator appears after the operands, i.e., the operator between
operands is taken out & is attached after operands. Example1 − Translate a ∗ d − (b + c)
into Postfix form. Example2 − Convert a + (b ∗⊝ c) is in Postfix form. Here ⊝ represents
the unary minus operator.
14. Explain the ways to control side effects in SDD's.
= These side effects in SDD can be controlled in two ways: Permit incidental side effects
and constraint admissible evaluation orders to have the same translation as any admissible
order

You might also like