Using token "[]" causes Internal parsing error. (1)
In my example program I get the following error on line 1:
Internal parsing error: java.lang.ClassCastException: aterm.pure.ATermListImpl cannot be cast to
aterm.ATermAppl (recovery failed)Example program:
class Factorial {
public static void main(String[] a) {
System.out.println(new Fac().ComputeFac(10));
}
}SDF is based on MiniJava grammar.
Submitted by Tim on 6 September 2010 at 17:04
Issue Log
Tracked the problem down to a rule with the pattern “[]”, similar too:
“String” “[]” -> StrArr {cons(“StrArr”)}
Interesting problem. Which version are you using? And could you post a stack trace for the error? (menu Window > Show View > Error log.)
Version info:
Spoofax/IMP 0.5.2.93 org.strategoxt.imp.feature.groupStack trace:
java.lang.ClassCastException: aterm.pure.ATermListImpl cannot be cast to aterm.ATermAppl
at org.spoofax.jsglr.Term.applAt(Term.java:54)
at org.strategoxt.imp.runtime.parser.ast.AsfixAnalyzer.isLayout(AsfixAnalyzer.java:42)
at org.strategoxt.imp.runtime.parser.tokens.TokenKindManager.getTokenKind(TokenKindManager.java:35)
at org.strategoxt.imp.runtime.parser.ast.AsfixImploder.createStringTerminal(AsfixImploder.java:218)
at org.strategoxt.imp.runtime.parser.ast.AsfixImploder.implodeAppl(AsfixImploder.java:175)
at org.strategoxt.imp.runtime.parser.ast.AsfixImploder.implodeAppl(AsfixImploder.java:169)
at org.strategoxt.imp.runtime.parser.ast.AsfixImploder.implodeAppl(AsfixImploder.java:169)
at org.strategoxt.imp.runtime.parser.ast.AsfixImploder.implodeAppl(AsfixImploder.java:169)
at org.strategoxt.imp.runtime.parser.ast.AsfixImploder.implodeAppl(AsfixImploder.java:169)
at org.strategoxt.imp.runtime.parser.ast.AsfixImploder.implodeAppl(AsfixImploder.java:169)
at org.strategoxt.imp.runtime.parser.ast.AsfixImploder.implode(AsfixImploder.java:107)
at org.strategoxt.imp.runtime.parser.AbstractSGLRI.internalImplode(AbstractSGLRI.java:159)
at org.strategoxt.imp.runtime.parser.SGLRParseController.parse(SGLRParseController.java:287)
at org.strategoxt.imp.runtime.parser.SGLRParseController.parse(SGLRParseController.java:1)
at org.strategoxt.imp.runtime.dynamicloading.DynamicParseController.parse(DynamicParseController.java:163)
at org.eclipse.imp.editor.ParserScheduler.run(ParserScheduler.java:86)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Fixed in
r21226
(scheduled to be included in 0.5.3.4).
I believe this issue may need to be reopened. I’m having the same problem with Spoofax 6.0.2 on Eclipse32 3.6.1.
module Foo
imports Common
exports
context-free start-symbols
Start
context-free syntax
“foo” Hole -> Start {cons(“Start”)}
“[]” -> Hole {cons(“Hole”)}When I use this to try and parse “foo []”, it gives me an error “Internal parsing error: java.lang.ClassCastException: aterm.pure.ATermListImpl cannot be cast to aterm.ATermAppl (recovery failed)”
Let me know if any more information is needed.
I didn’t see a way to reopen this issue myself, so I hope this comment is seen.
eclipse.buildId=M20100909-0800
java.version=1.6.0_23
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments: -os win32 -ws win32 -arch x86Sorry, here is my stack trace:
Error
Sun Mar 13 15:35:00 CDT 2011
Internal parsing error: aterm.pure.ATermListImpl cannot be cast to aterm.ATermAppljava.lang.ClassCastException: aterm.pure.ATermListImpl cannot be cast to aterm.ATermAppl
at org.spoofax.jsglr.Term.applAt(Term.java:54)
at org.strategoxt.imp.runtime.parser.tokens.TokenKindManager.isOperator(TokenKindManager.java:57)
at org.strategoxt.imp.runtime.parser.tokens.TokenKindManager.getTokenKind(TokenKindManager.java:47)
at org.strategoxt.imp.runtime.parser.ast.AsfixImploder.createStringTerminal(AsfixImploder.java:218)
at org.strategoxt.imp.runtime.parser.ast.AsfixImploder.implodeAppl(AsfixImploder.java:175)
at org.strategoxt.imp.runtime.parser.ast.AsfixImploder.implodeAppl(AsfixImploder.java:169)
at org.strategoxt.imp.runtime.parser.ast.AsfixImploder.implodeAppl(AsfixImploder.java:169)
at org.strategoxt.imp.runtime.parser.ast.AsfixImploder.implodeAppl(AsfixImploder.java:169)
at org.strategoxt.imp.runtime.parser.ast.AsfixImploder.implode(AsfixImploder.java:107)
at org.strategoxt.imp.runtime.parser.AbstractSGLRI.internalImplode(AbstractSGLRI.java:156)
at org.strategoxt.imp.runtime.parser.SGLRParseController.parse(SGLRParseController.java:288)
at org.strategoxt.imp.runtime.parser.SGLRParseController.parse(SGLRParseController.java:1)
at org.strategoxt.imp.runtime.dynamicloading.DynamicParseController.parse(DynamicParseController.java:166)
at org.eclipse.imp.editor.ParserScheduler.run(ParserScheduler.java:86)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Alright, this issue should be fixed in the upcoming
0.6.1
or0.7.0
release, which replaces theaterm.pure
library. For now I would suggest a workaround, using a production like:
“[" "]” -> Hole {cons(“Hole”)}(which means that whitespace would be allowed between
[
and]
)
Log in to post comments