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/nihalnihalani/jachacks-sf-2026 --skill jac-native-nihalnihalani
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: jac-native
Source: https://github.com/nihalnihalani/jachacks-sf-2026/tree/main/plugins/jac-codex/skills/jac-native
Command: npx skills add https://github.com/nihalnihalani/jachacks-sf-2026 --skill jac-native-nihalnihalani

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 to 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-targets 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 and mixed codebases: Declare C-ABI imports (e.g., raylib) with fixed-width types and by-value struct passing, and pin hot pure-compute sections native inside regular .jac files with automatic Python bridging. - Use Case: You have a CLI tool or a tight numeric loop in Jac. Compile it with jac nacompile to ship a single binary, or mark the hot function native and keep the rest of the program on the full Python ecosystem. ## Quick Start Compile my Jac program tool.jac into a standalone native binary and show me how to pass command-line arguments to 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 program to a native binary?▼

Run jac nacompile app.jac -o app to produce a standalone zero-dependency binary. The file must contain a with entry block, otherwise compilation fails with a no entry point found error.

What Jac features are supported in native compilation?▼

The native subset supports collections, enums, objects with inheritance, exceptions, file I/O, comprehensions, and a Python-congruent stdlib including math, time, sys, os, and random. Walkers, async, generators, decorators, by llm, and PyPI imports fail loudly at compile time.

Can Jac native code call C libraries like raylib?▼

Yes, declare C-ABI functions inside an import from block with fixed-width types like i32 and f32, and the compiler links against the shared library at runtime. Structs declared as obj pass by value following the platform C ABI.

Why does jac nacompile fail when jac check passes?▼

Some errors only appear during codegen, such as mixing an FFI i32 with an int in a ternary, which aborts with a PHI nodes error. Replace the ternary with an explicit if statement returning each branch.

Does jac run --autonative always execute code natively?▼

No, it attempts native execution and silently falls back to Python when the file uses unsupported features like walkers or async. It prints a confirmation message only when a plain .jac file is promoted to native.