[antlr-interest] cannot target C

Justin Murray jmurray at aerotech.com
Thu Sep 27 10:10:13 PDT 2012


Try a capital C

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of lin q
Sent: Thursday, September 27, 2012 12:40 PM
To: antlr-interest at antlr.org
Subject: [antlr-interest] cannot target C

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

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address


More information about the antlr-interest mailing list