r/Compilers • u/ToneEmergency6359 • 18d ago
Transpiler for simplified C++
Since a few years I am thinking about the creation of a "simpler" and more lightweight version of C++, which just gets rid of a few "annoyances" such as:
- header files
- declaration before usage
- template syntax
So the idea is to have a 99% syntax identical version of c++, which just allows to use definitions which are defined after in the same file/compilation unit, having module-import instead of header files etc.
My questions are:
is this is generally frowned upon? Does someone else find such a thing useful? Just stick with C++ basically, no need for a new language, but a small "transpiler-layer" which gets rid of some not-so-nice things in a language, which I am mostly totally fine with!
I believe this is much smaller in scope and complexity than writing a compiler from scratch - or am I overlooking a few traps and rabbitholes which I might fall into? Underestimating the effort still :) ?
Thank you!
View all comments
Show parent comment
1
u/ToneEmergency6359 18d ago
I am doing that already , since ever, using what I think is a very reduced set of features!
The "real" goal here is probably less ambitious than some might think:
Being able to still use C++ (in like being 99.9% the same syntax), but literally being able to a) type less (see syntax above... might seem stupid and "what is the big difference?", but I think it matters.. to me ...)
b) use before declare (kind of a bigger one; mostly as I tend to have often procedural style and not always even using classes exclusively)
c) not being forced to use headers when I still want to have modularity through separate files and not being forced to use "extern".
I am also totally happy to learn about things I may not be aware of that bring me closer to this without writing a transpiler script. But it was the only way I saw.