Smaller C

From OSDev.wiki
Revision as of 10:03, 12 June 2016 by osdev>Alexfru (Created page with "Smaller C is a simple and small single-pass C compiler, currently supporting most of the C language common between C89/ANSI C and C99 (minus some C89 and plus some C99 feature...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Smaller C is a simple and small single-pass C compiler, currently supporting most of the C language common between C89/ANSI C and C99 (minus some C89 and plus some C99 features).

The compiler self-hosts on DOS, Windows and Linux, meaning it can compile under and for all three OSes and it may additionally be used to write bootloaders and other parts OS running in the real, virtual 8086 and 32-bit protected modes.

With some work you may even be able to run Smaller C in your OS (e.g. you need to port NASM/YASM or FASM (FASM is probably easier) to your OS and make appropriate changes in the Smaller C standard library to use your OS system calls instead of those for DOS, Windows and Linux).

The core compiler comes with a linker and a compiler driver (the driver invokes the core compiler, the assembler, and the linker and supports options similar to those of GCC). The linker can produce the following executable formats: COM, MZ, PE, ELF, A.out and flat executables. Btw, COM and MZ may be booted directly with BootProg.

There's no decent preprocessor in Smaller C as of now, but the compiler driver can invoke gcc (or gcc.exe) for preprocessing if instructed.

The standard C library is work-in-progress and it's close to completion.

Fun fact: Smaller C runs on RetroBSD on a MIPS microcontroller and fits into the 96KB of user memory.

See Also

External Links