Skip to Main Content
Language Implementation Patterns
book

Language Implementation Patterns

by Terence Parr
December 2009
Intermediate to advanced content levelIntermediate to advanced
380 pages
9h 2m
English
Pragmatic Bookshelf
Content preview from Language Implementation Patterns
Pattern 19Symbol Table for Classes

Purpose

This pattern tracks symbols and builds a scope tree for non-nested classes with single inheritance.

Discussion

Classes are data aggregates that allow method members and that can inherit members from superclasses. Methods within classes can see global variables in the object-oriented version of our Cymbol language (since Cymbol is a subset of C++). To support these language semantics, we need to tweak the scope trees we used for structs in Pattern 18, Symbol Table for Data Aggregates. We’ll replace StructSymbol nodes with ClassSymbol nodes and have them point at their superclasses as well as their enclosing scopes (recall Figure 17, Scope tree for classes A and B). All the symbol table objects this ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Implementation Patterns

Implementation Patterns

Kent Beck

Publisher Resources

ISBN: 9781680500097Errata Page