I'm trying to built C-- compiler using ANTLR 3.4.
For the grammar for a function I wrote
fundeclaration : typespecifier ID OPENP params CLOSEP compoundstmt ;
typespecifier : INT | VOID ;
params : VOID | paramlist ;
paramlist : param (COMMA param)* ;
param : /*typespecifier*/INT ID (OPENSQ CLOSESQ)? ;
compoundstmt : OPENCUR vardeclaration* statement* CLOSECUR ;
But using two Kleene star operations gives me error:
warning(200): /CMinusMinus/src/CMinusMinus/CMinusMinus.g:24:40:
Decision can match input such as "CLOSECUR" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
|---> compoundstmt : OPENCUR vardeclaration* statement* CLOSECUR ;
error(201): /CMinusMinus/src/CMinusMinus/CMinusMinus.g:24:40: The following alternatives can never be matched: 2
|---> compoundstmt : OPENCUR vardeclaration* statement* CLOSECUR ;