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
L-attributed 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!
{{More citations|date=July 2020}} '''L-attributed grammars''' are a special type of [[attribute grammar]]s.<ref name="Knuth1968">{{cite journal |last1=Knuth |first1=Donald E. |authorlink1=Donald Knuth |date=June 1968 |title=Semantics of context-free languages |journal=[[Mathematical Systems Theory]] |volume=2 |issue=2 |pages=127β145 |citeseerx=10.1.1.455.1434 |doi=10.1007/BF01692511 |issn=0025-5661 |s2cid=5182310 |id={{QID|56672530}}}}</ref> They allow the attributes to be evaluated in one depth-first left-to-right traversal of the [[abstract syntax tree]]. As a result, attribute evaluation in L-attributed grammars can be incorporated conveniently in [[top-down parsing]]. A syntax-directed definition is L-attributed if each ''inherited'' attribute of <math>X_j</math> on the right side of <math>A \rightarrow X_1, X_2, \dots, X_n </math> depends only on # the attributes of the symbols <math>X_1, X_2, \dots, X_{j-1}</math> # the inherited attributes of <math>A</math> (but not its synthesized attributes) Every S-attributed syntax-directed definition is also L-attributed. Implementing L-attributed definitions in Bottom-Up parsers requires rewriting L-attributed definitions into translation schemes. Many programming languages are L-attributed. Special types of [[compiler]]s, the narrow compilers, are based on some form of L-attributed grammar. These are a strict superset of [[S-attributed grammar]]s. Used for code synthesis. Either "inherited attributes" or "synthesized attributes" associated with the occurrence of symbol <math>X_1,X_2, \dots, X_n</math>.
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)