Elf is a small, bytecode-interpreted scripting language designed to complement C. It combines familiar control flow and zero-based indexing with table-centered data, closures, and a compact native embedding API.
Elf is currently 0.2.0-dev. The language is useful in my own projects, but its syntax,
API, and module model are still evolving. It should be treated as experimental rather
than production-ready.
numbers := {10, 20, 30}
make_adder := fun(base) {
ret fun(value) {
ret base + value
}
}
add_ten := make_adder(10)
for number := numbers[...] ? {
print(add_ten(number))
}
C remains the host language. Elf handles the parts of a native program that benefit from dynamic values and short iteration cycles: configuration, build descriptions, automation, strings, and nested data.
The project currently provides:
- a lexer and parser with source-located diagnostics;
- AST-to-IR lowering and a bytecode backend;
- a slot-based virtual machine with first-class functions and closures;
- one table representation for array, map, and record-like data;
- a stack-based C API for embedding and native functions; and
- optional filesystem, path, process, environment, serialization, random, and time libraries.
Bob uses Elf as its build-description language, and Orbiter uses Elf programs for its build and game-library configuration.
The supported build environment is Windows x64. You need:
- Git;
clang-cl; and- Microsoft's
lib.exelibrarian.
Clone the repository with its platform-layer submodule:
git clone --recursive https://github.com/MicroRJ/elf.git
cd elfIf the repository is already cloned, initialize the submodule with:
git submodule update --init --recursiveThe repository includes a Windows x64 Bob bootstrap executable, so Bob does not need to be installed separately.
build.bat build
build.bat testAdditional entries build the static libraries or run optimized benchmarks:
build.bat lib
build.bat benchmarkBuild products are written beneath build/. Passing no entry to build.bat uses Bob's
default entry.
include/— public C headerssrc/compiler/— lexer, parser, AST, IR, and bytecode generationsrc/core/— runtime values, tables, strings, VM, GC, and core librariessrc/batteries/— optional host-facing librariestest/— C unit tests and end-to-end Elf programstools/— runner, bytecode inspector, and benchmarks
Elf is available under the MIT License.