/stackless-c

A compiler for a stackless dialect of C

Primary LanguageCMIT LicenseMIT

Stackless C

This is a fork of Hsiang-Ying Fu's slimcc. Many thanks to slimcc and its ancestors (chibicc and 8cc).

The keyword 'goto' is available as a function specifier to declare stackless functions. Stackless functions do not allocate any memory (on the stack or heap) when they are invoked.

Restrictions on stackless functions:

  • the function 'main' cannot be a stackless function
  • stackless functions cannot be recursive or mutually recursive
  • stackless functions cannot be variadic

Motivation

Instructions

make builds the compiler. make test runs the test suite.

Platform support

Should just work on recent (2.28+) glibc-based x86-64 Linux. Musl support is almost there.

Known issues

  • libtool doesn't generate the nessasary -Wl, -fPIC option, if you see -soname and PIC linker errors, try filling *_wl= *_pic= in configure scripts with *_wl='-Wl,' *_pic='-fPIC'