Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Attribute grammar
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Synthesized attributes== A synthesized attribute is computed from the values of attributes of the children. Since the values of the children must be computed first, this is an example of bottom-up propagation.{{Sfn|Knuth|1968|p=130}} To formally define a synthesized attribute, let <math>G= \langle V_n,V_t,P,S \rangle</math> be a formal grammar, where * <math>V_n</math> is the set of non terminal symbols * <math>V_t</math> is the set of terminal symbols * <math>P</math> is the set of [[Formal grammar#The syntax of grammars|productions]] * <math>S</math> is the distinguished, or start, symbol Then, given a string of nonterminal symbols <math>A</math> and an attribute name <math>a</math>, <math>A.a</math> is a synthesized attribute if all three of these conditions are met: * <math>A \rightarrow \alpha \in P</math> (i.e. <math>A \rightarrow \alpha</math> is one of the rules in the grammar) *<math>\alpha = \alpha_1 \ldots \alpha_n, \forall i, 1 \leq i \leq n: \alpha_i \in (V_n \cup V_t)</math> (i.e. every symbol in the body of the rule is either nonterminal or terminal) *<math>A.a = f(\alpha_{j_1}.a_1, \ldots ,\alpha_{j_m}.a_m)</math>, where <math>\{\alpha_{j_1}, \ldots ,\alpha_{j_m}\} \subseteq \{\alpha_1, \ldots ,\alpha_n\}</math> (i.e. the value of the attribute is a function <math>f</math> applied to some values from the symbols in the body of the rule)
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)