Docsity

Implementing Ad Hoc Scheme - Compiler Construction - Lecture Notes, Study notes of Compiler Construction

Toggle sidebar
bg1
Sohail Aslam Compiler Construction Notes Set:5-90
L
Le
ec
ct
tu
ur
re
e
3
33
3
Implementing Ad-Hoc Scheme
The parser needs a mechanism to pass values of attributes from definitions in one snippet
to uses in another. We will adopt notation used by YACC for snippets and passing
values. Recall that the skeleton LR(1) parser stored two values on the stack
〈symbol,state〉. We can replace this with triples 〈value,symbol,state〉. On a reduction
by A → β, the parser pops 3×|β| items from the stack rather than 2×|β|. It pushes value
along with the symbol.

Partial preview of the text

Download Implementing Ad Hoc Scheme - Compiler Construction - Lecture Notes and more Study notes Compiler Construction in PDF only on Docsity!

Sohail Aslam Compiler Construction Notes Set:5-

Le Leccttuurree 3 333

Implementing Ad-Hoc Scheme

The parser needs a mechanism to pass values of attributes from definitions in one snippet to uses in another. We will adopt notation used by YACC for snippets and passing values. Recall that the skeleton LR(1) parser stored two values on the stack

〈 symbol,state 〉. We can replace this with triples 〈 value,symbol,state 〉. On a reduction

by A → β, the parser pops 3×|β| items from the stack rather than 2×|β|. It pushes value along with the symbol.