2.6 KiB
2.6 KiB
EXE‑First Quickstart (WSL/Ubuntu)
This guide prioritizes building and running the Nyash parser as a native executable on WSL (Ubuntu). It uses the LLVM harness (llvmlite) and the NyRT static runtime.
Prerequisites
- Rust toolchain (stable):
curl https://sh.rustup.rs -sSf | sh - Build tools:
sudo apt update && sudo apt install -y build-essential git python3 python3-pip - llvmlite:
pip3 install --user llvmlite - LLVM 18 (for
llvm-config-18used by the Rust build + tools):- Ubuntu (with apt.llvm.org):
sudo apt install -y wget gnupg lsb-releasewget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 18- This installs
llvm-18andllvm-18-dev(providesllvm-config-18).
- Ubuntu (with apt.llvm.org):
Verify
rustc --versionpython3 -c "import llvmlite, sys; print('llvmlite', llvmlite.__version__)"llvm-config-18 --version
Build Parser EXE (bundle)
tools/build_compiler_exe.sh- Result:
dist/nyash_compiler/containingnyash_compiler,nyash.toml, and the FileBox plugin.
Smoke (Parser EXE → JSON)
echo 'return 1+2*3' > dist/nyash_compiler/tmp/sample.ny(cd dist/nyash_compiler && ./nyash_compiler tmp/sample.ny > sample.json)head -n1 dist/nyash_compiler/sample.jsonshould start with{and contain"kind":"Program".
End‑to‑End (JSON → execute via bridge)
./tools/exe_first_smoke.sh- Builds the EXE bundle, runs parser → JSON, and executes via the bridge to verify exit code
7.
- Builds the EXE bundle, runs parser → JSON, and executes via the bridge to verify exit code
MIR Builder (optional, EXE)
- Build:
cargo build --release --features llvm - EXE from JSON:
./target/release/ny_mir_builder --in dist/nyash_compiler/sample.json --emit exe -o app_out - Run:
./app_out(exit7expected forreturn 1+2*3).
Runner with EXE‑First Parser
NYASH_USE_NY_COMPILER=1 NYASH_USE_NY_COMPILER_EXE=1 ./target/release/nyash --backend vm tmp/sample.hako- Smoke:
./tools/exe_first_runner_smoke.sh
Troubleshooting
llvm-config-18: not found- Ensure apt.llvm.org installation worked (see above), or install the distro’s
llvm-18-devpackage.
- Ensure apt.llvm.org installation worked (see above), or install the distro’s
ModuleNotFoundError: llvmlitepip3 install --user llvmliteand re‑run the build/smoke.
- Link errors (
ccnot found or missing libs)sudo apt install -y build-essential- If you have a custom toolchain, export
CCto point at your compiler.
- Plugin resolution
- The EXE bundle includes a minimal
nyash.tomland plugin paths underdist/nyash_compiler/plugins/.
- The EXE bundle includes a minimal
Notes
- The EXE‑first path is the delivery priority. PyVM remains a development aid for semantics parity.
- Windows support is evolving; WSL is the recommended environment for now.