I get a FilterException error for this grammar:


module Test

exports
context-free start-symbols
Start

context-free syntax
Exp -> Start
Bool -> Exp
Exp “=” Exp -> Exp {right, cons(“Error”)}

VARID    -> Exp
VARID    -> Bool

lexical syntax
[A-Z]* -> VARID

lexical restrictions
VARID -/- [A-B]

The problem appears only when I have ambiguities and right associativity.

Submitted by Radu Mereuta on 26 July 2011 at 14:32

On 26 July 2011 at 16:55 Lennart Kats commented:

Do you have a stack trace for this problem?


On 26 July 2011 at 17:14 Radu Mereuta commented:
eclipse.buildId=M20110210-1200
java.version=1.6.0_24
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86_64


Error
Tue Jul 26 18:11:11 EEST 2011
Internal parsing error: Runtime exception when applying filters

org.spoofax.jsglr.client.FilterException: Runtime exception when applying filters
	at org.strategoxt.imp.runtime.parser.JSGLRI.doParse(JSGLRI.java:182)
	at org.strategoxt.imp.runtime.parser.AbstractSGLRI.parse(AbstractSGLRI.java:106)
	at org.strategoxt.imp.runtime.parser.SGLRParseController.doParse(SGLRParseController.java:352)
	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:168)
	at org.eclipse.imp.editor.ParserScheduler.run(ParserScheduler.java:86)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.spoofax.jsglr.client.FilterException: Runtime exception when applying filters
	at org.spoofax.jsglr.client.Disambiguator.applyFilters(Disambiguator.java:251)
	at org.spoofax.jsglr.client.SGLR.sglrParse(SGLR.java:318)
	at org.spoofax.jsglr.client.SGLR.parse(SGLR.java:265)
	at org.strategoxt.imp.runtime.parser.JSGLRI.doParse(JSGLRI.java:163)
	... 7 more
Caused by: java.lang.UnsupportedOperationException
	at org.spoofax.jsglr.client.ParseNode.getLabel(ParseNode.java:38)
	at org.spoofax.jsglr.client.Disambiguator.applyRightAssociativeFilter(Disambiguator.java:580)
	at org.spoofax.jsglr.client.Disambiguator.applyAssociativityPriorityFilter(Disambiguator.java:537)
	at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:456)
	at org.spoofax.jsglr.client.Disambiguator.filterAmbiguities(Disambiguator.java:820)
	at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:469)
	at org.spoofax.jsglr.client.Disambiguator.applyFilters(Disambiguator.java:245)
	... 10 more

Tried it with r23157

On 27 July 2011 at 15:51 Lennart Kats tagged parser

On 27 July 2011 at 15:51 Lennart Kats tagged disambiguator

On 27 July 2011 at 16:02 Lennart Kats closed this issue.

On 27 July 2011 at 16:02 Lennart Kats commented:

There seems to be a check for this case in the “left” associativity filter, I added one for the “right” one as well in r23162.


On 27 July 2011 at 16:02 Lennart Kats tagged @lennartkats

On 27 July 2011 at 20:22 Radu Mereuta commented:
Sorry, but no change. The problem is still there.
Try and see the grammar in my first comment, it triggers the bug.

On 27 July 2011 at 21:55 Lennart Kats reopened this issue.

On 27 July 2011 at 22:04 Lennart Kats commented:

Do you get the same stack trace?


On 27 July 2011 at 22:51 Radu Mereuta commented:
A bit different:

eclipse.buildId=M20110210-1200
java.version=1.6.0_24
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86_64


Error
Wed Jul 27 23:49:47 EEST 2011
Internal parsing error: Runtime exception when applying filters

org.spoofax.jsglr.client.FilterException: Runtime exception when applying filters
	at org.strategoxt.imp.runtime.parser.JSGLRI.doParse(JSGLRI.java:182)
	at org.strategoxt.imp.runtime.parser.AbstractSGLRI.parse(AbstractSGLRI.java:106)
	at org.strategoxt.imp.runtime.parser.SGLRParseController.doParse(SGLRParseController.java:352)
	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:169)
	at org.eclipse.imp.editor.ParserScheduler.run(ParserScheduler.java:86)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.spoofax.jsglr.client.FilterException: Runtime exception when applying filters
	at org.spoofax.jsglr.client.Disambiguator.applyFilters(Disambiguator.java:251)
	at org.spoofax.jsglr.client.SGLR.sglrParse(SGLR.java:318)
	at org.spoofax.jsglr.client.SGLR.parse(SGLR.java:265)
	at org.strategoxt.imp.runtime.parser.JSGLRI.doParse(JSGLRI.java:163)
	... 7 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 5
	at org.spoofax.jsglr.client.Disambiguator.applyRightAssociativeFilter(Disambiguator.java:589)
	at org.spoofax.jsglr.client.Disambiguator.applyAssociativityPriorityFilter(Disambiguator.java:537)
	at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:456)
	at org.spoofax.jsglr.client.Disambiguator.applyFilters(Disambiguator.java:245)
	... 10 more

On 4 December 2011 at 11:55 Radu Mereuta commented:
An update to this issue, I found a way to break the left filter as well. This example: "A+0", breaks for this grammar:
context-free start-symbols
    Start

context-free syntax
    Exp         -> Start
    VARID       -> Exp
    NAT       -> Exp
    INT       -> Exp

    Exp "+" Exp -> Exp {left, cons("Add")}

lexical syntax
    [A-Z]+  -> VARID
    [0-9]+  -> NAT
    "-"?[0-9]+ -> INT

lexical restrictions
    VARID -/- [A-B]

Sometimes it hangs, sometimes it reports an error similar to the above, and sometimes I get this erroneous AST: amb(["A", amb(["", ""])]).
If I switch left with right and try to parse "0+A" I get the same behaviors.

I'm not sure what happens, but I hope that you can fix it.

On 22 March 2012 at 14:43 Lennart Kats commented:

I think with the latest fix in r24658 this should be resolved: it no longer throws a FilterException or ArrayIndexOutOfBoundsException for your grammar. The result it returns for the grammar above is now: Add("A",amb(["0","0"])). (There’s still an ambiguity since it can be a NAT or an INT.) Let me know if there’s still more trouble.


On 22 March 2012 at 14:43 Lennart Kats closed this issue.

On 22 March 2012 at 14:43 Lennart Kats tagged 1.1

On 22 March 2012 at 17:31 Radu Mereuta commented:

Thanks Lennart. I’ve updated eclipse and it works. I’m getting the expected result. I still have a request though. Could you update strategoxt.jar also?
This is the tool we’ll be using in our release. Right now the versions that I could find are based on r24429.


On 23 March 2012 at 13:37 Lennart Kats commented:

Alright, the buildfarm now provides a new version :)

Log in to post comments