Konrad,
Is it compile-time or run-time errors?
Assuming compile-time, I would suggest an approach I took for a non-SEXP
language: call raise-syntax-error in the (custom) compiler, which runs
after parser and transforms syntax objects to other syntax objects. The
third argument of raise-syntax-error can be a syntax object causing the
error -- which allows to refer to the original source in a nice and
natural way.
Best regards,
Dmitry
On 10/24/2016 04:25 PM, Konrad Hinsen wrote:
Hi everyone,
I am working on a DSL embedded in Racket (for the curious, it's on
GitHub: https://github.com/khinsen/leibniz) and as I am starting to
use my DSL in practice, I wish my implementation had better error
reporting.
My DSL consists of a bunch of syntax transformers that expand to
Racket code that constructs some complex data structure. The errors I
care about are not syntax errors, but inconsistencies detected during
the construction of the data structures. I would like those error
messages to refer to the source of the input language, rather than to
the code of the DSL implementation, which a DSL user shouldn't have to
know about.
I can think of a few approaches, such as redefining
error-display-handler in the expanded code, but I suspect that others
have already found better solutions to this problem. I'd be grateful
for any pointers.
Konrad.
--
You received this message because you are subscribed to the Google Groups "Racket
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.