[antlr-interest] Has anyone seen this kind of stack trace?

Alan D. Cabrera list at toolazydogs.com
Wed Nov 30 17:47:45 PST 2011


Yep.  Just replied to that one too.  All tokens are accounted for.  This is a different bug.  :)


Regards,
Alan

On Nov 30, 2011, at 5:31 PM, Jim Idle wrote:

> Yes - did you see my next email? You have a token that is being used but
> it does not have a lexer definition. When you use import, this is not
> detected. It is a bug but for some reason, it was not easy to fix and it
> has been left. So, it is being given the last token number plus one, but
> that does not exist and so it exceeds the bounds.
> 
> Jim
> 
> -----Original Message-----
> From: Alan D. Cabrera [mailto:list at toolazydogs.com]
> Sent: Thursday, December 01, 2011 9:25 AM
> To: Jim Idle
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Has anyone seen this kind of stack trace?
> 
> I am using maven and both *.g files get compiled by antlr:
> 
> [INFO]
> [INFO] --- antlr3-maven-plugin:3.3:antlr (default) @ lua4j --- [INFO]
> ANTLR: Processing source directory /Users/adc/dev/lua4j/src/main/antlr3
> ANTLR Parser Generator  Version 3.3 Nov 30, 2010 12:46:29
> com/toolazydogs/lua4j/Lua.g com/toolazydogs/lua4j/LuaWalker.g
> error(10):  internal error: com/toolazydogs/lua4j/LuaWalker.g :
> java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 64
> 
> 
> 
> Regards,
> Alan
> 
> On Nov 30, 2011, at 5:12 PM, Jim Idle wrote:
> 
>> Your tree, parser, lexer are out of sync and the token numbers have
>> therefore changed. Regen lexer, parser, then walker. If you use Maven
> then
>> this will be avoided.
>> 
>> Jim
>> 
>> 
>> -----Original Message-----
>> From: antlr-interest-bounces at antlr.org
>> [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Alan D. Cabrera
>> Sent: Tuesday, November 29, 2011 9:26 PM
>> To: antlr-interest at antlr.org
>> Subject: [antlr-interest] Has anyone seen this kind of stack trace?
>> 
>> I'm running ANTLR on my tree walker ANTLR file and get this error
> message
>> and don't understand what I'm doing wrong:
>> 
>> error(10):  internal error: com/toolazydogs/lua4j/LuaWalker.g :
>> java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 64
>> java.util.Vector.set(Vector.java:712)
>> org.antlr.analysis.DFA.createMinMaxTables(DFA.java:535)
>> org.antlr.analysis.DFA.createStateTables(DFA.java:439)
>> 
> org.antlr.codegen.CodeGenerator.genLookaheadDecision(CodeGenerator.java:64
>> 5)
>> 
> org.antlr.grammar.v3.CodeGenTreeWalker.block(CodeGenTreeWalker.java:2876)
>> org.antlr.grammar.v3.CodeGenTreeWalker.rule(CodeGenTreeWalker.java:2382)
>> 
> org.antlr.grammar.v3.CodeGenTreeWalker.rules(CodeGenTreeWalker.java:1537)
>> 
> org.antlr.grammar.v3.CodeGenTreeWalker.grammarSpec(CodeGenTreeWalker.java:
>> 1441)
>> 
> org.antlr.grammar.v3.CodeGenTreeWalker.grammar_(CodeGenTreeWalker.java:493
>> )
>> org.antlr.codegen.CodeGenerator.genRecognizer(CodeGenerator.java:421)
>> org.antlr.Tool.generateRecognizer(Tool.java:655)
>> org.antlr.Tool.process(Tool.java:468)
>> org.antlr.mojo.antlr3.Antlr3Mojo.execute(Antlr3Mojo.java:378)
>> 
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuild
>> PluginManager.java:101)
>> 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java
>> :209)
>> 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java
>> :153)
>> 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java
>> :145)
>> 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(Li
>> fecycleModuleBuilder.java:84)
>> 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(Li
>> fecycleModuleBuilder.java:59)
>> 
> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(L
>> ifecycleStarter.java:183)
>> 
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStar
>> ter.java:161)
>> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
>> org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
>> org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
>> org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
>> org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
>> 39)
>> 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
>> pl.java:25)
>> java.lang.reflect.Method.invoke(Method.java:597)
>> 
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.
>> java:290)
>> 
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230
>> )
>> 
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launche
>> r.java:409)
>> 
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
>> 
>> 
>> /**
>> * Copyright 2010-2011 (C) Alan D. Cabrera
>> *
>> * Licensed under the Apache License, Version 2.0 (the "License");
>> * you may not use this file except in compliance with the License.
>> * You may obtain a copy of the License at
>> *
>> *    http://www.apache.org/licenses/LICENSE-2.0
>> *
>> * Unless required by applicable law or agreed to in writing, software
>> * distributed under the License is distributed on an "AS IS" BASIS,
>> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
>> * See the License for the specific language governing permissions and
>> * limitations under the License.
>> */
>> tree grammar LuaWalker;
>> options
>> {
>>  tokenVocab=Lua;
>>  ASTLabelType=CommonTree;
>>  filter = true;
>> }
>> @header
>> {
>> package com.toolazydogs.lua4j;
>> import org.objectweb.asm.*;
>> import com.toolazydogs.lua4j.compiler.*; } @members {
>>  void print(String s) { System.out.print(s); }
>>  void println(String s) { System.out.println(s); } }
>> 
>> chunk
>>  : ^(CHUNK c=.)
>>  ;
>> 
>> stat
>>  : ^(ASSIGN varlist explist)
>>  | functioncall
>>  | chunk
>>  | ^(WHILE exp chunk)
>>  | ^(REPEAT chunk exp)
>>  | ^(IF exp chunk)
>>  | ^(IF exp chunk chunk)
>>  | ^(IF exp chunk elseif+ chunk?)
>>  | ^(FOR NAME exp exp exp chunk)
>>  | ^(FOR NAME exp exp chunk)
>>  | ^(FORIN namelist explist chunk)
>>  | ^(FUNCTION funcname funcbody)
>>  | ^(LOCAL namelist explist?)
>>  ;
>> 
>> elseif
>>  : ^(ELSEIF exp chunk)
>>  ;
>> 
>> laststat
>>  : RETURN
>>  | ^(RETURN explist)
>>  | BREAK
>>  ;
>> 
>> funcname
>>  : ^(FNAMETHIS NAME NAME+)
>>  | ^(FNAME NAME+)
>>  ;
>> 
>> varlist
>>  : ^(VARLIST var+)
>>  ;
>> 
>> var
>>  : ^(INDEX varPrefix exp)
>>  | ^(VAR NAME)
>>  ;
>> 
>> varPrefix
>>  : ^(FUNCALL vp=. nameAndArgs)
>>  | ^(SINGLE exp)
>>  | ^(VAR NAME)
>>  ;
>> 
>> prefixexp
>>  : ^(FUNCALL p=. nameAndArgs)
>>  | varOrExp
>>  ;
>> 
>> functioncall
>>  : ^(FUNCALL p=. nameAndArgs)
>>  ;
>> 
>> varOrExp
>>  : var
>>  | ^(SINGLE exp)
>>  ;
>> 
>> nameAndArgs
>>  : ^(ARGS args)
>>  | ^(ARGSWITHSELF NAME args)
>>  ;
>> 
>> args
>>  : EXPLIST
>>  | explist
>>  | tableconstructor
>>  | string
>>  ;
>> 
>> namelist
>>  : ^(NAMELIST NAME+)
>>  ;
>> 
>> explist
>>  : ^(EXPLIST exp+)
>>  ;
>> 
>> exp
>>  : ^('or' or or+)
>>  | or
>>  ;
>> 
>> or
>>  : ^('and' and and+)
>>  | and
>>  ;
>> 
>> and
>>  : ^('<' compare compare)
>>  | ^('<=' compare compare)
>>  | ^('>' compare compare)
>>  | ^('>=' compare compare)
>>  | ^('==' compare compare)
>>  | ^('~=' compare compare)
>>  | compare
>>  ;
>> 
>> compare
>>  : ^('..' concatenation concatenation+)
>>  | concatenation
>>  ;
>> 
>> concatenation
>>  : ^('+' add_sub add_sub)
>>  | ^('-' add_sub add_sub)
>>  | add_sub
>>  ;
>> 
>> add_sub
>>  : ^('*' b b)
>>  | ^('/' b b)
>>  | ^('%' b b)
>>  | b
>>  ;
>> 
>> b
>>  : ^(NEGATE unary)
>>  | unary
>>  ;
>> 
>> unary
>>  : ^('^' atom atom)
>>  | atom
>>  ;
>> 
>> atom    : 'nil'
>>      | 'false'
>>      | 'true'
>>      | number
>>      | string
>>      | ^(FUNCBODY parlist? chunk)
>>      | prefixexp
>>      | tableconstructor
>>      | '...'
>>   ;
>> 
>> funcbody
>>  : ^(FUNCBODY parlist? chunk)
>>  ;
>> 
>> parlist
>>  : ^(PARAMETERS namelist)
>>  | ^(PARAMETERS namelist '...')
>>  | ^(PARAMETERS '...')
>>  ;
>> 
>> tableconstructor
>>  : ^(TBLCTOR field+)
>>  | TBLCTOR
>>  ;
>> 
>> field
>>  : ^(TBLFIELD exp exp)
>>  | ^(TBLFIELD NAME exp)
>>  | ^(TBLFIELD exp)
>>  ;
>> 
>> number
>>  : INTEGER
>>  | FLOAT
>>  | EXPONENT
>>  | HEX
>>  ;
>> 
>> string
>>  : ^(STRING s=.)
>>  ;
>> 
>> 
>> 
>> 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
> 
> 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