
304 An Introduction to Compiler Construction in a Java World
int, char and String Literals
An escape (ESC) character in j-- is a \ followed by n, r, t, b, f, ’, ", or \. In addition to
the true, false, and null literals, j-- supports int, char, and String literals as described
by the following regular expressions:
< i n t_literal > = 0|(1 -9){0 -9}
< char_literal > = ’( ESC |~( ’|\| LF| CR )) ’
< string_literal > = "{ ESC | ~ ( " | \ | LF | CR )}"
B.6.2 Syntactic Grammar
compilationUnit ::= [package qualifiedIdentifier ;]
{import qualifiedIdentifier ;}
{typeDeclaration} EOF
qualifiedIdentifier ::= <identifier> {. <identifier>}
typeDeclaration ::= modifiers classDeclaration ...