In the WebDSL syntax I have these productions:

"default" "=" Exp        -> Annotation {cons("DefaultAnno")}
Id "=" AnnoValue         -> Annotation {cons("SingleParamAnno"), avoid}

In the C-based SGLR default="1" is parsed as DefaultAnno, but in JSGLR it becomes SingleParamAnno (not even ambiguous).

Using prefer on the first and removing avoid gives the same result.

Submitted by Danny Groenewegen on 5 June 2010 at 13:39

On 5 June 2010 at 13:47 Lennart Kats commented:

Very strange, I thought I fixed all of these… The full grammar can be found at https://svn.strategoxt.org/repos/WebDSL/webdsls/trunk/src/org/webdsl/dsl/syntax@r3967.


On 10 November 2010 at 18:16 Lennart Kats commented:

Rob found that this also affects simple cases like the “dangling else” in Java:


echo ‘class X {{ if (e) if (e) s2; else s3; }}’ | sglri -p Java-15.tbl -s CompilationUnit | pp-aterm
CompilationUnit(
None()
, []
, [ ClassDec(
ClassDecHead([], Id(“X”), None(), None(), None())
, ClassBody(
[ InstanceInit(
Block(
[ If(
ExprName(Id(“e”))
, If(
ExprName(Id(“e”))
, ExprStm(ExprName(Id(“s2”)))
, ExprStm(ExprName(Id(“s3”)))
)
)
]
)
)
]
)
)
]
)

$ echo ‘class X {{ if (e) if (e) s2; else s3; }}’ | jsglri -p Java-15.tbl -s CompilationUnit -f | pp-aterm
CompilationUnit(
None()
, []
, [ ClassDec(
ClassDecHead([], Id(“X”), None(), None(), None())
, ClassBody(
[ InstanceInit(
Block(
[ If(
ExprName(Id(“e”))
, If(ExprName(Id(“e”)), ExprStm(ExprName(Id(“s2”))))
, ExprStm(ExprName(Id(“s3”)))
)
]
)
)
]
)
)
]
)

Now what’s really strange is that you also get this (wrong) result when you pass option -f to jsglr, disabling all post-parse filtering. So it must really be something in the parser that causes this.


On 27 November 2010 at 14:24 Lennart Kats commented:

Possible other instances of this bug: Spoofax/293, Spoofax/301, Spoofax/331.


On 29 January 2011 at 14:25 Lennart Kats tagged major

On 29 January 2011 at 15:04 Lennart Kats commented:

It really seems like the parser is just losing branches somehow. Is this something related to error recovery, which also eliminates spurious recovery branches?


On 29 January 2011 at 16:51 Lennart Kats commented:

I tried this again with the new-terms branch@r21757. Now I get the same results as with the C SGLR parser.


$ java -cp strategoxt.jar org.spoofax.jsglr.Main -p Java-15.tbl -i test.java -s CompilationUnit | implode-asfix | pp-aterm
CompilationUnit(
Some(PackageDec([], PackageName([Id(“x”)])))
, []
, [ ClassDec(
ClassDecHead([], Id(“X”), None(), None(), None())
, ClassBody(
[ InstanceInit(
Block(
[ If(
ExprName(Id(“e”))
, If(
ExprName(Id(“e”))
, ExprStm(ExprName(Id(“s2”)))
, ExprStm(ExprName(Id(“s3”)))
)
)
]
)
)
]
)
)
]
)

both interpretations show now with -f:


$ java -cp strategoxt.jar org.spoofax.jsglr.Main -p Java-15.tbl -i test.java -s CompilationUnit -f | implode-asfix | pp-aterm
CompilationUnit(
Some(PackageDec([], PackageName([Id(“x”)])))
, []
, [ ClassDec(
ClassDecHead([], Id(“X”), None(), None(), None())
, ClassBody(
[ InstanceInit(
Block(
[ amb(
If(
ExprName(Id(“e”))
, If(
ExprName(Id(“e”))
, ExprStm(ExprName(Id(“s2”)))
, ExprStm(ExprName(Id(“s3”)))
)
)
, If(
ExprName(Id(“e”))
, If(ExprName(Id(“e”)), ExprStm(ExprName(Id(“s2”))))
, ExprStm(ExprName(Id(“s3”)))
)
)
]
)
)
]
)
)
]
)

The trunk parser is still broken. So it seems the branch fixes this issue, somehow (Maartje, your doing?).


On 31 January 2011 at 12:40 Lennart Kats tagged pre-new-terms

On 14 February 2011 at 14:44 Lennart Kats tagged 1.0

On 14 February 2011 at 14:44 Lennart Kats commented:

Fixed in 0.6.1+.


On 14 February 2011 at 14:44 Lennart Kats closed this issue.

On 14 February 2011 at 14:45 Lennart Kats removed tag @lennartkats

Log in to post comments