.\"Made with Love .TH M2-Planet 1 "JULY 2019" Linux "User Manuals" .SH NAME M2-Planet \- The PLAtform NEutral Transpiler (Or just terrible C compiler) .SH SYNOPSIS .na M2-Planet --architecture ARCHITECTURE --file FILE [--output FILE] [--debug] .SH DESCRIPTION M2 is the most minimal C compiler that can be bootstrapped from Hex .br 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) .br 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 .br The supported ARCHITECTURES are as follows: knight-native, knight-posix, x86, amd64, armv7l. (with planned ports to aarch64, z80 and 6502 planned) If you fail to specify an architecture, the default of knight-native will be used. .br 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_knight/functions/ with the default libc implementations and elf-headers in the parent directories correspondingly. .br .SH EXAMPLES Typically, M2-Planet will be called in scripts used in bootstrapping .br # M2-Planet --architecture x86 -f return.c -o return.M1 .br 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. .br # 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 .br .SH COMPATIBILITY M2-Planet is compatible with all Turing complete machines; even the ones that try to be Turing complete -1 .SH AUTHORS Jeremiah Orians .br Jan (janneke) Nieuwenhuizen .SH COPYRIGHT Copyright 2016-2019 Jeremiah Orians .br Copyright 2017 Jan Nieuwenhuizen .br License GPLv3+. .SH "SEE ALSO" M1(1), hex2(1), blood-elf(1), kaem(1), syscalls(2)