Concrete syntax ambiguity crashing JSGLR
With ambiguity in parsing concrete syntax, JSGLR gives up and crashes.
Given the following example:module mix[E] exports context-free syntax "T" "|[" Term "]|" -> E {cons("ToMetaExpr")} variables "x" [0-9]* -> Term {prefer}
And the following constructor for terms:
Term.Apply = <<Term> <Term>> {left, prefer} Term.Arrow = [[Term] -> [Term]] {right}
Writing the following anywhere in an str file with the mixed stratego + above mentioned language crashes JSGLR:
example: (x0, x1) -> T|[x0 -> x1]|
Oddly enough, it parses as meta variable
x
being applied to0
. If we wroteT|[x0]|
the error becomes thatx
is not defined although it does not crash JSGLR completely.The solution is to use lexical syntax and lexical restrictions in the first file defining the module
Submitted by Augusto on 14 May 2014 at 10:48mix
. It’s probably the right way of doing it anyways, but we shouldn’t crash this badly anyways.
Attachments
Log in to post comments