Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

foonathan/clauf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clauf

Build Status

clauf is a work-in-progress C interpreter that is developed live on YouTube: https://www.youtube.com/playlist?list=PLbxut1xyrkCZ-9d_03G0KBU4uh782J1eN

Goals and limitations

  • Support an interesting subset of C23, until we get bored.

  • Don’t become a production ready C interpreter.

  • Don’t invest a lot of time in generating good error messages; only test happy path.

  • Don’t try and implement an existing C ABI.

  • Do not implement the C preprocessor (for now).

  • Try to turn as much undefined behavior into runtime panics as possible (integer overflow, invalid pointers, …​).

FAQ

Why is it called clauf?

It uses lauf, a bytecode interpreter I’m working on as its backend.

Why?

Two reasons: I wanted to try out livecoding and I needed something to see how usable lauf is.

Why C?

Short answer: It won the twitter poll.

Long answer: C is a relatively small language that I am familiar with. It can be compiled in a single pass, does not require implementation of fancy type inference algorithms, and is low-level enough to really stress lauf’s sandboxing abilities.

What external libraries are you using?
  • lexy: for parsing

  • lauf: as the backend

  • dryad: data structure utilities

  • CLI11: command-line argument parsing

Program architecture

TODO, actually implement something first ;)