December 2009
Intermediate to advanced
380 pages
9h 2m
English
To build a symbol table, we need to formalize what we do implicitly when we read and write software. First, let’s figure out how to represent program entities. Take a look at the following C++ code:
| | class T { … }; // define class T |
| | T f() { … } // define function f returning type T |
| | int x; // define variable x of type int |
We unconsciously define three symbols (program entities) in our head: class T, function f, and variable x. To build a language application, we need to mimic this in software. For those definitions, we need to do something like the following:
| | Type c = new ClassSymbol("T"); // define class |
| | MethodSymbol m = new MethodSymbol("f", c); // define method |
| | Type |
Read now
Unlock full access