jac-native

Compiles Jac code to native machine code via LLVM for standalone binaries and hot loops.

Updated Jul 26, 2026
One-click install
npx skills add https://github.com/PMN123/trapdoor --skill jac-native-pmn123
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jac-native
Source: https://github.com/PMN123/trapdoor/tree/main/.agents/skills/jac-native
Command: npx skills add https://github.com/PMN123/trapdoor --skill jac-native-pmn123

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Python-interpreted Jac code can be too slow for compute-heavy loops, and distributing tools that require a Python runtime adds deployment friction. This Skill explains how to compile Jac through LLVM into machine code, producing zero-dependency standalone binaries and native hot paths without an external compiler or linker. ## Core Features & Use Cases - Standalone binaries: Use jac nacompile app.jac -o app to build zero-dependency executables with cross-target support for wasm32, Windows, and macOS. - Automatic native promotion: Run jac run --autonative to execute native-compatible code on the LLVM backend with silent Python fallback for unsupported features like walkers or async. - C FFI interop: Declare C-ABI functions and by-value structs in import from blocks to call precompiled libraries such as raylib, with sibling-library resolution via $ORIGIN RUNPATH. - Use Case: A developer has a Jac CLI tool with a hot summation loop. They pin the compute function native, run jac nacompile tool.jac -o tool, and ship the binary alongside its shared library with no Python install required. ## Quick Start Compile my Jac file into a standalone native binary and show me how to call a C library from it.

Frequently Asked Questions about jac-native

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I compile a Jac file into a standalone binary?

Run jac nacompile app.jac -o app to produce a zero-dependency native binary. The file must contain a with entry block as its entry point, and you can cross-target other platforms with --target wasm32, windows, or macos.

How do I call a C library from Jac native code?

Declare the C functions inside an import from block with fixed-width types like i32 or f32, matching the C ABI. The compiler records the library as a DT_NEEDED entry with $ORIGIN RUNPATH, so placing the .so next to the binary lets the OS loader resolve it at runtime.

What Jac features are not supported in native compilation?

Walkers, nodes, edges, async, generators, decorators, multiple inheritance, by llm(), and PyPI imports all fail at compile time. Unsupported imports produce explicit errors rather than silently generating broken binaries.

Why does string membership testing fail in Jac native code?

The in operator on list[str] uses pointer comparison and always returns False, even for identical literals. Loop through the list and compare elements with == instead; in works correctly for list[int] and substring checks.

Can I mix Python and native code in one Jac file?

Yes, native sections can live inside a regular .jac file with automatic bidirectional bridging for primitives, collections, and objects. Define Python functions before the native section that calls them, since each codespace only sees its own definitions at compile time.