To solve the syntactic analysis subproblem, a Java processor must examine the sequence of tokens resulting from lexical analysis, grouping those tokens into a hierarchy of phrases. A context-free grammar is used to describe the phrase structure.
Character sequences that must appear exactly as specified are 'quoted' in grammar rules. No additional lexical specification of these literal terminals is given. Non-literal terminals of the grammar are represented by symbols, and the form of the character strings acceptable as instances of these terminals is described by separate regular expressions.
The definition of a nonterminal is introduced by the name of the nonterminal being defined, followed by a colon. One or more alternative expansions for the nonterminal then follow, separated by slashes (/). The entire set of alternatives is terminated by a period.
Eli's notation for an optional symbol in a context-free grammar is to surround that symbol with square brackets ([ ]). In a regular expression, square brackets indicate a set of characters rather than an option. This corresponds to the ``one of'' notation found in the Java specification, but it cannot be used in context-free grammars.
A type-con file specifies the syntactic analysis subproblem: