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

On 6 September 2010 at 17:15 Tim commented:

Tracked the problem down to a rule with the pattern “[]”, similar too:

“String” “[]” -> StrArr {cons(“StrArr”)}


On 6 September 2010 at 21:09 Lennart Kats commented:

Interesting problem. Which version are you using? And could you post a stack trace for the error? (menu Window > Show View > Error log.)


On 7 September 2010 at 13:37 Tim commented:

Version info:
Spoofax/IMP 0.5.2.93 org.strategoxt.imp.feature.group

Stack 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)


On 8 September 2010 at 12:35 Lennart Kats closed this issue.

On 8 September 2010 at 12:35 Lennart Kats commented:

Fixed in r21226 (scheduled to be included in 0.5.3.4).


On 13 March 2011 at 21:28 Chucky Ellison tagged !ellisonch

On 13 March 2011 at 21:37 Chucky Ellison commented:

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.


On 13 March 2011 at 21:38 Chucky Ellison commented:

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 x86

Sorry, 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.ATermAppl

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.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)


On 14 March 2011 at 10:22 Lennart Kats commented:

Alright, this issue should be fixed in the upcoming 0.6.1 or 0.7.0 release, which replaces the aterm.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