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:
nyash-codex
2025-11-06 15:41:52 +09:00
parent 2dc370223d
commit 77d4fd72b3
1658 changed files with 6288 additions and 2612 deletions

View File

@ -231,9 +231,9 @@ override → O # オーバーライド
**すべての糖衣構文は双方向変換可能:**
```bash
# フォーマッターによる自由な変換
nyash format --style=explicit code.nyash # 明示的記法へ
nyash format --style=sugar code.nyash # 糖衣構文へ
nyash format --style=ancp code.nyash # 極限圧縮へ
nyash format --style=explicit code.hako # 明示的記法へ
nyash format --style=sugar code.hako # 糖衣構文へ
nyash format --style=ancp code.hako # 極限圧縮へ
```
**同じコードの3つの表現**

View File

@ -54,9 +54,9 @@ onHover(position) {
### Phase 2: 実用化2週間目
1. **CLI実装**Codex提案
```bash
ancp encode --layer F input.nyash -o output.f
ancp encode --layer F input.hako -o output.f
ancp decode output.f --map output.map
ancp verify input.nyash output.f # MIR等価性チェック
ancp verify input.hako output.f # MIR等価性チェック
```
2. **プロジェクト辞書**Gemini提案

View File

@ -102,7 +102,7 @@ esac
### Test 1: 最小Box
```nyash
# input.nyash
# input.hako
box Test {
init { value }
}
@ -113,7 +113,7 @@ $Test{#{value}}
### Test 2: 簡単な関数
```nyash
# input.nyash
# input.hako
box Calculator {
add(a, b) {
return a + b

View File

@ -252,22 +252,22 @@ peek ast {
### ステップ1: 標準コードを書く
```bash
# 通常のNyashで開発
vim src/feature.nyash
vim src/feature.hako
```
### ステップ2: 段階的圧縮
```bash
# L1: 糖衣構文適用
nyashfmt --sugar src/feature.nyash > feature.sugar.nyash
nyashfmt --sugar src/feature.hako > feature.sugar.hako
# L2: ANCP変換
nyash2ancp feature.sugar.nyash > feature.ancp
nyash2ancp feature.sugar.hako > feature.ancp
# L3: 極限糖衣
nyashfmt --ultra feature.ancp > feature.ultra.nyash
nyashfmt --ultra feature.ancp > feature.ultra.hako
# L4: 最大圧縮
nyash2fusion feature.ultra.nyash > feature.fusion
nyash2fusion feature.ultra.hako > feature.fusion
```
### ステップ3: AIとの対話
@ -284,10 +284,10 @@ cat *.fusion | clip
### ステップ4: 可逆展開
```bash
# AIの応答を展開
fusion2nyash --level=0 ai_response.fusion > fixed.nyash
fusion2nyash --level=0 ai_response.fusion > fixed.hako
# 差分確認
diff src/feature.nyash fixed.nyash
diff src/feature.hako fixed.hako
```
## 🛠️ ツールチェーン

View File

@ -251,9 +251,9 @@ r=d\:_.isValid()/:_|>n|>t
### 可逆変換の保証
```bash
# どの形式からでも相互変換可能
nyash format --from=explicit --to=sugar code.nyash
nyash format --from=sugar --to=ancp code.nyash
nyash format --from=ancp --to=explicit code.nyash
nyash format --from=explicit --to=sugar code.hako
nyash format --from=sugar --to=ancp code.hako
nyash format --from=ancp --to=explicit code.hako
```
## 🚀 Phase 15との相乗効果

View File

@ -178,7 +178,7 @@ result"
5. 使用例:コマンドラインツール
================================================================================
// nyashfmt.nyash - フォーマッターCLI
// nyashfmt.hako - フォーマッターCLI
static box Main {
main(args) {
local formatter = new NyashFormatter()
@ -285,7 +285,7 @@ box LearningMode {
8. 設定ファイル
================================================================================
// .nyashfmt.json - プロジェクト別設定
// .hakofmt.json - プロジェクト別設定
{
"mode": "standard",
"rules": {

View File

@ -156,7 +156,7 @@ impl SourceMap {
// ANCP位置 → Nyash位置への変換
self.mappings
.binary_search_by_key(&ancp_pos, |m| m.ancp_pos)
.map(|i| self.mappings[i].nyash_pos)
.map(|i| self.mappings[i].hako_pos)
.unwrap_or(ancp_pos)
}
}
@ -214,7 +214,7 @@ expected_pattern=$2
normal_output=$(./target/release/nyash "$test_file" 2>&1)
# 2. ANCP変換
ancp_file="${test_file%.nyash}.ancp"
ancp_file="${test_file%.hako}.ancp"
./target/release/nyash2ancp -i "$test_file" -o "$ancp_file"
# 3. ANCP実行
@ -289,8 +289,8 @@ def measure_file(nyash_path, ancp_path):
# 全サンプルファイルで測定
results = []
for nyash_file in glob.glob("examples/*.nyash"):
ancp_file = nyash_file.replace(".nyash", ".ancp")
for nyash_file in glob.glob("examples/*.hako"):
ancp_file = nyash_file.replace(".hako", ".ancp")
results.append(measure_file(nyash_file, ancp_file))
# 統計出力
@ -316,7 +316,7 @@ jobs:
- name: Run roundtrip tests
run: |
for f in examples/*.nyash; do
for f in examples/*.hako; do
echo "Testing: $f"
./tools/test_ancp_roundtrip.sh "$f"
done

View File

@ -161,14 +161,14 @@ impl Lexer {
### 5.2 CLI統合
```bash
# 変換コマンド
nyash --to-ancp input.nyash > output.ancp
nyash --from-ancp input.ancp > output.nyash
nyash --to-ancp input.hako > output.ancp
nyash --from-ancp input.ancp > output.hako
# 直接実行
nyash --dialect=ancp script.ancp
# フォーマット表示
nyash --view=ancp script.nyash # Nyashファイルをancp形式で表示
nyash --view=ancp script.hako # Nyashファイルをancp形式で表示
nyash --view=hybrid script.ancp # 並列表示
```
@ -209,7 +209,7 @@ fn roundtrip_all_constructs() {
"loop(i < 10) { i = i + 1 }",
// 複雑な例
include_str!("../examples/complex.nyash"),
include_str!("../examples/complex.hako"),
];
for case in test_cases {

View File

@ -198,7 +198,7 @@ Expected 'token' but found 'actual'
【エラーメッセージ例】
```
Error: Missing 'else' in peek expression
--> program.nyash:10:5
--> program.hako:10:5
|
10 | peek value {
| ^^^^ peek expression requires 'else' branch

View File

@ -167,7 +167,7 @@ if animal == "dog" {
================================================================================
```nyash
// test_peek_basic.nyash
// test_peek_basic.hako
local animal = "cat"
local sound = peek animal {
"dog" => "woof"
@ -176,7 +176,7 @@ local sound = peek animal {
}
print(sound) // "meow"
// test_peek_block.nyash
// test_peek_block.hako
local result = peek x {
1 => {
local temp = "one"
@ -185,7 +185,7 @@ local result = peek x {
else => "other"
}
// test_continue.nyash
// test_continue.hako
local i = 0
local sum = 0
loop(i < 5) {
@ -197,7 +197,7 @@ loop(i < 5) {
}
print(sum) // 12 (1+2+4+5, 3はスキップ)
// test_field_declaration.nyash
// test_field_declaration.hako
box Point {
public x: IntegerBox
public y: IntegerBox