MNCC is a small C-to-assembly transpiler prototype.
Current behavior is:
- Read one C source file.
- Lex it into tokens.
- Parse top-level functions into an AST.
- Generate NASM x86-64 assembly into
.github/a.asm. - Execute
assemble.sh, which runs NASM + LD to produce.github/a.out.
- Single-file frontend + codegen prototype.
- Targets Linux x86-64 (uses
_start+syscallexit sequence). - Produces and assembles a fixed output path (
.github/a.asm,.github/a.out). - Supports only a narrow subset of C-like syntax.
- Function definitions returning
int - Function parameters typed as
int(parsed as declarations) - Assignments with arithmetic expressions:
+,-,*,/ - Function call expressions in assignments/returns
return;andreturn <expr>;
Example that works with current pipeline:
int add(int a, int b)
{
return a + b;
}
int main()
{
return add(15, 8);
}- CLI takes exactly one argument:
./mncc <path> - Output filename cannot be configured from CLI
- No control-flow parsing (
if,else,while,for) - No comparisons/logical operators
- No unary minus expression handling
- No parenthesized expression handling
- Declaration without initializer (example:
int x;) is not accepted by parser - Standalone call statement (example:
foo();) is parsed but not generated - Parser/codegen failures are printed, but the process currently may still exit with
0due to missing error propagation inmain.c
0: SUCCESS84: ERROR100: ELEX101: EPAR102: EINP103: EGEN
Note: these codes are used internally by modules, but the top-level executable currently does not always propagate parse/codegen failures to its final exit code.