Contents    Page-10    Prev    Next    Page+10    Index   

Lexical Scoping[adapted from slide by John Werth.]

Scope is the region of program text over which a symbol can be referenced. In most languages, the scope of a variable is determined by syntax, e.g. a variable can be used only inside the procedure that defines it. This notion of scope is reflected in the symbol table, which is called lexical scoping. With lexical scoping, a name is defined when it can be looked up in the lexicon (symbol table) at the point of use.

Some languages (Algol, Pascal, PL/I) have allowed procedures to be nested inside other procedures; however, this has a high runtime cost and only slight benefit.