Sorry to bother. I was having the same problem but I'm not quite getting what the fix is .Should the entire init stuff be commented out as in
; public Calc() { super(); } // calls java.lang.Object() ;.method public <init>()V ; aload_0 ; invokenonvirtual java/lang/Object/<init>()V ; return ;.end method or something else? Thanks for any help. >>>bill<<< On 12/29/10 7:04 AM, Hani Sayyid wrote: > I fixed the issue. I just had to remove the <init> attribute > from ByteCode.stg. In the PDF version of the book, it it is correct. But if > you download the code from this link: > http://media.pragprog.com/titles/tpantlr/code/templates/generator/2pass/ByteCode.stg > > or the zip/tar file on the book's website, 2 extra and useless <init> > attributes are included in the stg file. > > Regards. > ------- > > Hi, > > I'm trying to run the files in \templates\generator\2pass. I haven't changed > anything code related. I created a new project in Eclipse, added the files > in a new package, and compiled them. They compiled fine, but when I give > them any input like 2+4*3, they give the following error: > > Exception in thread "main" java.util.NoSuchElementException: no such > attribute: init in template context [jasminFile] > at > org.antlr.stringtemplate.StringTemplate.checkNullAttributeAgainstFormalArguments(StringTemplate.java:1311) > at > org.antlr.stringtemplate.StringTemplate.getAttribute(StringTemplate.java:684) > at > org.antlr.stringtemplate.language.ActionEvaluator.attribute(ActionEvaluator.java:360) > at > org.antlr.stringtemplate.language.ActionEvaluator.expr(ActionEvaluator.java:136) > at > org.antlr.stringtemplate.language.ActionEvaluator.action(ActionEvaluator.java:84) > at org.antlr.stringtemplate.language.ASTExpr.write(ASTExpr.java:149) > at org.antlr.stringtemplate.StringTemplate.write(StringTemplate.java:705) > at > org.antlr.stringtemplate.StringTemplate.toString(StringTemplate.java:1670) > at > org.antlr.stringtemplate.StringTemplate.toString(StringTemplate.java:1661) > at strt.Test.main(Test.java:37) > > Is there something missing in the code or I'm doing something wrong? > > Regards. > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to il-antlr-inter...@googlegroups.com. To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.