PLDB
Languages Features Calendar About Lists Add Language
GitHub icon

Symbol Tables

Symbol Tables

Symbol Tables are a language feature.

In computer science, a symbol table is a data structure used by a language translator such as a compiler or interpreter, where each identifier (a.k.a. symbol) in a program's source code is associated with information relating to its declaration or appearance in the source. In other words, the entries of a symbol table store the information related to the entry's corresponding symbol.. Read more on Wikipedia...

Languages with Symbol Tables include C, Python, Racket

Example from C:

// Declare an external function extern double bar(double x); // Define a public function double foo(int count) { double sum = 0.0; // Sum all the values bar(1) to bar(count) for (int i = 1; i <= count; i++) sum += bar((double) i); return sum; } // Symbol Table: // Symbol name|Type|Scope // bar|function, double|extern // x|double|function parameter // foo|function, double|global // count|int|function parameter // sum|double|block local // i|int|for-loop statement

Example from Python:

# https://eli.thegreenplace.net/2010/09/18/python-internals-symbol-tables-part-1

Example from Racket:

;; Some programming languages allow the symbol table to be manipulated at run-time, so that symbols can be added at any time.

Article source

PLDB - Build the next great programming language 路 v2022 Docs Acknowledgements Email GitHub