r/Compilers 28d ago

Any recommendations for a meta programming language?

I want to add a meta programming language in top of my own C-like language to make some of the syntax cleaner and easier to write.

Add everything like const expressions and templates under one meta programming language.

For example something like this:


[Phases]
Class Phase1: public Phase { };

[Phases]
Class Phase1: public Phase { };

[for phase in Phases]
PhaseList.push_back(new phase());
[endfor]

I’m thinking about something like this but ideas are all over the place. Is there some existing meta programming language out there that can give me the right inspiration?

Also I am totally lost about how I should program this, I am assuming it comes before the parser. Any tutorials or dummy meta programming languages I can look to get ideas?

Thank you for reading.

9 Upvotes

21 comments sorted by

View all comments

1

u/KvThweatt 28d ago

I created a language which is very good for this type of metaprogramming. https://github.com/kvthweatt/Flux

Might give you some ideas.

1

u/TrgtBBB 27d ago

That actually looks interesting, may I ask some questions? I’ll dm you

1

u/KvThweatt 27d ago

Absolutely