Syntax-directed translation fundamentally works by adding actions to the productions in a
context-free grammar, resulting in a Syntax-Directed Definition (SDD). Actions are steps or procedures that will be carried out when that production is used in a derivation. A grammar specification embedded with actions to be performed is called a
syntax-directed translation scheme (sometimes simply called a 'translation scheme'.) Each symbol in the grammar can have an
attribute, which is a value that is to be associated with the symbol. Common attributes could include a variable type, the value of an expression, etc. Given a symbol
X, with an attribute
t, that attribute is referred to as
X.
t Thus, given actions and attributes, the grammar can be used for translating strings from its language by applying the actions and carrying information through each symbol's attribute. == Metacompilers ==