Programming language specification

On that note, the language syntax usually consists of a combination of the following three construction components: Syntax specification generally supposes a natural language description in order to provide modest comprehensibility.

However, the formal representation of the above outlined components is usually part of the section as it favors the implementation and approval of the language and its concepts.

Formulating a rigorous semantics of a large, complex, practical programming language is a daunting task even for experienced specialists, and the resulting specification can be difficult for anyone but experts to understand.

These manuals can run to hundreds of pages, e.g., the print version of The Java Language Specification, 3rd Ed.

For example, the semantics of Java threads were specified in English, and it was later discovered that the specification did not provide adequate guidance for implementors.

However, supplemental natural language descriptions of the semantics are often included to aid understanding of the formal definitions.

For example, The ISO Standard for Modula-2 contains both a formal and a natural language definition on opposing pages.

The power and scalability of these tools varies widely: full formal verification is computationally intensive, rarely scales beyond programs containing a few hundred lines[citation needed] and may require considerable manual assistance from a programmer; more lightweight tools such as model checkers require fewer resources and have been used on programs containing tens of thousands of lines; many compilers apply static type checks to any program they compile.

On the other hand, defining language semantics through a reference implementation also has several potential drawbacks.

The chief advantage of this approach to semantic description is that it is easy to determine whether a language implementation passes a test suite.