You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the parsing of a-or-b-expr seems to commit to the a-expr and not backtrack and try b-expr once a-expr fails. this naturally comes up when you want to do something like defn-or-expr in a block dsl. for the stlc dsl, I had to inline defns into defn-or-expr to get around this
The text was updated successfully, but these errors were encountered:
Yeah this is maybe more of a misfeature than a bug. It’s the result of straightforwardly compiling nonterminals to syntax-parse. Getting the behavior you want would require backtracking across nonterminals, which would bring up issues of backtracking through macro expansions when the nonterminals allow extension. And also possibly backtracking across binding, if an unbound reference could trigger backtracking. There’s probably a safe subset but we’d need to think hard and maybe implement a static check to recognize it. Would definitely be nice to do eventually, but for now understand matching a production as committed choice before examining subexpressions or checking references are well bound.
example:
the parsing of
a-or-b-expr
seems to commit to thea-expr
and not backtrack and tryb-expr
oncea-expr
fails. this naturally comes up when you want to do something likedefn-or-expr
in ablock
dsl. for the stlc dsl, I had to inline defns into defn-or-expr to get around thisThe text was updated successfully, but these errors were encountered: