Jump to content

LR-attributed grammar

From Wikipedia, the free encyclopedia

This is the current revision of this page, as edited by Tom.Reding (talk | contribs) at 20:25, 29 June 2016 (→‎External links: Rem stub tag(s) (class = non-stub & non-list) using AWB). The present address (URL) is a permanent link to this version.

(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

LR-attributed grammars are a special type of attribute grammars. They allow the attributes to be evaluated on LR parsing. As a result, attribute evaluation in LR-attributed grammars can be incorporated conveniently in bottom-up parsing. zyacc is based on LR-attributed grammars. They are a subset of the L-attributed grammars, where the attributes can be evaluated in one left-to-right traversal of the abstract syntax tree. They are a superset of the S-attributed grammars, which allow only synthesized attributes. In yacc, a common hack is to use global variables to simulate some kind of inherited attributes and thus LR-attribution.

[edit]
  • http://www.cs.binghamton.edu/~zdu/zyacc/doc/zyacc_4.html
  • Reinhard Wilhelm: LL- and LR-Attributed Grammars. Programmiersprachen und Programmentwicklung, 7. Fachtagung, veranstaltet vom Fachausschuß 2 der GI (1982), 151–164, Informatik-Fachberichte volume 53.
  • J. van Katwijk: A preprocessor for YACC or A poor man's approach to parsing attributed grammars. Sigplan Notices 18:10 (1983), 12–15.