forked from cplusplus/draft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrammar.tex
61 lines (50 loc) · 1.26 KB
/
grammar.tex
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
\infannex{gram}{Grammar summary}
\rSec1[gram.general]{General}
\pnum
\indextext{grammar}%
\indextext{summary!syntax}%
This summary of \Cpp{} grammar 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\iref{stmt.ambig,dcl.spec,class.member.lookup}
are applied to distinguish expressions from declarations.
Further, access control, ambiguity, and type rules are used
to weed out syntactically valid but meaningless constructs.
\rSec1[gram.key]{Keywords}
\pnum
\indextext{keyword}%
New context-dependent keywords are introduced into a program by
\tcode{typedef}\iref{dcl.typedef},
\tcode{namespace}\iref{namespace.def},
class\iref{class}, enumeration\iref{dcl.enum}, and
\keyword{template}\iref{temp}
declarations.
\begin{ncbnf}
typedef-name:\br
identifier\br
simple-template-id
\end{ncbnf}
\begin{ncbnf}
namespace-name:\br
identifier\br
namespace-alias
\end{ncbnf}
\begin{ncbnf}
namespace-alias:\br
identifier
\end{ncbnf}
\begin{ncbnf}
class-name:\br
identifier\br
simple-template-id
\end{ncbnf}
\begin{ncbnf}
enum-name:\br
identifier
\end{ncbnf}
\begin{ncbnf}
template-name:\br
identifier
\end{ncbnf}
\FlushAndPrintGrammar