/lice

a C99 compiler.

Primary LanguageCThe UnlicenseUnlicense

DOWNLOADED_FROM='http://gmqcc.qc.to/cgit/cgit.cgi/LICE.git/plain/'; DOWNLOAD_DATE='17-11-2014'; HOMEPAGE='http://gmqcc.qc.to/cgit/cgit.cgi/LICE.git/tree/README.md';

Epilogue

LICE is a work in progress C99 compiler designed as a solution for teaching myself and others about the internals of the C programming language, how to write a compiler for it, and code generation.

Part of the philosophy behind LICE is to provide a public domain implementation of a working conformant C99 compiler. As well as borrowing extensions and ideas from existing compilers to ensure a wider range of support.

Status

See the STANDARDS file for the status on which standards LICE supports.

Prologue

If you don't find yourself needing any of the stuff which is marked as being unsupported above then you may find that LICE will happily compile your source into x86-64 assembly. The code generation is close from optimal. LICE treats the entire system as a giant stack machine, since it's easier to generate code that way. The problem is it's hardly efficent. All local variables are assigned on the stack for operations. All operations operate from the stack and write back the result to the stack location that is the destination operand for that operation.

Porting

LICE should be farily straightforward to retarget for a specific architecture or ABI. Start by making a copy of arch_dummy.h, naming it arch_yourarch.h create an entry in lice.h for that header guarded by conditional include. Supply that as a default option in the Makefile, remove gen_amd64.c from the Makefile, add your own to it. Then write the code generator. Documentation may be found in gen.h.

Future Endeavors

  • Full C90 support

  • Full C99 support

  • Full C11 support

  • Preprocessor

  • Intermediate stage with optimizations (libfirm?)

  • Code generation (directly to elf/coff, et. all)

  • Support for x86, ARM, PPC

Sources

The following sources where used in the construction of LICE

Inspiration

The following projects were seen as inspiration in the construciton of LICE.