[antlr-interest] how can i fix this

clocKwize clockwize at blueyonder.co.uk
Sun Jan 9 08:11:19 PST 2005

MyParser.g:11: warning:nondeterminism upon
MyParser.g:11:     k==1:"public","private",VAR_TYPE
MyParser.g:11:     between alt 1 and exit branch of block

script        :    class_dec (globalvar_dec)* (function_dec)*;

class_dec    :    TOK_class IDENT (TOK_extends IDENT)? SEMI;

globalvar_dec    :    (TOK_private | TOK_public)? VAR_TYPE IDENT (ASSIGN 

function_dec    :    (TOK_private | TOK_public)? VAR_TYPE IDENT LPAREN 
(param_dec_list)? RPAREN SEMI;
param_dec_list    :    param_dec (COMMA param_dec)*;
param_dec    :    VAR_TYPE IDENT (ASSIGN (STR_LIT | INT_LIT))?;

with this say i have

class Moo;

public int MyFunc();

it thinks its a globalvar_dec, and says "unexpected token '('".

as i'm very new to antlr i'm not sure how i can fix it



(I'm sure you'll be getting alot more posts like this one :x)

More information about the antlr-interest mailing list