next up previous contents
Next: Precedence Up: The Cool Reference Manual1 Previous: White Space   Contents

Cool Syntax

Figure 1: Cool syntax.
\mbox {\it program} & ::=& \lbrack\!\lbrack \mbo...
...\mbox {\bf true} \\
& \,\vert\,& \mbox {\bf false}

Figure 1 provides a specification of Cool syntax. The specification is not in pure Backus-Naur Form (BNF); for convenience, we also use some regular expression notation. Specifically, $A^{\ast}$ means zero or more $A$'s in succession; $A^+$ means one or more $A$'s. Items in square brackets $[\ldots]$ are optional. Double brackets $\lbrack\!\lbrack \, \rbrack\!\rbrack $ are not part of Cool; they are used in the grammar as a meta-symbol to show association of grammar symbols (e.g. $a \lbrack\!\lbrack b c \rbrack\!\rbrack ^ {+}$ means $a$ followed by one or more $bc$ pairs).