-
Book Overview & Buying
-
Table Of Contents
Building Programming Language Interpreters
By :
The lexical pad is the name we give to the mechanism by which an interpreter or a compiler maps a name in the code to the container that holds the corresponding value.
Different programming languages put different requirements on the compiler or interpreter on what should be possible in terms of how the lexical pad can be queried and manipulated. There are areas of the code that have uniform visibility of names, which are called the lexical scopes for that particular programming language.
Some languages, such as Python, have the scope matching the body of a function. Any variable defined in a function is visible for the entire duration of the function. Other languages, such as C++, have the scope narrowed down to a particular block of code, meaning the language gives finer-grained control to the user of the life cycle of the variables.
In addition to those two choices, languages that support some functional idioms also support closure scopes, where a variable that...
Change the font size
Change margin width
Change background colour