Files
lux/flake.nix
Brandon Lucas d8e01fd174 feat: implement Cranelift JIT compiler for native code execution
Add a JIT compiler using Cranelift that compiles Lux functions to native
machine code. Achieves ~160x speedup over the tree-walking interpreter
(fib(30): 11.59ms JIT vs 1.87s interpreter).

Supports: arithmetic, comparisons, conditionals, let bindings, function
calls, and recursion. Compile time overhead is minimal (~500µs).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 17:11:19 -05:00

61 lines
1.9 KiB
Nix

{
description = "Lux - A functional programming language with first-class effects";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, rust-overlay, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" "rust-analyzer" ];
};
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
rustToolchain
cargo-watch
cargo-edit
pkg-config
openssl
];
RUST_BACKTRACE = "1";
RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library";
shellHook = ''
printf "\n"
printf " \033[1;35m \033[0m\n"
printf " \033[1;35m \033[0m\n"
printf " \033[1;35m \033[0m v0.1.0\n"
printf "\n"
printf " Functional language with first-class effects\n"
printf "\n"
printf " \033[1mCommands:\033[0m\n"
printf " cargo build Build the compiler\n"
printf " cargo run Start the REPL\n"
printf " cargo test Run tests\n"
printf " cargo run -- \033[3m<file.lux>\033[0m Run a file\n"
printf "\n"
'';
};
packages.default = pkgs.rustPlatform.buildRustPackage {
pname = "lux";
version = "0.1.0";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = [ pkgs.openssl ];
};
}
);
}