Skip to content

foonathan/lauf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

58a09f4 · Jan 23, 2025
Dec 23, 2023
Feb 14, 2023
Apr 13, 2024
Apr 13, 2024
Apr 13, 2024
Feb 14, 2023
Jul 16, 2022
Jul 16, 2022
Jan 23, 2025
Jul 16, 2022
Sep 5, 2022
Jan 23, 2025

Repository files navigation

lauf

Project Status Build Status

lauf is work-in-progress bytecode interpreter with a C API. It is currently highly unstable, not ready for production use, and does not support anything other than a recent clang and Linux.

Features

  • Stack based bytecode API.

  • Designed to quickly generate bytecode and execute it; suitable for e.g. evaluating constexpr functions in a C++ compiler.

  • Extensible instruction set via lauf_builtin: things like add can be defined with your own semantics (e.g. overflow behavior).

  • Support for fibers: cooperative user threads to implement stackful coroutines and generators.

  • Fully sandboxed VM that supports low-level operations like pointer arithmetic.

FAQ

How fast is it?

On an M1 processor, recursive fib(35) takes about 325ms while the luajit interpreter (without JIT) takes about 535ms. Proper benchmarks are TODO.

Does it support just-in-time compilation?

Currently, no. I have started implementing it, but it’s a lot of work, and I’ll focus on adding features first.

Why is it called lauf?

"Lauf!" is German for "Run!" and lauf runs bytecode.

Documentation

Currently no documentation besides header comments. Everything should be considered unstable.