M2-Planet(1)

NAME
M2-Planet - The PLAtform NEutral Transpiler (Or just terrible C compiler)

SYNOPSIS
M2-Planet --architecture ARCHITECTURE --file FILE [--output FILE] [--debug]

DESCRIPTION
M2 is the most minimal C compiler that can be bootstrapped from Hex
At it's core is the minimal subset of the C language required to make a more powerful C compiler. (with a few extras for convience)
Those core primitives being: if (with continue), while (with break), asm, structs (with -> support) gotos (with labels) and return. With do and for loops, arrays and function pointers as nice extras
The supported ARCHITECTURES are as follows: knight-native, knight-posix, x86, amd64, armv7l, aarch64. (with planned ports to z80 and 6502) If you fail to specify an architecture, the default of knight-native will be used.
As M2-Planet's libc is literally only a half-dozen lines of assembly you will likely need to import libc primitives when building or having previously built them seperately. You can find examples for such primitives in: test/common_x86/functions/ test/common_amd64/functions/ test/common_armv7l/functions/ test/common_aarch64/functions/ test/common_knight/functions/ with the default libc implementations and elf-headers in the parent directories correspondingly.

EXAMPLES
Typically, M2-Planet will be called in scripts used in bootstrapping
# M2-Planet --architecture x86 -f return.c -o return.M1
Then to convert the assembled output into a working binary, M1 and hex2 are used to convert the assembly output of M2-Planet; with blood-elf generating dwarf stubs if additional debug info is desired.
# M1 -f test/common_x86/x86_defs.M1 -f test/common_x86/libc-core.M1 -f return.M1 --LittleEndian --architecture x86 -o return.hex2 # hex2 -f test/common_x86/ELF-i386.hex2 -f return.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o example --exec_enable

COMPATIBILITY
M2-Planet is compatible with all Turing complete machines; even the ones that try to be Turing complete -1

AUTHORS
Jeremiah Orians <Jeremiah@pdp10.guru>
Jan (janneke) Nieuwenhuizen <janneke@gnu.org>

COPYRIGHT
Copyright 2016-2019 Jeremiah Orians <Jeremiah@pdp10.guru>
Copyright 2017 Jan Nieuwenhuizen <janneke@gnu.org>
License GPLv3+.

SEE ALSO
M1(1), hex2(1), blood-elf(1), kaem(1), syscalls(2)