modula-2 home

  Home  
  Tutorial  
  Win32 API  
  Reference  
  Projects  
 

 

Syntax

A language is an infinite set of sentences, namely the sentences well formed according to its syntax. In Modula-2, these sentences are called compilation units. Each unit is a finite sequence of symbols from a finite vocabulary. The vocabulary of Modula-2 consists of identifiers, numbers, strings, operators, and delimiters. They are called lexical symbols and are composed of sequences of characters. (Note the distinction between symbols and characters.)

To describe the syntax, an extended Backus Naur Formalism called EBNF is used. Angular brackets [ ] denote optionality of the enclosed sentential form, and curly brackets { } denote its repetition (possibly 0 times). Syntactic entities (non terminal symbols) are denoted by English words expressing their intuitive meaning. Symbols of the language vocabulary (terminal symbols) are strings enclosed in quote marks or words written in capital letters, so called reserved words.


Source:

  • Wirth N: Programming in Modula-2, 3rd ed. Springer Verlag, Berlin, 1985.