Skip to content

Latest commit

 

History

History
96 lines (66 loc) · 2.11 KB

File metadata and controls

96 lines (66 loc) · 2.11 KB

Getting Started

Home | Getting Started | Language Guide | Builtins | FFI | Macros | Examples

Requirements

  • macOS on Apple Silicon (M1/M2/M3/M4)
  • Zig compiler (0.13+)

fy generates ARM64 machine code and uses macOS-specific JIT APIs (MAP_JIT, pthread_jit_write_protect_np). It does not run on Linux or x86.

Building

git clone <repo-url>
cd fy
zig build

The binary lands at ./zig-out/bin/fy (~1.8MB). The build system handles code signing for JIT execution automatically.

Running

Interactive REPL

./zig-out/bin/fy

If no files or -e flags are given, fy drops into the REPL:

fy! v0.0.1
fy> 2 3 + .
5
    0
fy> : square dup * ;
    0
fy> 7 square .
49
    0

The REPL preserves the data stack between lines. The 0 printed after each result is the return value of the session expression.

Running Files

./zig-out/bin/fy examples/fib.fy

Evaluating Expressions

./zig-out/bin/fy -e "2 3 + ."

Shebang Scripts

fy files can start with a shebang:

#!/path/to/fy
10 fib .

The #! line is automatically stripped before compilation.

Command-Line Flags

Flag Description
-e, --eval <expr> Evaluate an expression
-r, --repl Launch interactive REPL
-i, --image Dump JIT image to fy.out
-v, --version Print version
-s, --serve Start the hot-patching TCP listener
-p, --port <n> Set the listener port (default: OS-assigned)
-h, --help Show help

Editor Support

A VSCode extension with syntax highlighting and live hot-patching is available in editors/vscode/fy-lang/. See the Editor Support page for installation and usage.

Running Tests

The examples/golden/ directory contains golden tests (.fy files paired with .expected output files). Run them with:

zig build test

Next Steps