History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: ANTLR-123
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Terence Parr
Reporter: Terence Parr
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
ANTLR v3

getting epsilon in k=4 decision ambiguity

Created: 20/May/07 12:19 PM   Updated: 25/Dec/07 04:08 PM
Component/s: analysis
Affects Version/s: 3.0
Fix Version/s: 3.1


 Description  « Hide
rule stat shows:

[12:17:17] warning(200): L.g:19:4: Decision can match input such as "<EPSILON>" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input

works for k=3.

grammar L;

classDef
: 'class' ID '{' method+ '}'
;

method
: type ID '(' ')' body
;

type: 'int' | 'float' | 'void' ;

body: '{' stat+ '}' ;

stat
options {
k=4;
}
: assignment ';'
| call ';'
;

call: id '(' expr (',' expr)* ')'
;

assignment
: id '=' expr
;

expr: INT
| id
;

id : ID ('.' ID)* ;

INT : '0'..'9'+ ;

ID : ('a'..'z'|'A'..'Z')+ ;

WS : (' '|'\t'|'\r'|'\n')+ {$channel=HIDDEN;} ;

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Terence Parr - 25/Dec/07 04:08 PM
With fixed k, use of DFAState.equals won't work. There will be repeated states. Altered to use more efficient state number.