Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Self-hosting (chibicc-uxn compiling itself) #28

@lynn

Description

@lynn

There are really two steps here:

  1. Get the project to a point where chibicc-uxn.exe (running in Windows/Linux/etc) can compile the codebase to cc.rom, and this cc.rom can compile something FizzBuzz-sized.
  2. Get the project to a point where even this cc.rom (running in Uxn) can compile the whole codebase, and reproduce itself.

The biggest limitation is uxn's limited memory. Right now, chibicc-uxn allocates more than 64kB of memory to compile any non-trivial program. So the former sounds difficult enough, and the latter feels a bit like a pipe dream.

Here's the work that needs to be done:

  • Implement more standard library functions, like calloc and strtol and sprintf. A few of these are in lib/ already.
  • Remove stuff we don't support from the chibicc source code (like long).
  • Right now we rely on an external preprocessor. But such a thing doesn't exist in Uxn-land, so it's probably a bit more meaningful if we at least implement #include and #define. It could be a separate program.
  • Severely reduce the memory usage somehow, or find a clever way to manage memory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions