2
C H A P T E R
Grammars
Grammar, which knows how to control even kings . . .
Moliere
, Les Femmes Savantes
(1672), Act II, scene vi
T
HIS chapter describes the context free grammars used in this specification to
define the lexical and syntactic structure of a Java program.
2.1   Context Free Grammars
A
context free grammar
 consists of a number of
productions
. Each production has
an abstract symbol called a
nonterminal
 as its
left hand side
, and a sequence of
one or more nonterminal and
terminal
 symbols as its
right hand side
. For each
grammar, the terminal symbols are drawn from a specified
alphabet
.
Starting from a sentence consisting of a single distinguished nonterminal,
called the
goal symbol
, a given context free grammar specifies a
language
,
namely, the infinite set of possible sequences of terminal symbols that can result
from repeatedly replacing any nonterminal in the sequence with a right hand side
of a production for which the nonterminal is the left hand side.
2.2   The Lexical Grammar
A
lexical grammar
 for Java is given in  3. This grammar has as its terminal sym 
bols the characters of the Unicode character set. It defines a set of productions,
starting from the goal symbol
Input
( 3.5), that describe how sequences of Uni 
code characters ( 3.1) are translated into a sequence of input elements ( 3.5).
These input elements, with white space ( 3.6) and comments ( 3.7) dis 
carded, form the terminal symbols for the syntactic grammar for Java and are
called Java
tokens
 ( 3.5). These tokens are the identifiers ( 3.8), keywords ( 3.9),
literals ( 3.10), separators ( 3.11), and operators ( 3.11) of the Java language.
7






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved