Core S2 Software Solutions

A Macro Language

Older article from Lost in Dev; originally written by Jeremy Bridon.

I wrote up this little concept-code tonight since I was thinking about it earlier. It is a C++ macro language, meaning the language itself consists of all preprocessor macro functions/operators and are parsed into C++ and eventually compiled. Completely pointless, but it’s neat to abuse the language like this. Apart from being fun to program these kind of ideas, they help quite a bit to build up your comfort level with a language.

The macro language is more similar to a linear programming language rather than a imperative-based C-like language. Here is an example of code that creates the variable SampleVar, iterates ten times incrementing that variable (from 0 to 9), and prints it out:

#include "language.h"
	FOR(SampleVar, 10)

Get the header file with the language√ā¬†definition here. Remember, this is a very simple proof-of-concept file.

This entry was posted in News & Updates. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


Sites map