December 2009
Intermediate to advanced
380 pages
9h 2m
English
| Pattern 16 | Symbol Table for Monolithic Scope |
This pattern builds a symbol table for a language with a single, flat scope.
This pattern is suitable for simple programming languages (without functions), configuration files, small graphics languages, and other small DSLs.
The primary goal when building a symbol table is to construct a scope tree. In this case, the scope tree is pretty boring since it’s a single node (the global scope). The following table indicates how to build the single scope by responding to input constructs. We technically don’t need to push and pop scopes for this simple case, but we’ll do so for consistency with the other patterns.
Upon | Action(s) |
|---|---|
Start of file | push a GlobalScope. def BuiltInType objects for any ... |