[antlr-interest] Has anyone seen this kind of stack trace?
Alan D. Cabrera
list at toolazydogs.com
Wed Nov 30 17:31:41 PST 2011
I'm not so sure that this is the problem since all the tokens in the walker are in the parser/lexer.
Regards,
Alan
On Nov 30, 2011, at 5:15 PM, Jim Idle wrote:
> Ah, sorry, it is that import buig I reported to you 2 years ago ;-) When
> there is no definition of a token, but it is used in an import, then it is
> assigned a number that does not exist because it thinks it is coming from
> the options section, but then it all goes haywire. It needs to know where
> the tokens are coming from (roughly)
>
> Jim
>
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org
> [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Terence Parr
> Sent: Wednesday, November 30, 2011 3:37 AM
> To: Alan D. Cabrera
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Has anyone seen this kind of stack trace?
>
> interesting. i get:
>
> /tmp $ a3.4 LuaWalker.g
> error(10): internal error: 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:1792)
> org.antlr.grammar.v3.CodeGenTreeWalker.rule(CodeGenTreeWalker.java:1413)
> org.antlr.grammar.v3.CodeGenTreeWalker.rules(CodeGenTreeWalker.java:999)
> org.antlr.grammar.v3.CodeGenTreeWalker.grammarSpec(CodeGenTreeWalker.java:
> 910)
> org.antlr.grammar.v3.CodeGenTreeWalker.grammar_(CodeGenTreeWalker.java:490
> )
> org.antlr.codegen.CodeGenerator.genRecognizer(CodeGenerator.java:421)
> org.antlr.Tool.generateRecognizer(Tool.java:655)
> org.antlr.Tool.process(Tool.java:468)
> org.antlr.Tool.main(Tool.java:93)
>
> but had to take out import token vocab. can you send me that?
> Ter
> On Nov 29, 2011, at 5:26 AM, Alan D. Cabrera wrote:
>
>> 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.jav
>> a:645)
>> org.antlr.grammar.v3.CodeGenTreeWalker.block(CodeGenTreeWalker.java:28
>> 76)
>> org.antlr.grammar.v3.CodeGenTreeWalker.rule(CodeGenTreeWalker.java:238
>> 2)
>> org.antlr.grammar.v3.CodeGenTreeWalker.rules(CodeGenTreeWalker.java:15
>> 37)
>> org.antlr.grammar.v3.CodeGenTreeWalker.grammarSpec(CodeGenTreeWalker.j
>> ava: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(DefaultB
>> uildPluginManager.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.buildProjec
>> t(LifecycleModuleBuilder.java:84)
>> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProjec
>> t(LifecycleModuleBuilder.java:59)
>> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBui
>> ld(LifecycleStarter.java:183)
>> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycle
>> Starter.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.j
>> ava:39)
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
>> orImpl.java:25)
>> java.lang.reflect.Method.invoke(Method.java:597)
>> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launc
>> her.java:290)
>> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java
>> :230)
>> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Lau
>> ncher.java:409)
>> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:3
>> 52)
>>
>>
>> /**
>> * 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