6.20.2011

Offline repost #4: Evaluation

I became bored when always pushing stack data back and forth (also, it's quite hot in here for such stuff) and somehow decided to tinker with the preprocessor again. The macros I once wrote for functional proprocessor programming came back to my mind and restarted the whole thing. This time, I understand the possibilities a bit better and think that I found a practical way how to introduce a bit of flow control-based programming. In theory, you'll need to put everything flow break (if, loop, while, break etc...) in an own macro to the commands be evaluated from top to bottom. The only way to get variables is to pass parameters. Therefore, every line requiring variables or parameters will also need macro parameters - one for each variable. To call this function-like block, just call the first macro/line (should also get named properly). Recursion of even calls nested inside other calls will still not work without duplicating it. Whatever. I think it's ok for basic functionality you can use to generate code. Somehow unbelievable that it's able to program numerical definitions using the preprocessor. To create a complex language, it requires a more primitive one - basic rule seen everywhere in computer science.

No comments: