Some output devices won't render .Va text differently from .Li text when
displaying the man page. This unfortunately means that nonterminals
look exactly the same as terminals in the grammar. Add brackets
around nonterminals (which are otherwise unused in the grammar) so
that it is readable on these devices, too.
and is described by the following context-free grammar. This grammar is for
illustrative purposes only: it is ambiguous and doesn't capture all the nuances
of the C language. In this grammar, nonterminals are represented
and is described by the following context-free grammar. This grammar is for
illustrative purposes only: it is ambiguous and doesn't capture all the nuances
of the C language. In this grammar, nonterminals are represented
\[*e] represents the empty string, and both
.Li |
and successive \[->] under the same nonterminal indicate alternation. All
other symbols are terminals. The nonterminals
\[*e] represents the empty string, and both
.Li |
and successive \[->] under the same nonterminal indicate alternation. All
other symbols are terminals. The nonterminals
-.Va identifier , type-specifier , type-qualifier , storage-class-specifier
+.Va [ identifier ] , [ type-specifier ] ,
+.Va [ type-qualifier ] , [ storage-class-specifier ]
+.Va [ function-specifier ]
are defined as in C.
.Bl -column -offset indent ".Va english-decl" ""
are defined as in C.
.Bl -column -offset indent ".Va english-decl" ""
-.It Va english Ta \[->] Ta Li declare Va identifier Li as Va english-decl
-.It Ta \[->] Ta Li type Va english-decl
-.It Va english-decl Ta \[->] Ta Va sf-specs declarator
-.It Va declarator Ta \[->] Ta Va qualifiers Li pointer to Va declarator
-.It Ta \[->] Ta Li array Va size Li of Va declarator
-.It Ta \[->] Ta Li function Va parameters Li returning Va declarator
-.It Ta \[->] Ta Va tq-specs
-.It Va qualifiers Ta \[->] Ta Va type-qualifier qualifiers | No \[*e]
-.It Va tq-specs Ta \[->] Ta Va type-qualifier tq-specs
-.It Ta \[->] Ta Va type-specifier tq-specs
+.It Va english Ta \[->] Ta Li declare Va [ identifier ] Li as Va [ english-decl ]
+.It Ta \[->] Ta Li type Va [ english-decl ]
+.It Va english-decl Ta \[->] Ta Va [ sf-specs ] [ declarator ]
+.It Va declarator Ta \[->] Ta Va [ qualifiers ] Li pointer to Va [ declarator ]
+.It Ta \[->] Ta Li array Va [ size ] Li of Va [ declarator ]
+.It Ta \[->] Ta Li function Va [ parameters ] Li returning Va [ declarator ]
+.It Ta \[->] Ta Va [ tq-specs ]
+.It Va qualifiers Ta \[->] Ta Va [ type-qualifier ] [ qualifiers ] | No \[*e]
+.It Va tq-specs Ta \[->] Ta Va [ type-qualifier ] [ tq-specs ]
+.It Ta \[->] Ta Va [ type-specifier ] [ tq-specs ]
-.It Va sf-specs Ta \[->] Ta Va storage-class-specifier sf-specs
-.It Ta \[->] Ta Va function-specifier sf-specs
+.It Va sf-specs Ta \[->] Ta Va [ storage-class-specifier ] [ sf-specs ]
+.It Ta \[->] Ta Va [ function-specifier ] [ sf-specs ]
-.It Va size Ta \[->] Ta Va integer | Va identifier | Li * | No \[*e]
-.It Va parameters Ta \[->] Ta Po Va param-list Pc
-.It Ta \[->] Ta Po Va param-list Li , ... Pc
+.It Va size Ta \[->] Ta Va [ integer ] | Va [ identifier ] | Li * | No \[*e]
+.It Va parameters Ta \[->] Ta Po Va [ param-list ] Pc
+.It Ta \[->] Ta Po Va [ param-list ] Li , ... Pc
-.It Va param-list Ta \[->] Ta Va parameter | Va parameter Li , Va param-list
-.It Va parameter Ta \[->] Ta Va identifier Li as Va english-decl
-.It Ta \[->] Ta Va english-decl
+.It Va param-list Ta \[->] Ta Va [ parameter ] | Va [ parameter ] Li , Va [ param-list ]
+.It Va parameter Ta \[->] Ta Va [ identifier ] Li as Va [ english-decl ]
+.It Ta \[->] Ta Va [ english-decl ]
.El
.Sh RESOLVING AMBIGUITIES
The C context-free grammar has many ambiguities regarding declarations.
.El
.Sh RESOLVING AMBIGUITIES
The C context-free grammar has many ambiguities regarding declarations.