A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Inherited attributes
An inherited attribute is one whose value at a node in a parse tree is defined in terms of
attributes at the parent and/or sibling of that node. Inherited attributes are convenient for
express the dependence of a programming language construct on the context in which it appears.
For example, we can use an inherited attribute to keep track of whether an identifier appears on
the left or right side of an assignment in order to decide whether the adress or the value
of the identifier is needed. Although it is always possible to rewrite a syntax-directed definition
to use only synthesized attributes, it is often more natural to use syntax-directed definitions with
inherited attributes.
in "Compilers: Principles, Techniques and Tools"
Alfred V. Aho, Ravi Sethi, Jeffrey D. Ullman
See also: Synthesized attributes
Intermediate Representation
In computing, an intermediate representation is a data structure that is constructed from
input data to a program, and from which part or all of the output data of the program is
constructed in turn.
Use of the term usually implies that most of the information present in the input is retained
by the intermediate representation, with further annotations or rapid lookup features.
A canonical example is found in most modern compilers, where the linear human-readable text
representing a program is transformed into an intermediate graph data structure that allows
flow analysis and re-arrangements before starting to create the list of actual CPU instructions
that will do the work.
Interpreter
An interpreter performs the operations implied by the source program, instead of producing
a target program as a translation. For an assignment statement, for example, an interpreter
might build a tree and then carry out the operations at the nodes as it "walks" the tree.
At the root it would discover it had an assignment to perform, so it would call a routine to
evaluate the expression on the right, and then store the resulting value in the identifier at
the left.
Interpreters are frequently used to execute command languages, since each operator executed in
a command language is usually an invocation of a complex routine such as an editor or compiler.
Similarly, some high-level languages are normally interpreted because there are many things about
the data, such as the size and shape of arrays, that cannot be deduced at compile time.