Closed SquidDev closed 1 year ago
Just linking some of the comments in this post. Some potentially useful things we could try.
The alternative strategy here is to use TreeSitter, though this comes with the obvious problem of having to link native code (and breaking our JS integration).
I think this was mostly addressed by cd06555892d353f8dd6672c484d6455dac4c8ee5. There's always room for improvement here, but I think that's less well scoped.
Menhir offers a fantastic system for reporting errors and we make pretty good use of it. However, there's some cases where we could provide better error messages. For instances:
x =
in an expression context should suggest==
.do
in anif
block,then
in a loop.end
(or closing bracket).We might also be able to implement error recovery, but I think that'd be a little harder.
I think the "best" way to do this is as follows:
messages.txt
, and replace them with identifiers (for instanceUnknownAfterSimpleExpr
).messages.txt
gets compiled tomessages.ml.strings
.t
containing all these identifiers and a function to mapstate -> t
.t
and reports an error.It'd hardly elegant, and involves some wonderfully silly meta-programming, but it should work.