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:
@ -19,7 +19,7 @@ Everything you need to know about building Nyash for different platforms and con
|
||||
cargo build --release -j32
|
||||
|
||||
# Run
|
||||
./target/release/nyash program.nyash
|
||||
./target/release/nyash program.hako
|
||||
```
|
||||
|
||||
### Windows Cross-Compile from WSL
|
||||
@ -38,7 +38,7 @@ cargo xwin build --target x86_64-pc-windows-msvc --release
|
||||
| **Standard** | `cargo build --release` | Linux/macOS binary | Local development |
|
||||
| **Windows Cross** | `cargo xwin build --target x86_64-pc-windows-msvc` | Windows .exe | Windows distribution |
|
||||
| **WebAssembly** | `wasm-pack build --target web` | .wasm + JS | Browser deployment |
|
||||
| **AOT Native** | `./tools/build_aot.sh program.nyash` | Standalone executable | High-performance deployment |
|
||||
| **AOT Native** | `./tools/build_aot.sh program.hako` | Standalone executable | High-performance deployment |
|
||||
| **Plugins** | `cargo build --release` (in plugin dir) | .so/.dll/.dylib | Extending Nyash |
|
||||
|
||||
## 🖥️ Platform-Specific Builds
|
||||
@ -94,7 +94,7 @@ cargo build --release
|
||||
```powershell
|
||||
# Requires Cranelift + (clang または MSYS2/WSL の bash+cc)
|
||||
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
|
||||
```
|
||||
|
||||
@ -120,8 +120,8 @@ wasm-pack build --target web
|
||||
|
||||
#### 2. Compile Nyash Code to WASM
|
||||
```bash
|
||||
# Compile .nyash to .wat (WebAssembly Text)
|
||||
./target/release/nyash --compile-wasm program.nyash -o output.wat
|
||||
# Compile .hako to .wat (WebAssembly Text)
|
||||
./target/release/nyash --compile-wasm program.hako -o output.wat
|
||||
|
||||
# Convert to binary WASM (requires wabt)
|
||||
wat2wasm output.wat -o output.wasm
|
||||
@ -137,7 +137,7 @@ Compile Nyash programs to standalone native executables:
|
||||
cargo build --release --features cranelift-jit
|
||||
|
||||
# Compile to native
|
||||
./tools/build_aot.sh program.nyash -o app
|
||||
./tools/build_aot.sh program.hako -o app
|
||||
./app # Standalone executable!
|
||||
```
|
||||
|
||||
@ -145,7 +145,7 @@ cargo build --release --features cranelift-jit
|
||||
```powershell
|
||||
# From PowerShell
|
||||
cargo build --release --features cranelift-jit
|
||||
powershell -ExecutionPolicy Bypass -File tools\build_aot.ps1 -Input program.nyash -Out app.exe
|
||||
powershell -ExecutionPolicy Bypass -File tools\build_aot.ps1 -Input program.hako -Out app.exe
|
||||
.\app.exe
|
||||
```
|
||||
|
||||
@ -209,8 +209,8 @@ cp nyash.toml dist/
|
||||
# 4. Copy plugin DLLs
|
||||
cp plugins/*/target/x86_64-pc-windows-msvc/release/*.dll dist/plugins/
|
||||
|
||||
# 5. Add your .nyash files
|
||||
cp your_app.nyash dist/
|
||||
# 5. Add your .hako files
|
||||
cp your_app.hako dist/
|
||||
```
|
||||
|
||||
**Distribution structure:**
|
||||
@ -218,7 +218,7 @@ cp your_app.nyash dist/
|
||||
dist/
|
||||
├── nyash.exe
|
||||
├── nyash.toml
|
||||
├── your_app.nyash
|
||||
├── your_app.hako
|
||||
└── plugins/
|
||||
├── nyash_filebox_plugin.dll
|
||||
├── nyash_array_plugin.dll
|
||||
|
||||
@ -35,7 +35,7 @@ Use the provided build script:
|
||||
|
||||
```bash
|
||||
# Basic usage
|
||||
./tools/build_aot.sh program.nyash -o myapp
|
||||
./tools/build_aot.sh program.hako -o myapp
|
||||
|
||||
# Run the native executable
|
||||
./myapp
|
||||
@ -52,7 +52,7 @@ From PowerShell:
|
||||
|
||||
```powershell
|
||||
# Build native executable
|
||||
powershell -ExecutionPolicy Bypass -File tools\build_aot.ps1 -Input program.nyash -Out myapp.exe
|
||||
powershell -ExecutionPolicy Bypass -File tools\build_aot.ps1 -Input program.hako -Out myapp.exe
|
||||
|
||||
# Run it
|
||||
.\myapp.exe
|
||||
@ -62,13 +62,13 @@ From WSL (cross-compile):
|
||||
|
||||
```bash
|
||||
# Use the bash script even for Windows targets
|
||||
NYASH_TARGET=windows ./tools/build_aot.sh program.nyash -o myapp.exe
|
||||
NYASH_TARGET=windows ./tools/build_aot.sh program.hako -o myapp.exe
|
||||
```
|
||||
|
||||
## 🎯 AOT Compilation Pipeline
|
||||
|
||||
```
|
||||
program.nyash
|
||||
program.hako
|
||||
↓
|
||||
[Nyash Parser]
|
||||
↓
|
||||
@ -108,7 +108,7 @@ Native Executable
|
||||
### Example: Simple Calculation
|
||||
|
||||
```nyash
|
||||
// aot_example.nyash
|
||||
// aot_example.hako
|
||||
static box Main {
|
||||
main() {
|
||||
local x = 10
|
||||
@ -137,14 +137,14 @@ static box Main {
|
||||
|
||||
```bash
|
||||
# See what's happening
|
||||
NYASH_CLI_VERBOSE=1 ./tools/build_aot.sh program.nyash
|
||||
NYASH_CLI_VERBOSE=1 ./tools/build_aot.sh program.hako
|
||||
```
|
||||
|
||||
### Check JIT Coverage
|
||||
|
||||
```bash
|
||||
# See which operations are supported
|
||||
NYASH_JIT_DUMP=1 ./target/release/nyash --backend vm program.nyash
|
||||
NYASH_JIT_DUMP=1 ./target/release/nyash --backend vm program.hako
|
||||
```
|
||||
|
||||
### Common Issues
|
||||
@ -171,7 +171,7 @@ hint: Strict mode forbids fallback. Ensure main() is lowerable under current JIT
|
||||
|
||||
### Benchmark Results
|
||||
|
||||
| Execution Mode | Time (ny_bench.nyash) | Relative |
|
||||
| Execution Mode | Time (ny_bench.hako) | Relative |
|
||||
|----------------|----------------------|----------|
|
||||
| Interpreter | 110.10ms | 1.0x |
|
||||
| VM | 8.14ms | 13.5x |
|
||||
@ -185,7 +185,7 @@ hint: Strict mode forbids fallback. Ensure main() is lowerable under current JIT
|
||||
RUSTFLAGS="-C target-cpu=native" cargo build --release --features cranelift-jit
|
||||
|
||||
# Then compile your program
|
||||
./tools/build_aot.sh program.nyash -o optimized_app
|
||||
./tools/build_aot.sh program.hako -o optimized_app
|
||||
```
|
||||
|
||||
## 🔌 Plugin Support in AOT
|
||||
@ -196,7 +196,7 @@ The goal is to statically link plugins:
|
||||
|
||||
```bash
|
||||
# Future syntax (not yet implemented)
|
||||
./tools/build_aot.sh program.nyash \
|
||||
./tools/build_aot.sh program.hako \
|
||||
--static-plugins filebox,stringbox \
|
||||
-o standalone_app
|
||||
```
|
||||
|
||||
@ -173,19 +173,19 @@ extern "C" {
|
||||
# test_all_platforms.sh
|
||||
|
||||
echo "=== Testing Linux Build ==="
|
||||
./target/release/nyash test/cross_platform.nyash
|
||||
./target/release/nyash test/cross_platform.hako
|
||||
|
||||
echo "=== Testing Windows Build (Wine) ==="
|
||||
wine ./target/x86_64-pc-windows-msvc/release/nyash.exe test/cross_platform.nyash
|
||||
wine ./target/x86_64-pc-windows-msvc/release/nyash.exe test/cross_platform.hako
|
||||
|
||||
echo "=== Testing WASM Build ==="
|
||||
wasmtime ./target/wasm32-wasi/release/nyash.wasm test/cross_platform.nyash
|
||||
wasmtime ./target/wasm32-wasi/release/nyash.wasm test/cross_platform.hako
|
||||
```
|
||||
|
||||
### Cross-Platform Test Program
|
||||
|
||||
```nyash
|
||||
// test/cross_platform.nyash
|
||||
// test/cross_platform.hako
|
||||
print("Platform Test Starting...")
|
||||
|
||||
// Test basic plugins
|
||||
|
||||
@ -48,7 +48,7 @@ cargo build --release
|
||||
my-nyash-app/
|
||||
├── nyash.exe # Main executable (4.1MB)
|
||||
├── nyash.toml # Configuration
|
||||
├── app.nyash # Your application
|
||||
├── app.hako # Your application
|
||||
├── README.txt # User instructions
|
||||
└── plugins/ # Plugin DLLs
|
||||
├── nyash_array_plugin.dll
|
||||
@ -107,7 +107,7 @@ cp plugins/nyash-array-plugin/target/x86_64-pc-windows-msvc/release/nyash_array_
|
||||
#### 5. Add Your Application
|
||||
|
||||
```bash
|
||||
cp your_app.nyash dist/my-nyash-app/app.nyash
|
||||
cp your_app.hako dist/my-nyash-app/app.hako
|
||||
```
|
||||
|
||||
#### 6. Create Run Script (Optional)
|
||||
@ -115,7 +115,7 @@ cp your_app.nyash dist/my-nyash-app/app.nyash
|
||||
Create `run.bat`:
|
||||
```batch
|
||||
@echo off
|
||||
nyash.exe app.nyash %*
|
||||
nyash.exe app.hako %*
|
||||
```
|
||||
|
||||
## 🚀 Real-World Example
|
||||
@ -144,14 +144,14 @@ for plugin in filebox array map string integer; do
|
||||
done
|
||||
|
||||
# 5. Test on Windows
|
||||
cmd.exe /c "cd C:\tmp\nyash-windows-dist && nyash.exe test.nyash"
|
||||
cmd.exe /c "cd C:\tmp\nyash-windows-dist && nyash.exe test.hako"
|
||||
```
|
||||
|
||||
## 🎯 Testing Your Distribution
|
||||
|
||||
### Basic Test Program
|
||||
|
||||
Create `test.nyash`:
|
||||
Create `test.hako`:
|
||||
```nyash
|
||||
print("=== Testing Nyash Distribution ===")
|
||||
|
||||
@ -174,14 +174,14 @@ print("Map test: " + map.get("status"))
|
||||
|
||||
```batch
|
||||
:: Basic run
|
||||
nyash.exe test.nyash
|
||||
nyash.exe test.hako
|
||||
|
||||
:: With verbose output
|
||||
nyash.exe --verbose test.nyash
|
||||
nyash.exe --verbose test.hako
|
||||
|
||||
:: Check plugin loading
|
||||
set NYASH_CLI_VERBOSE=1
|
||||
nyash.exe test.nyash
|
||||
nyash.exe test.hako
|
||||
```
|
||||
|
||||
## 📝 Important Notes
|
||||
@ -237,11 +237,11 @@ DefaultGroupName=My Nyash App
|
||||
[Files]
|
||||
Source: "nyash.exe"; DestDir: "{app}"
|
||||
Source: "nyash.toml"; DestDir: "{app}"
|
||||
Source: "app.nyash"; DestDir: "{app}"
|
||||
Source: "app.hako"; DestDir: "{app}"
|
||||
Source: "plugins\*.dll"; DestDir: "{app}\plugins"
|
||||
|
||||
[Icons]
|
||||
Name: "{group}\My Nyash App"; Filename: "{app}\nyash.exe"; Parameters: "app.nyash"
|
||||
Name: "{group}\My Nyash App"; Filename: "{app}\nyash.exe"; Parameters: "app.hako"
|
||||
```
|
||||
|
||||
### Using zip for Simple Distribution
|
||||
|
||||
Reference in New Issue
Block a user