5.2 Synchronized Semantic Stacks

For context-free grammars, being more general than the restricted grammar with which can be handled by an RDP, we have to use a separate stack to store the semantic information generated during the semantic analysis process. RDP used the return stack of the implementation platform to store this information in local variables created automatically on the return stack. Generally, LL(k), LR(1) or LALR(1) parsers do not have this one-to-one relationship between the Activation Record on the return stack and detection of a particular syntactic construct.

The separate stacks, more than one of which may be used by a parser, must be kept in synchronization with the detection of a particular syntactic construct. Such stacks ...

Get Compilers: Principles and Practice now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.