LALR(1) GRAMMAR
Problem #2: Modifiers Too Specific
19.1.2
ClassType:
ClassOrInterfaceType
InterfaceType:
ClassOrInterfaceType
19.1.2 Problem #2: Modifiers Too Specific
Consider the two groups of productions:
FieldDeclaration:
FieldModifiers
opt
Type VariableDeclarators
;
FieldModifiers:
FieldModifier
FieldModifiers FieldModifier
FieldModifier: one of
public
protected
private
final static transient volatile
and:
MethodHeader:
MethodModifiers
opt
ResultType MethodDeclarator Throws
opt
MethodModifiers:
MethodModifier
MethodModifiers MethodModifier
MethodModifier: one of
public
protected
private
static
abstract final native synchronized
Now consider the partial input:
class Problem2 { public static int
When the parser is considering the token
static
, with one token lookahead to
symbol
int
or, worse yet, considering the token
public
with lookahead to
static
it cannot yet tell whether this will be a field declaration such as:
public static int maddie = 0;
or a method declaration such as:
435
footer
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