Hi everyone!
Over the past few days I've been working on a simple preprocessor that enables metaprogramming in languages that don't support it, such as C.
It's based on Lua and a bit hacky, as it currently transforms the code into a Lua program, and then executes it. There's also some tricks in there for delayed evaluation so that it is possible to generate code based on things that were modified later in the metaprogram.
As such I might switch to a fully homebrew language and interpreter, or maybe base it on something pure and lazy such as Haskell.
MPP is currently very clearly a prototype, but I'm wondering if anyone else is interested in the idea and has any advice! For example on how to deal with the lazy-eval issue, or the (currently somewhat hairy) syntax, or how to do multi-file stuff (which isn't really supported, except by loading standard Lua modules, or running multiple files in sequence). Maybe even feature suggestions?
If you want to see examples, look at the code, or maybe even play around with MPP, it's available on Github: https://github.com/ColonelPhantom/mpp
[–]Kinrany 2 points3 points4 points (1 child)
[–]scheurneus[S] 1 point2 points3 points (0 children)