naming: add hako/hakorune wrappers; hako-check prefers alias via HAKO_BIN or tools/bin/hako; docs updated
This commit is contained in:
13
tools/bin/hako
Normal file
13
tools/bin/hako
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||||
|
BIN="$ROOT_DIR/target/release/nyash"
|
||||||
|
|
||||||
|
if [[ ! -x "$BIN" ]]; then
|
||||||
|
echo "[info] building (release) ..." >&2
|
||||||
|
cargo build --release -q
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$BIN" "$@"
|
||||||
|
|
||||||
6
tools/bin/hakorune
Normal file
6
tools/bin/hakorune
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||||
|
"$ROOT_DIR/tools/bin/hako" "$@"
|
||||||
|
|
||||||
@ -5,10 +5,11 @@ Purpose
|
|||||||
- Useful while Python/llvmlite migration is in-flight to keep scripts healthy.
|
- Useful while Python/llvmlite migration is in-flight to keep scripts healthy.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
- Build nyash:
|
- Build once (auto-build if missing):
|
||||||
- cargo build --release
|
- cargo build --release
|
||||||
- Run checker:
|
- Run checker:
|
||||||
- tools/hako-check/hako-check.sh path/to/file.hako
|
- tools/hako-check/hako-check.sh path/to/file.hako
|
||||||
|
- or set alias explicitly: HAKO_BIN=tools/bin/hako tools/hako-check/hako-check.sh file.hako
|
||||||
|
|
||||||
Behavior
|
Behavior
|
||||||
- Runs: nyash --backend mir --verify <file>
|
- Runs: nyash --backend mir --verify <file>
|
||||||
@ -17,6 +18,8 @@ Behavior
|
|||||||
- 2+: Parse/MIR verify failure (nyash returns non‑zero; checker forwards)
|
- 2+: Parse/MIR verify failure (nyash returns non‑zero; checker forwards)
|
||||||
|
|
||||||
Notes
|
Notes
|
||||||
|
- Binary alias
|
||||||
|
- Preferred alias: tools/bin/hako (or tools/bin/hakorune)
|
||||||
|
- Backward‑compat: target/release/nyash も利用可(自動検出)
|
||||||
- This MVP only checks a single file and depends on the Rust parser.
|
- This MVP only checks a single file and depends on the Rust parser.
|
||||||
- Extend with flags (parser selection, JSON emit) as migration progresses.
|
- Extend with flags (parser selection, JSON emit) as migration progresses.
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,17 @@ if [[ $# -lt 1 ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
|
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||||
BIN="$ROOT_DIR/target/release/nyash"
|
# Allow alias: HAKO_BIN overrides binary path. Otherwise prefer 'hako' alias, then 'nyash'.
|
||||||
|
BIN="${HAKO_BIN:-}"
|
||||||
|
if [[ -z "${BIN}" ]]; then
|
||||||
|
if [[ -x "$ROOT_DIR/tools/bin/hako" ]]; then
|
||||||
|
BIN="$ROOT_DIR/tools/bin/hako"
|
||||||
|
elif [[ -x "$ROOT_DIR/tools/bin/hakorune" ]]; then
|
||||||
|
BIN="$ROOT_DIR/tools/bin/hakorune"
|
||||||
|
else
|
||||||
|
BIN="$ROOT_DIR/target/release/nyash"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
FILE="$1"
|
FILE="$1"
|
||||||
|
|
||||||
if [[ ! -x "$BIN" ]]; then
|
if [[ ! -x "$BIN" ]]; then
|
||||||
@ -23,4 +33,3 @@ fi
|
|||||||
# Parse → MIR build → verify (no execute)
|
# Parse → MIR build → verify (no execute)
|
||||||
"$BIN" --backend mir --verify "$FILE"
|
"$BIN" --backend mir --verify "$FILE"
|
||||||
echo "OK: $FILE"
|
echo "OK: $FILE"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user