I should mention that I am generating C code, not manually. I say this because it does not really matter if there is a lot of code behind it, because the compiler has to get around this. Anyway, how would I go around emulating lambda in C? I thought I could just generate a function with some random name somewhere in the source code, and then call? I'm not too sure. I have not tried anything yet, because I wanted to bring this idea to its implementation.
Is there some kind of preprocessor directive that I can do, or some kind of macro that this cleaner will do? I was inspired by John Beale to try compiler development, and he seemed to use Lambdas in his Jai language. However, I think it does something where it generates bytecode, and then in C? I'm not sure.
Edit: I am working on a compiler, the compiler is just my project so that I am busy and also want to know more about compilers. I mainly use clang, I'm on Ubuntu 14.10. I do not have a garbage collection, but I wanted to try my hand at some kind of smart memory model with a pointer -y / rust / ARC for garbage collection, i.e. Little overhead. I chose C because I wanted to pat it more. My project is free software, just a hobby project.
source
share