Efficient Comparison for Identifiers
Identifiers can be very long
Comparing them directly is inefficient
Lexical analyzer can immediately replace them with references to symbol objects
- hash table stores mapping of strings to symbols
- pointers equal iff strings equal
- useful to also have unique integer ID for each symbol (for storing within trees)
No need to undo the mapping of strings to symbol objects
- except for space reasons in very long compilation tasks
Alternative
Use the Trie dictionary data structure.