56 lines
2.1 KiB
Markdown
56 lines
2.1 KiB
Markdown
[syntax]
|
||
|
||
# 4 General principles [[intro]](./#intro)
|
||
|
||
## 4.3 Syntax notation [syntax]
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/intro.tex#L1073)
|
||
|
||
In the syntax notation used in this document, syntactic
|
||
categories are indicated by *italic, sans-serif* type, and literal words
|
||
and characters in constant width type[.](#1.sentence-1)
|
||
|
||
Alternatives are
|
||
listed on separate lines except in a few cases where a long set of
|
||
alternatives is marked by the phrase âone ofâ[.](#1.sentence-2)
|
||
|
||
If the text of an alternative is too long to fit on a line, the text is continued on subsequent lines indented from the first one[.](#1.sentence-3)
|
||
|
||
An optional terminal or non-terminal symbol is indicated by the subscript
|
||
âoptâ, so
|
||
|
||
{ [*expression*](expr.comma#nt:expression "7.6.20 Comma operator [expr.comma]")opt }
|
||
|
||
indicates an optional expression enclosed in braces[.](#1.sentence-4)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/intro.tex#L1087)
|
||
|
||
Names for syntactic categories have generally been chosen according to
|
||
the following rules:
|
||
|
||
- [(2.1)](#2.1)
|
||
|
||
*X-name* is a use of an identifier in a context that
|
||
determines its meaning (e.g., [*class-name*](class.pre#nt:class-name "11.1 Preamble [class.pre]"),[*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4 The typedef specifier [dcl.typedef]"))[.](#2.1.sentence-1)
|
||
|
||
- [(2.2)](#2.2)
|
||
|
||
*X-id* is an identifier with no context-dependent meaning
|
||
(e.g., [*qualified-id*](expr.prim.id.qual#nt:qualified-id "7.5.5.3 Qualified names [expr.prim.id.qual]"))[.](#2.2.sentence-1)
|
||
|
||
- [(2.3)](#2.3)
|
||
|
||
*X-seq* is one or more *X*'s without intervening
|
||
delimiters (e.g., [*declaration-seq*](dcl.pre#nt:declaration-seq "9.1 Preamble [dcl.pre]") is a sequence of
|
||
declarations)[.](#2.3.sentence-1)
|
||
|
||
- [(2.4)](#2.4)
|
||
|
||
*X-list* is one or more *X*'s separated by
|
||
intervening commas (e.g., [*identifier-list*](cpp.pre#nt:identifier-list "15.1 Preamble [cpp.pre]") is a sequence of
|
||
identifiers separated by commas)[.](#2.4.sentence-1)
|