[antlr-interest] cannot target C

lin q linq936 at gmail.com
Thu Sep 27 09:39:37 PDT 2012


Hi,

I am new to antlr. I installed antlr v3.4 on my linux machine. I made
the following grammar file:



grammar binder;

/*
options
{
    language=c;
}
*/

/*-------------------------------------------------------------------------------------------
  parser rules
  -------------------------------------------------------------------------------------------*/
grp     :       common_param   EOF ;


common_param : (ID     VAL  New_Line*)* ;


/*-------------------------------------------------------------------------------------------
  lexer rules
  -------------------------------------------------------------------------------------------*/
ID : ('a'..'z' | 'A'..'Z') ('a'..'z' | 'A'..'Z' | '0'..'9' | '_')+ ;

VAL : '=' ('a'..'z' | 'A'..'Z' | '0'..'9' | '_' | '.' | ',')+ ;

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

New_Line : ('\r' | '\n')+   ;



You can see I comment out language target because if I uncomment it, I
get the following error:

error(10):  internal error: binder.g :
java.lang.IllegalArgumentException: No such group file:
org/antlr/codegen/templates/c/c.stg
org.stringtemplate.v4.STGroupFile.<init>(STGroupFile.java:69)
org.stringtemplate.v4.STGroupFile.<init>(STGroupFile.java:48)
org.antlr.codegen.CodeGenerator.loadTemplates(CodeGenerator.java:186)
org.antlr.codegen.CodeGenerator.genRecognizer(CodeGenerator.java:283)
org.antlr.Tool.generateRecognizer(Tool.java:655)
org.antlr.Tool.process(Tool.java:468)
org.antlr.Tool.main(Tool.java:93)


Do you see what could be wrong?

This is my setup and how I run the tool:

CLASSPATH=/vol/3/user/linq/public/antlr-3.4-complete.jar

java    org.antlr.Tool    binder.g


More information about the antlr-interest mailing list