deliberately failing compilation when errors are in embedded DSL

Dmitri Makarov via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Feb 18 09:43:50 PST 2015


I'm developing an embedded DSL using CTFE. The DSL code is 
translated into D code and mixin-ed into the D code of user's 
application.  In order to provide meaningful error messages the 
DSL compiler always intercepts all errors in the DSL code and 
reports them at compile-time using pragma(msg, ...). The DSL 
compiler never generates incorrect D code to avoid reporting 
errors in the generated D code obscurely related to the original 
DSL code.  The problem is that the D compiler always exits as if 
the compilation was successful (for D compiler it is successful, 
since the generated D code is correct).

Is there any way to force the D compiler to fail compilation 
other than generating incorrect D code when translating erroneous 
DSL code?


More information about the Digitalmars-d-learn mailing list