Tutorial on Name Analysis
This tutorial introduces to the solution of the name analysis
task in language implementation. It demonstrates many aspects of
that task which occur in programming languages or special purpose
languages. They are developed from basic ones, such as nested scopes,
up to more complex ones, such as classes with multiple inheritance.
This tutorial may be used as a practical introduction to the
specification techniques for name analysis, or as a source of
examples that show how to solve certain problems, or as a source of
hints for language design.
This file is an executable specification. An analyzer for a small
artificial language can be generated from it. The language is
kept small by restricting it to those constructs necessary to
demonstrate the name analysis task, not regarding its usability
for programming. Its notation is inspired by Pascal,
although the name analysis rules are not taken from Pascal.
The generated analyzer produces output that reports the result of
name analysis, i. e. the binding of identifier occurrences.
The explanations in this tutorial assume that the reader is familiar
with the use of the Eli system, with the use of its module library,
and knows the general description of the name analysis task
in the documentation of the module library, see Name Analysis of Specification Module Library: Name-Analysis.
This tutorial is available in three variants that differ in the
basic underlying scope rules, C-like or Algol-like.
The third variant is based on C-like scope rules; its computations
are executed while the input is read.
The specifications differ only in which library modules being
used, and, in a few places, where they are applied.
This variant of the tutorial shows the
Algol-like
scope rules.
|