compilium
compilium copied to clipboard
C compiler + hikalium
``` $ ./compilium int main() { int a = 1; return a + 2; } Preprocess begin Parse begin [ FuncDef : function{ [ (op= R=(op= R=(op=))), (op= R=(op= L=(op=)...
``` $ echo 'int i = 0;' | ../compilium Preprocess begin Parse begin [ (op= R=(op= R=(op=))) ] Analyze begin `i` has a type: int Gvar: i: int Error: Assertion...
- [x] `#define` (simple replace) - [x] `#define` (function-like) - [x] `#ifdef` `#endif` - [x] `#else` - [x] `#` on function-like macro expansion - [ ] `-D` compiler args
- [ ] enum type (treat as int) - [ ] define & use enum constant
- [x] Parse `const` type qualifier - [ ] Check `const` in type checking
- [x] *= - [x] /= - [x] %= - [x] += - [x] -= - [x] = - [ ] &= - [ ] ^= - [ ] |=
detect error like this: ``` void func_returns_void () { return 1; // void function should not return int value } ```