4 ms·
I'm looking for language that can be described like "C with classes". Simplicity of C and some basic OOP features in one. Not Go and not C++. Simple low-level l
by dasannikov 11y ago
I'm looking for language that can be described like "C with classes". Simplicity of C and some basic OOP features in one. Not Go and not C++. Simple low-level language without garbage collector and with C libs support.
I've tried to imagine it as some kind of preprocessor with C files as output.
Fow example this:
struct Test {
int testFunc(int a) { return a * a; }
...
};
int main() {
Test t;
return t.testFunc(2);
}
Can be transformed to C code:
struct Test {
...
};
int Test_testFunc_int_int(Test * this, int a) {
return a * a;
}
int main() {
Test t;
return Test_testFunc_int_int(&t, 2);
}
Does anyone know language or meta-language (with output as C files) or some libs maybe similar to this?
- dragonwriter 11y agoIsn't that exactly how C++ started?
- dasannikov 11y agoMaybe, but nowadays we know that C++ have problems with simplicity.
- vmorgulis 11y agoYou can take a look at Cello but it's more script-like. http://libcello.org/ http://libcello.org/ As dragonwriter said, C++ begun as a preprocessor. The cfront sources are available here: http://www.softwarepreservation.org/projects/c_plus_plus/index.html#cfront http://www.softwarepreservation.org/projects/c_plus_plus/ind... About your language, it's possible to do your own by parsing the AST output of GCC with "-fdump-translation-unit". I think Uniform Call Syntax is planned for C++17 or maybe 20 (f(a,b)=a.f(b)).