forked from cplusplus/draft
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrambase.tex
More file actions
69 lines (55 loc) · 1.41 KB
/
Copy pathgrambase.tex
File metadata and controls
69 lines (55 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
\infannex{gram}{Grammar summary}
\begin{paras}
\pnum
\index{grammar}%
\index{summary, syntax}%
This summary of \Cpp\ syntax is intended to be an aid to comprehension.
It is not an exact statement of the language.
In particular, the grammar described here accepts
a superset of valid \Cpp\ constructs.
Disambiguation rules (\ref{stmt.ambig}, \ref{dcl.spec}, \ref{class.member.lookup})
must be applied to distinguish expressions from declarations.
Further, access control, ambiguity, and type rules must be used
to weed out syntactically valid but meaningless constructs.
\rSec1[gram.key]{Keywords}
\pnum
\index{keyword}%
New context-dependent keywords are introduced into a program by
\tcode{typedef}~(\ref{dcl.typedef}),
\tcode{namespace}~(\ref{namespace.def}),
class~(Clause \ref{class}), enumeration~(\ref{dcl.enum}), and
\tcode{template}~(Clause \ref{temp})
declarations.
\begin{bnf}
typedef-name:\br
identifier
\end{bnf}
\begin{bnf}
namespace-name:\br
original-namespace-name\br
namespace-alias
original-namespace-name:\br
identifier
namespace-alias:\br
identifier
\end{bnf}
\begin{bnf}
class-name:\br
identifier\br
simple-template-id
\end{bnf}
\begin{bnf}
enum-name:\br
identifier
\end{bnf}
\begin{bnf}
template-name:\br
identifier
\end{bnf}
Note that a
\grammarterm{typedef-name}\
naming a class is also a
\grammarterm{class-name}\
(\ref{class.name}).
\end{paras}
% machine generated after this line; do not edit