Re: [racket-users] Error messages in DSL implementations

2016-10-25 Thread Matthias Felleisen
Konrad, you may wish to work with Stephen whose latest research project is about combining static checking with expansion so that you don’t separate those two steps. > On Oct 25, 2016, at 6:20 AM, Konrad Hinsen wrote: > > Thanks to Dmitry, Matthias, and Alexis for their comments, which we

Re: [racket-users] Error messages in DSL implementations

2016-10-25 Thread Konrad Hinsen
Thanks to Dmitry, Matthias, and Alexis for their comments, which were very helpful to understand the principles of error reporting in DSLs. My summary is (please correct me if I am wrong!): 1) If my DSL code expands to Racket code doing error checking/reporting at the top level, the syntax tra

Re: [racket-users] Error messages in DSL implementations

2016-10-24 Thread Alexis King
> On Oct 24, 2016, at 9:58 AM, Matthias Felleisen > wrote: > > This is an interesting class of errors. As Dimitry says, you might > be able to leave behind enough source code info when you generate > that code, so that it looks like > > (define foo (if (empty? blah) (error ‘source-name “got ‘(),

Re: [racket-users] Error messages in DSL implementations

2016-10-24 Thread Matthias Felleisen
> On Oct 24, 2016, at 11:00 AM, Konrad Hinsen > wrote: > > Hi Dmitry, > >> Is it compile-time or run-time errors? > > Mostly module-instantiation-time errors, which are closer to run-time errors. > > As a simple example, consider syntactically correct DSL code that expands to > > (define f

Re: [racket-users] Error messages in DSL implementations

2016-10-24 Thread Dmitry Pavlov
Is it compile-time or run-time errors? Mostly module-instantiation-time errors, which are closer to run-time errors. As a simple example, consider syntactically correct DSL code that expands to (define foo (first '())) The call to first raises an exception, which is displayed without

Re: [racket-users] Error messages in DSL implementations

2016-10-24 Thread Konrad Hinsen
Hi Dmitry, Is it compile-time or run-time errors? Mostly module-instantiation-time errors, which are closer to run-time errors. As a simple example, consider syntactically correct DSL code that expands to (define foo (first '())) The call to first raises an exception, which is displayed

Re: [racket-users] Error messages in DSL implementations

2016-10-24 Thread Dmitry Pavlov
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

[racket-users] Error messages in DSL implementations

2016-10-24 Thread Konrad Hinsen
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 Rac