phase: 20.49 COMPLETE; 20.50 Flow+String minimal reps; 20.51 selfhost v0/v1 minimal (Option A/B); hv1-inline binop/unop/copy; docs + run_all + CURRENT_TASK -> 21.0
This commit is contained in:
44
README.md
44
README.md
@ -25,7 +25,7 @@ Execution Status (Feature Additions Pause)
|
||||
|
||||
Quick pointers
|
||||
- Emit object with harness: set `NYASH_LLVM_USE_HARNESS=1` and `NYASH_LLVM_OBJ_OUT=<path>` (defaults in tools use `tmp/`).
|
||||
- Run PyVM: `NYASH_VM_USE_PY=1 $NYASH_BIN --backend vm apps/APP/main.nyash`.
|
||||
- Run PyVM: `NYASH_VM_USE_PY=1 $NYASH_BIN --backend vm apps/APP/main.hako`.
|
||||
|
||||
Program(JSON v0) → MIR(JSON)
|
||||
- Convert a Stage‑B Program(JSON v0) file to MIR(JSON):
|
||||
@ -37,10 +37,10 @@ Dev shortcuts (Operator Boxes & JSON smokes)
|
||||
- Details: `docs/guides/operator-boxes.md`
|
||||
|
||||
Dev mode and defaults
|
||||
- `nyash --dev script.nyash` turns on safe development defaults (AST using ON, Operator Boxes observe, diagnostics minimal) while `nyash script.nyash` stays production‑like and quiet.
|
||||
- `nyash --dev script.hako` turns on safe development defaults (AST using ON, Operator Boxes observe, diagnostics minimal) while `nyash script.hako` stays production‑like and quiet.
|
||||
- You can still use the dev shortcuts for a one‑command setup: `./tools/opbox-json.sh`, `./tools/opbox-quick.sh`.
|
||||
- Using guard: duplicate `using` of the same file (or alias rebind to a different file) now errors with a line number hint to avoid ambiguous resolution.
|
||||
- Example error: `using: duplicate import of '<canon_path>' at file.nyash:12 (previous alias 'X' first seen at line 5)`
|
||||
- Example error: `using: duplicate import of '<canon_path>' at file.hako:12 (previous alias 'X' first seen at line 5)`
|
||||
- Fix by removing the duplicate or consolidating aliases.
|
||||
|
||||
Phase‑15 (2025‑09) update
|
||||
@ -63,12 +63,12 @@ ExternCall (env.*) and println normalization: `docs/reference/runtime/externcall
|
||||
|
||||
### Minimal ENV (VM vs LLVM harness)
|
||||
- VM: no extra environment needed for typical runs.
|
||||
- Example: `$NYASH_BIN --backend vm apps/tests/ternary_basic.nyash`
|
||||
- Example: `$NYASH_BIN --backend vm apps/tests/ternary_basic.hako`
|
||||
- LLVM harness: set three variables so the runner finds the harness and runtime.
|
||||
- `NYASH_LLVM_USE_HARNESS=1`
|
||||
- `NYASH_NY_LLVM_COMPILER=$NYASH_ROOT/target/release/ny-llvmc`
|
||||
- `NYASH_EMIT_EXE_NYRT=$NYASH_ROOT/target/release`
|
||||
- Example: `NYASH_LLVM_USE_HARNESS=1 NYASH_NY_LLVM_COMPILER=target/release/ny-llvmc NYASH_EMIT_EXE_NYRT=target/release $NYASH_BIN --backend llvm apps/ny-llvm-smoke/main.nyash`
|
||||
- Example: `NYASH_LLVM_USE_HARNESS=1 NYASH_NY_LLVM_COMPILER=target/release/ny-llvmc NYASH_EMIT_EXE_NYRT=target/release $NYASH_BIN --backend llvm apps/ny-llvm-smoke/main.hako`
|
||||
|
||||
### DebugHub Quick Guide
|
||||
- Enable: `NYASH_DEBUG_ENABLE=1`
|
||||
@ -104,7 +104,7 @@ Layer guard (one-way deps: origin→observe→rewrite)
|
||||
Profiles (quick)
|
||||
- `--profile dev` → Macros ON (strict), PyVM dev向け設定を適用(必要に応じて環境で上書き可)
|
||||
- `--profile lite` → Macros OFF の軽量実行
|
||||
- 例: `$NYASH_BIN --profile dev --backend vm apps/tests/ternary_basic.nyash`
|
||||
- 例: `$NYASH_BIN --profile dev --backend vm apps/tests/ternary_basic.hako`
|
||||
|
||||
Specs & Constraints
|
||||
- Invariants (must-hold): `docs/reference/invariants.md`
|
||||
@ -122,7 +122,7 @@ Specs & Constraints
|
||||
<a id="self-hosting"></a>
|
||||
## 🧪 Self‑Hosting (Dev Focus)
|
||||
- Guide: `docs/how-to/self-hosting.md`
|
||||
- Minimal E2E: `$NYASH_BIN --backend vm apps/selfhost-minimal/main.nyash`
|
||||
- Minimal E2E: `$NYASH_BIN --backend vm apps/selfhost-minimal/main.hako`
|
||||
- Smokes: `bash tools/jit_smoke.sh` / `bash tools/selfhost_vm_smoke.sh`
|
||||
- JSON (Operator Boxes, dev): `./tools/opbox-json.sh` / `./tools/opbox-quick.sh`
|
||||
- Makefile: `make run-minimal`, `make smoke-selfhost`
|
||||
@ -142,7 +142,7 @@ Note: JIT runtime execution is currently disabled to reduce debugging overhead.
|
||||
```bash
|
||||
# From Nyash source to native binary (Cranelift required)
|
||||
cargo build --release --features cranelift-jit
|
||||
./tools/build_aot.sh program.nyash -o app # Native EXE
|
||||
./tools/build_aot.sh program.hako -o app # Native EXE
|
||||
./app # Standalone execution!
|
||||
```
|
||||
|
||||
@ -216,7 +216,7 @@ Phase‑15 (Self‑Hosting): Legacy VM/Interpreter are feature‑gated
|
||||
|
||||
### 1. **Interpreter Mode** (Development)
|
||||
```bash
|
||||
$NYASH_BIN program.nyash
|
||||
$NYASH_BIN program.hako
|
||||
```
|
||||
- Instant execution
|
||||
- Full debug information
|
||||
@ -225,11 +225,11 @@ $NYASH_BIN program.nyash
|
||||
### 2. **VM Mode (PyVM default / Legacy optional)**
|
||||
```bash
|
||||
# Default: PyVM harness (requires python3)
|
||||
$NYASH_BIN --backend vm program.nyash
|
||||
$NYASH_BIN --backend vm program.hako
|
||||
|
||||
# Enable legacy Rust VM if needed
|
||||
cargo build --release --features vm-legacy
|
||||
$NYASH_BIN --backend vm program.nyash
|
||||
$NYASH_BIN --backend vm program.hako
|
||||
```
|
||||
- Default (vm-legacy OFF): PyVM executes MIR(JSON) via `tools/pyvm_runner.py`
|
||||
- Legacy VM: 13.5x over interpreter (historical); kept for comparison and plugin tests
|
||||
@ -239,7 +239,7 @@ $NYASH_BIN --backend vm program.nyash
|
||||
# Build once (Cranelift)
|
||||
cargo build --release --features cranelift-jit
|
||||
|
||||
./tools/build_aot.sh program.nyash -o myapp
|
||||
./tools/build_aot.sh program.hako -o myapp
|
||||
./myapp # Standalone executable!
|
||||
```
|
||||
- Zero dependencies
|
||||
@ -255,13 +255,13 @@ cargo build --release -p nyash-llvm-compiler && cargo build --release --features
|
||||
NYASH_LLVM_USE_HARNESS=1 \
|
||||
NYASH_NY_LLVM_COMPILER=target/release/ny-llvmc \
|
||||
NYASH_EMIT_EXE_NYRT=target/release \
|
||||
$NYASH_BIN --backend llvm --emit-exe myapp program.nyash
|
||||
$NYASH_BIN --backend llvm --emit-exe myapp program.hako
|
||||
./myapp
|
||||
|
||||
# Alternatively, emit an object file then link manually
|
||||
NYASH_LLVM_USE_HARNESS=1 \
|
||||
NYASH_NY_LLVM_COMPILER=target/release/ny-llvmc \
|
||||
$NYASH_BIN --backend llvm program.nyash \
|
||||
$NYASH_BIN --backend llvm program.hako \
|
||||
-D NYASH_LLVM_OBJ_OUT=$PWD/nyash_llvm_temp.o
|
||||
cc nyash_llvm_temp.o -L crates/nyrt/target/release -Wl,--whole-archive -lnyrt -Wl,--no-whole-archive -lpthread -ldl -lm -o myapp
|
||||
./myapp
|
||||
@ -269,12 +269,12 @@ cc nyash_llvm_temp.o -L crates/nyrt/target/release -Wl,--whole-archive -lnyrt -W
|
||||
|
||||
Quick smoke test (VM vs EXE):
|
||||
```bash
|
||||
tools/smoke_aot_vs_vm.sh examples/aot_min_string_len.nyash
|
||||
tools/smoke_aot_vs_vm.sh examples/aot_min_string_len.hako
|
||||
```
|
||||
|
||||
### LLVM Backend Notes
|
||||
- `NYASH_LLVM_OBJ_OUT`: Path to emit `.o` when running `--backend llvm`.
|
||||
- Example: `NYASH_LLVM_OBJ_OUT=$PWD/nyash_llvm_temp.o $NYASH_BIN --backend llvm apps/ny-llvm-smoke/main.nyash`
|
||||
- Example: `NYASH_LLVM_OBJ_OUT=$PWD/nyash_llvm_temp.o $NYASH_BIN --backend llvm apps/ny-llvm-smoke/main.hako`
|
||||
- Previously available `NYASH_LLVM_ALLOW_BY_NAME=1`: Removed - all plugin calls now use method_id by default.
|
||||
- The LLVM backend only supports method_id-based plugin calls for better performance and type safety.
|
||||
|
||||
@ -295,13 +295,13 @@ Reads `hako.toml` (compat: `nyash.toml`), builds plugins → core → emits AOT
|
||||
Basic (Cranelift AOT)
|
||||
```bash
|
||||
$NYASH_BIN --build hako.toml \
|
||||
--app apps/egui-hello-plugin/main.nyash \
|
||||
--app apps/egui-hello-plugin/main.hako \
|
||||
--out app_egui
|
||||
```
|
||||
|
||||
Key options (minimal)
|
||||
- `--build <path>`: path to `hako.toml` (compat: `nyash.toml`)
|
||||
- `--app <file>`: entry `.nyash`
|
||||
- `--app <file>`: entry `.hako`
|
||||
- `--out <name>`: output executable (default: `app`/`app.exe`)
|
||||
- `--build-aot cranelift|llvm` (default: cranelift)
|
||||
- `--profile release|debug` (default: release)
|
||||
@ -315,7 +315,7 @@ Notes
|
||||
|
||||
## 📊 **Performance Benchmarks**
|
||||
|
||||
Real-world benchmark results (ny_bench.nyash):
|
||||
Real-world benchmark results (ny_bench.hako):
|
||||
|
||||
```
|
||||
Mode | Time | Relative Speed
|
||||
@ -497,8 +497,8 @@ cd nyash
|
||||
cargo build --release --features cranelift-jit
|
||||
|
||||
# Run your first program
|
||||
echo 'print("Hello Nyash!")' > hello.nyash
|
||||
$NYASH_BIN hello.nyash
|
||||
echo 'print("Hello Nyash!")' > hello.hako
|
||||
$NYASH_BIN hello.hako
|
||||
```
|
||||
|
||||
### Windows
|
||||
@ -510,7 +510,7 @@ cargo xwin build --target x86_64-pc-windows-msvc --release
|
||||
|
||||
# Native EXE (AOT) on Windows (requires Cranelift and MSYS2/WSL toolchain for linking)
|
||||
cargo build --release --features cranelift-jit
|
||||
powershell -ExecutionPolicy Bypass -File tools\build_aot.ps1 -Input examples\aot_min_string_len.nyash -Out app.exe
|
||||
powershell -ExecutionPolicy Bypass -File tools\build_aot.ps1 -Input examples\aot_min_string_len.hako -Out app.exe
|
||||
./app.exe
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user