Created
September 23, 2018 18:06
-
-
Save death/4e273d14e671a3c64f3be10cab2aa1b2 to your computer and use it in GitHub Desktop.
Ad hoc C++ generation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CL-USER> (defmacro c++ (&rest args) | |
`(constantia:out | |
(:use smack/backend/c++-out:*c++-out-dispatch-table*) | |
(:to (make-instance 'constantia:indenting-stream :stream *standard-output*)) | |
,@args)) | |
C++ | |
CL-USER> (c++ (:include "iostream" :system) | |
(:fndef "main" () "int" | |
"std::cout << \"hi\";" (:%) | |
(:return 0))) | |
#include <iostream> | |
int main() | |
{ | |
std::cout << "hi"; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment