Compiler options for a DSL

28 views
Skip to first unread message

Dmitry Pavlov

unread,
May 30, 2019, 6:50:30 AM5/30/19
to Racket Users
Hello,

Racket is a perfect tool for creating new languages and compilers
for them, everybody knows that.

There is one thing, though, generally available in compilers and
not instantly available in Racket DSL tools (or I just missed it).

How to specify options to the compiler?

Consider a source file `prog.mylang`, a `mylang/lang/reader.rkt`
properly set up, `racket prog.mylang` and `raco make prog.mylang`
working as expected.

Now, suppose I want to pass a specific option to the mylang
implementation when I compile `prog.mylang`, but not as a part
of the program source code or compiler source code.
For instance, "emit logging commands",
or "set external constant N = 100",
or "generate C instead of Racket syntax objects".

How would you recommend I do that?
(Preferably in both DrRacket and command line, but at this
point I will be happy enough with just command line.)


Best regards,

Dmitry
Reply all
Reply to author
Forward
0 new messages