6.1 Static Checking

The term static checking refers to error checks made at compile time. The opposite of static is dynamic, which refers to the time a program is executing. The error handing described in Module 5 finds static errors which do not correspond to the BNF description of that language. BNF is a metalanguage. A metalanguage is a way of describing another language. Thus, BNF describes a class of languages called context-free. Context-free languages can describe programming language syntactic structures such as statements and loop structures. Thus, if an END is left out, the error routines described in Module 5 will discover this.

However, context-free languages cannot describe the fact that a variable has been used but not defined or that a referenced label is not there. This requires contextual constraints which context-free grammars cannot specify.

There is a widely-accepted formalism, attribute grammars, for describing the range of semantic actions needed to do static checking of programming languages.

Send questions and comments to: Karen Lemone