In a formal description of a computer language, it is often convenient to use a more precise language than English. This language-description language is referred to as a metalanguage. The metalanguage which will be used to describe the C language is that specified by British Standard 6154. A tutorial introduction to the standard syntactic metalanguage is available from the National Physical Laboratory.
The BS6154 standard syntactic metalanguage is similar in concept to many other metalanguages, particularly those of the well-known Backus-Naur family. It therefore suffices to give a very brief informal description here of the main points of BS6154; for more detail, the standard itself should be consulted.
- Terminal strings of the language—those built up by rules of the language—are enclosed in quotation marks.
- Non-terminal phrases are identified by names, which may consist of several words.
- When numbers are used in the text they will usually be decimal. When we wish to make clear the base of a number, the base is used as a subscript, for example 158 is the number 15 in base eight and 13 in decimal, 2F16 is the number 2F in hexadecimal and 47 in decimal.
- A sequence of items may be built up by connecting the components with commas.
- Alternatives are separated by vertical bars (‘|’).
- Optional sequences are enclosed in square brackets (‘[’ and ‘]’).
- Sequences which may be repeated zero or more times are enclosed in braces (‘{’ and ‘}’).
- Each phrase definition is built up using an equals sign to separate the two sides, and a semicolon to terminate the right hand side.