Lexical elements: ----------------- ::= '/*' * '*/' ::= '//' * '\n' ::= 'class' | 'constructor' | 'function' | 'method' | 'field' | 'static' | 'var' | 'int' | 'char' | 'boolean' | 'void' | 'true' | 'false' | 'null' | 'this' | 'let' | 'do' | 'if' | 'else' | 'while' | 'return' ::= '{' | '}' | '(' | ')' | '[' | ']' | '.' | ',' | '; ' | '+' | '-' | '*' | '/' | '&' | '|' | '<' | '>' | '=' | '~' ::= A decimal number in the range 0..32767. ::= '"' A sequence of characters INCLUDING /* AND // not including double quote or newline '"' ::= A sequence of letters, digits, and underscore ('_') not starting with a digit. Program structure: ------------------ ::= 'class' '{' * * '}' ::= ('static' | 'field') (',' )* ';' ::= 'int' | 'char' | 'boolean' | ::= ('constructor' | 'function' | 'method') ('void' | ) '(' ')' ::= ( (',' )* )? ::= '{' * '}' ::= 'var' (',' )* ';' ::= ::= ::= Statements: ----------- ::= * ::= ( | | | | )* ::= 'let' ('[' ']')? '=' ';' ::= 'if' '(' ')' '{' '}' ( 'else' '{' '}' )? ::= 'while' '(' ')' '{' '}' ::= 'do' ';' ::= 'return' ? ';' Expressions: ------------ ::= (op )* ::= | | | | ( '[' ']') | | ( '(' ')' ) | ( ) ::= ( '(' ')') | (( | ) '.' '(' ')') ::= ( (',' )* )? ::= '+' | '-' | '*' | '/' | '&' | '|' | '<' | '>' | '=' ::= '-' | '~' ::= 'true' | 'false' | 'null' | 'this'