[antlr-interest] I get stuked; I don't know what to try. Fwd: Antlr Behavior! Why notifying sintactic errors in My tree gramar.
Marwan Ajraoui
marwan.alephn at gmail.com
Fri Aug 14 04:35:28 PDT 2009
---------- Forwarded message ----------
From: Marwan Ajraoui <marwan.alephn at gmail.com>
Date: 2009/8/14
Subject: Antlr Behavior! Why notifying sintactic errors in My tree
gramar where I'm cheking for Semantic errors ONLY.
To: antlr-interest at antlr.org
Hi comunity;
When I'm runing the tree grammar I defined I'm getting errors like
Error: mismatched input '[]' expecting FN_ID
So the it seems that it doesn't recognize ([])*. I 've already checked
the entry sintactically, so why antlr get confused?
What could be the problem, here is a part of my tree gramar:
type_return: 'void' | 'integer' ('[]')* | 'float'('[]')* |
'double'('[]')* | 'char'('[]')* | 'string'('[]')* | 'boolean'('[]')*;
decl_funcion
scope {
String ambito;
}
: ^(DECL_FUN type_return FN_ID LISTA_PARAMS lista_instrucciones (t2=inst_return{
if(!types_checker.areTypesEqual($type_return.text,$t2.type))
emitErrorMessage("Funcion '"+ $FN_ID.text + "' en la linea
" + $FN_ID.line +" : " + " devuelve un tipo de dato incoherente con
el definido.");
})?{if($type_return.text.equals("void") && ($t2.type!= null || $t2.type!=""))
emitErrorMessage("Funcion '"+ $FN_ID.text + "' en
la linea " +
$FN_ID.line +" : " + " devuelve void, no hay que devolver nada ó
cambia su tipo de retorno.");
$decl_funcion::ambito = $FN_ID.text;
}
);
Thx in advance for any help;
--
Marouane
--
Marouane
--
Marouane
More information about the antlr-interest
mailing list