smokes: add JSON nested/invalid cases; force VM backend; temp nyash.toml with json_native package for resolution
This commit is contained in:
@ -1,9 +0,0 @@
|
||||
# Architecture Docs Moved
|
||||
|
||||
アーキテクチャの正本は `docs/reference/architecture/` へ集約しました。
|
||||
|
||||
- 入口: [../reference/architecture/](../reference/architecture/)
|
||||
- 代表: [PHI and SSA](../reference/architecture/phi-and-ssa.md)
|
||||
|
||||
このディレクトリは互換のための案内のみ残しています。
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
# Moved: PHI and SSA
|
||||
|
||||
このドキュメントは再編により移動しました。
|
||||
新しい場所: [../reference/architecture/phi-and-ssa.md](../reference/architecture/phi-and-ssa.md)
|
||||
|
||||
この stub は後方互換のために残しています。
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
# Moved: Blueprints
|
||||
|
||||
Blueprints は `development/design/blueprints/` に集約しました。
|
||||
|
||||
- 新しい場所: [../development/design/blueprints/](../development/design/blueprints/)
|
||||
|
||||
この stub は後方互換のために残しています。
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
# Moved: Strings Blueprint — UTF‑8 / Bytes
|
||||
|
||||
このドキュメントは再編により移動しました。
|
||||
新しい場所: [../development/design/blueprints/strings-utf8-byte.md](../development/design/blueprints/strings-utf8-byte.md)
|
||||
|
||||
この stub は後方互換のために残しています。
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
# Moved: Comparison
|
||||
|
||||
比較記事は `docs/guides/comparison/` に移動しました。
|
||||
|
||||
- 代表: [nyash-vs-others.md](../guides/comparison/nyash-vs-others.md)
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
# Design Notes Moved
|
||||
|
||||
`docs/design/` の設計ノートは `docs/development/design/legacy/` に移動しました。
|
||||
|
||||
- 新しい場所: [../development/design/legacy/](../development/design/legacy/)
|
||||
- よく参照されるページ:
|
||||
- [flow-blocks.md](../development/design/legacy/flow-blocks.md)
|
||||
- [using-loader-integration.md](../development/design/legacy/using-loader-integration.md)
|
||||
|
||||
このディレクトリは互換のための案内のみ残しています。
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
# Moved: Flow Blocks (Design Draft)
|
||||
|
||||
このドキュメントは再編により移動しました。
|
||||
新しい場所: [../development/design/legacy/flow-blocks.md](../development/design/legacy/flow-blocks.md)
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
# Moved: Using → Loader Integration (Minimal)
|
||||
|
||||
このドキュメントは再編により移動しました。
|
||||
新しい場所: [../development/design/legacy/using-loader-integration.md](../development/design/legacy/using-loader-integration.md)
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
# Examples moved
|
||||
|
||||
例は `docs/guides/examples/` に移動しました。
|
||||
|
||||
- 新しい場所: [../guides/examples/](../guides/examples/)
|
||||
- 代表例: [http_result_patterns.md](../guides/examples/http_result_patterns.md)
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
# Moved: HTTP Result Patterns
|
||||
|
||||
このドキュメントは再編により移動しました。
|
||||
新しい場所: [../guides/examples/http_result_patterns.md](../guides/examples/http_result_patterns.md)
|
||||
|
||||
@ -1,127 +0,0 @@
|
||||
# Nyash Ideas Repository - Post‑Bootstrap 実装アイデア管理
|
||||
|
||||
**目的**: 機能追加ポーズ中に発想されたアイデアをPost‑Bootstrap実装用に整理・保管
|
||||
**原則**: 80/20ルール - 80%実装完了時の「残り20%」+新機能アイデア
|
||||
|
||||
## 📁 フォルダ構造
|
||||
|
||||
### `/tools/` - 開発ツール・支援システム
|
||||
実装優先度順に配置
|
||||
```
|
||||
tools/
|
||||
├── cax/ # C-ABI Explorer (高優先度・世界初)
|
||||
├── macro-debugger/ # マクロ実行デバッガ(Phase 16関連)
|
||||
├── nyash-profiler/ # 実行プロファイラ
|
||||
└── static-analyzer/ # 静的解析ツール
|
||||
```
|
||||
|
||||
### `/language/` - 言語機能拡張
|
||||
設計完了度順に配置
|
||||
```
|
||||
language/
|
||||
├── concurrency/ # 並行性Box (設計完了・docs化済み)
|
||||
├── flow-blocks/ # フロー演算子 (設計完了・docs化済み)
|
||||
├── scope-reuse/ # スコープ演算子 (設計完了・docs化済み)
|
||||
├── pure-functional-blocks.md # []純粋関数型ブロック vs {}通常ブロック (NEW!)
|
||||
├── pattern-matching/ # パターンマッチング拡張
|
||||
├── async-await/ # 非同期構文Sugar
|
||||
└── metaprogramming/ # メタプログラミング機能
|
||||
```
|
||||
|
||||
### `/runtime/` - ランタイム・VM改善
|
||||
技術的重要度順に配置
|
||||
```
|
||||
runtime/
|
||||
├── nyash-self-vm/ # Nyash自己実装VM (ChatGPT提案)
|
||||
├── gc-improvements/ # GC最適化・切替可能性
|
||||
├── jit-enhancements/ # JIT性能向上
|
||||
└── memory-management/ # メモリ管理改善
|
||||
```
|
||||
|
||||
### `/ecosystem/` - エコシステム・統合
|
||||
実用性順に配置
|
||||
```
|
||||
ecosystem/
|
||||
├── python-integration/ # Python統合・transpilation
|
||||
├── vscode-extension/ # VSCode拡張
|
||||
├── package-manager/ # パッケージマネージャ
|
||||
└── documentation-tools/ # ドキュメント自動生成
|
||||
```
|
||||
|
||||
### `/experimental/` - 実験的・研究用アイデア
|
||||
```
|
||||
experimental/
|
||||
├── ai-collaboration/ # AI協働開発手法
|
||||
├── academic-papers/ # 学術発表用実験
|
||||
├── performance-research/ # 性能研究・ベンチマーク
|
||||
└── future-concepts/ # 将来構想・ビジョン
|
||||
```
|
||||
|
||||
## 🎯 管理ルール
|
||||
|
||||
### 新アイデア追加時
|
||||
1. **適切なカテゴリに配置**
|
||||
2. **README.md作成**(概要・優先度・実装見積もり)
|
||||
3. **関連docs更新**(既存設計との統合性確認)
|
||||
|
||||
### 実装着手時
|
||||
1. **Phase移行**: `docs/ideas/` → `docs/development/`
|
||||
2. **実装計画**: ロードマップ・マイルストーン作成
|
||||
3. **ブランチ作成**: `feature/idea-name` で開発開始
|
||||
|
||||
### 完成後
|
||||
1. **docs統合**: 正式ドキュメントに昇格
|
||||
2. **アイデア削除**: または `implemented/` フォルダに移動
|
||||
|
||||
## 📋 現在のアイデア一覧
|
||||
|
||||
### 🔥 高優先度(Post‑Bootstrap 即実装)
|
||||
- **CAX (C-ABI Explorer)**: 革新的デバッグツール(世界初)
|
||||
- **Pure Functional []Blocks**: 純粋関数型ブロック vs 通常{}ブロック (NEW!)
|
||||
- **Nyash Self-VM**: Python/Rust VM統一化
|
||||
- **Flow Blocks**: 設計完了、実装のみ
|
||||
- **Concurrency Boxes**: Go超越の並行性
|
||||
|
||||
### ⭐ 中優先度(Phase 16-17)
|
||||
- **Macro Revolution**: マクロシステム拡張
|
||||
- **Python Integration**: transpilation + 相互運用
|
||||
- **Static Analysis**: 型推論・最適化支援
|
||||
|
||||
### 💡 低優先度(将来構想)
|
||||
- **Package Manager**: エコシステム成熟後
|
||||
- **VSCode Extension**: 言語安定後
|
||||
- **Academic Research**: 発表機会に応じて
|
||||
|
||||
## 🔄 更新プロセス
|
||||
|
||||
### Weekly Review
|
||||
- 新アイデアの整理・分類
|
||||
- 優先度見直し
|
||||
- 重複・統合可能性検討
|
||||
|
||||
### Phase間Review
|
||||
- 実装完了アイデアの整理
|
||||
- 次Phase候補の選定
|
||||
- ロードマップ更新
|
||||
|
||||
## 💭 アイデア品質基準
|
||||
|
||||
### High Quality (即実装候補)
|
||||
- ✅ 技術的実現性: 明確な実装パス
|
||||
- ✅ ユーザー価値: 具体的な問題解決
|
||||
- ✅ Nyash親和性: 箱理論との整合性
|
||||
- ✅ 独創性: 既存ツールにない価値
|
||||
|
||||
### Medium Quality (将来実装)
|
||||
- ✅ 概念明確性: アイデアの核心が明確
|
||||
- ⚠️ 実装詳細: 一部未確定要素あり
|
||||
- ✅ 価値仮説: 実用性の仮説あり
|
||||
|
||||
### Low Quality (要再検討)
|
||||
- ⚠️ 概念曖昧: アイデアが抽象的
|
||||
- ❌ 技術困難: 実装パスが不明確
|
||||
- ❌ 価値不明: 実用性が疑問
|
||||
|
||||
---
|
||||
|
||||
**Note**: このREADMEは、アイデア管理の指針として機能。新アイデア発想時は、必ずここを参照して適切な分類・記録を行う。
|
||||
@ -1,6 +0,0 @@
|
||||
# Proposals Moved
|
||||
|
||||
提案(RFC)は `docs/development/proposals/` に集約しました。
|
||||
|
||||
- 新しい場所: [../development/proposals/](../development/proposals/)
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
# Moved: Concurrency — Box Model (Proposal)
|
||||
|
||||
この提案は再編により移動しました。
|
||||
新しい場所: [../../development/proposals/concurrency/boxes.md](../../development/proposals/concurrency/boxes.md)
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
# Moved: Scope Reuse Blocks (MVP Proposal)
|
||||
|
||||
この提案は再編により移動しました。
|
||||
新しい場所: [../development/proposals/scope-reuse.md](../development/proposals/scope-reuse.md)
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
# Moved: Unified Members Proposal
|
||||
|
||||
この提案は再編により移動しました。
|
||||
新しい場所: [../development/proposals/unified-members.md](../development/proposals/unified-members.md)
|
||||
|
||||
@ -4,9 +4,9 @@ This index points to the currently maintained architectural documents:
|
||||
|
||||
- Core Concepts: reference/architecture/nyash_core_concepts.md
|
||||
- Execution Backends: reference/architecture/execution-backends.md
|
||||
- Lowering Contexts: ../../design/LOWERING_CONTEXTS.md
|
||||
- LLVM Layer Overview: ../../design/LLVM_LAYER_OVERVIEW.md
|
||||
- Lowering Contexts: ../../development/design/legacy/LOWERING_CONTEXTS.md
|
||||
- LLVM Layer Overview: ../../development/design/legacy/LLVM_LAYER_OVERVIEW.md
|
||||
- VM Overview: vm.md
|
||||
- Cranelift AOT design: ../../design/backend-cranelift-aot-design.md
|
||||
- Cranelift AOT design: ../../development/design/legacy/backend-cranelift-aot-design.md
|
||||
|
||||
Note: Some long-form papers reside under `private/papers/reference/architecture/`.
|
||||
|
||||
@ -4,5 +4,5 @@ For the full guide, see:
|
||||
- execution-backends.md (legacy location kept up to date)
|
||||
|
||||
Additional references:
|
||||
- ../../design/backend-llvm-implementation-guide.md
|
||||
- ../../development/design/legacy/backend-llvm-implementation-guide.md
|
||||
- vm.md
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
# Status/Golden moved
|
||||
|
||||
ゴールデン出力などのステータス関連ドキュメントは `docs/development/testing/golden/` へ移動しました。
|
||||
|
||||
- 新しい場所: [../development/testing/golden/](../development/testing/golden/)
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
# Tests moved
|
||||
|
||||
テスト関連のドキュメントは `docs/development/testing/` に移動しました。
|
||||
|
||||
- 新しい場所: [../development/testing/](../development/testing/)
|
||||
|
||||
@ -365,14 +365,8 @@ pub fn using_ast_enabled() -> bool {
|
||||
_ => !using_is_prod(), // dev/ci → true, prod → false
|
||||
}
|
||||
}
|
||||
pub fn resolve_fix_braces() -> bool {
|
||||
// Safer default: OFF(誤補正の副作用を避ける)
|
||||
// 明示ON: NYASH_RESOLVE_FIX_BRACES=1
|
||||
matches!(
|
||||
std::env::var("NYASH_RESOLVE_FIX_BRACES").ok().as_deref(),
|
||||
Some("1") | Some("true") | Some("on")
|
||||
)
|
||||
}
|
||||
// Legacy resolve_fix_braces() removed (Phase 15 cleanup)
|
||||
// AST-based integration handles syntax properly without text-level brace fixing
|
||||
pub fn vm_use_py() -> bool {
|
||||
std::env::var("NYASH_VM_USE_PY").ok().as_deref() == Some("1")
|
||||
}
|
||||
|
||||
@ -32,53 +32,5 @@ pub fn log_prelude_body_seam(prelude_clean: &str, body: &str, seam_dbg: bool) {
|
||||
eprintln!("[using][seam] body_head =<<<{}>>>", head.replace('\n', "\\n"));
|
||||
}
|
||||
|
||||
/// Apply optional seam safety: append missing '}' for unmatched '{' in prelude
|
||||
/// When `trace` is true, emits a short note with delta count.
|
||||
pub fn fix_prelude_braces_if_enabled(prelude_clean: &str, combined: &mut String, trace: bool) {
|
||||
if !crate::config::env::resolve_fix_braces() {
|
||||
return;
|
||||
}
|
||||
// compute { } delta ignoring strings and comments
|
||||
let mut delta: i32 = 0;
|
||||
let mut it = prelude_clean.chars().peekable();
|
||||
let mut in_str = false;
|
||||
let mut in_sl = false;
|
||||
let mut in_ml = false;
|
||||
while let Some(c) = it.next() {
|
||||
if in_sl {
|
||||
if c == '\n' { in_sl = false; }
|
||||
continue;
|
||||
}
|
||||
if in_ml {
|
||||
if c == '*' {
|
||||
if let Some('/') = it.peek().copied() {
|
||||
it.next();
|
||||
in_ml = false;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if in_str {
|
||||
if c == '\\' { it.next(); continue; }
|
||||
if c == '"' { in_str = false; }
|
||||
continue;
|
||||
}
|
||||
if c == '"' { in_str = true; continue; }
|
||||
if c == '/' {
|
||||
match it.peek().copied() {
|
||||
Some('/') => { in_sl = true; it.next(); continue; }
|
||||
Some('*') => { in_ml = true; it.next(); continue; }
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
if c == '{' { delta += 1; }
|
||||
if c == '}' { delta -= 1; }
|
||||
}
|
||||
if delta > 0 {
|
||||
if trace { eprintln!("[using][seam] fix: appending {} '}}' before body", delta); }
|
||||
for _ in 0..delta {
|
||||
combined.push('}');
|
||||
combined.push('\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
// Legacy brace fix function removed (Phase 15 cleanup)
|
||||
// AST-based integration handles syntax errors properly without text-level hacks
|
||||
|
||||
@ -12,7 +12,7 @@ impl NyashRunner {
|
||||
Ok(s) => s,
|
||||
Err(e) => { eprintln!("❌ Error reading file {}: {}", filename, e); process::exit(1); }
|
||||
};
|
||||
// Using preprocessing (legacy inline or AST-prelude merge when NYASH_USING_AST=1)
|
||||
// Using preprocessing with AST-prelude merge (when NYASH_USING_AST=1)
|
||||
let mut code2 = code;
|
||||
let use_ast_prelude = crate::config::env::enable_using()
|
||||
&& crate::config::env::using_ast_enabled();
|
||||
|
||||
61
tools/smokes/v2/profiles/quick/core/json_errors_ast.sh
Normal file
61
tools/smokes/v2/profiles/quick/core/json_errors_ast.sh
Normal file
@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
# json_errors_ast.sh - JSON error cases via AST using
|
||||
|
||||
source "$(dirname "$0")/../../../lib/test_runner.sh"
|
||||
require_env || exit 2
|
||||
preflight_plugins || exit 2
|
||||
|
||||
TEST_DIR="/tmp/json_errors_ast_$$"
|
||||
mkdir -p "$TEST_DIR"
|
||||
cd "$TEST_DIR"
|
||||
|
||||
cat > nyash.toml << EOF
|
||||
[using.json_native]
|
||||
path = "$NYASH_ROOT/apps/lib/json_native/"
|
||||
main = "parser/parser.nyash"
|
||||
|
||||
[using.aliases]
|
||||
json = "json_native"
|
||||
EOF
|
||||
|
||||
cat > driver.nyash << 'EOF'
|
||||
using json_native as JsonParserModule
|
||||
|
||||
static box Main {
|
||||
main() {
|
||||
local bad = new ArrayBox()
|
||||
bad.push("{")
|
||||
bad.push("[1,2,,3]")
|
||||
bad.push("{\"a\" 1}")
|
||||
bad.push("{\"a\":}")
|
||||
|
||||
local i = 0
|
||||
loop(i < bad.length()) {
|
||||
local s = bad.get(i)
|
||||
local parser = JsonParserModule.create_parser()
|
||||
local res = parser.parse(s)
|
||||
if parser.has_errors() or res == null {
|
||||
print("ERR")
|
||||
} else {
|
||||
print("OK")
|
||||
}
|
||||
i = i + 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
expected=$(cat << 'TXT'
|
||||
ERR
|
||||
ERR
|
||||
ERR
|
||||
ERR
|
||||
TXT
|
||||
)
|
||||
|
||||
output=$("$NYASH_BIN" --backend vm driver.nyash 2>&1 | filter_noise)
|
||||
compare_outputs "$expected" "$output" "json_errors_ast"
|
||||
|
||||
cd /
|
||||
rm -rf "$TEST_DIR"
|
||||
54
tools/smokes/v2/profiles/quick/core/json_nested_ast.sh
Normal file
54
tools/smokes/v2/profiles/quick/core/json_nested_ast.sh
Normal file
@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
# json_nested_ast.sh - Nested arrays/objects roundtrip via AST using
|
||||
|
||||
source "$(dirname "$0")/../../../lib/test_runner.sh"
|
||||
require_env || exit 2
|
||||
preflight_plugins || exit 2
|
||||
|
||||
TEST_DIR="/tmp/json_nested_ast_$$"
|
||||
mkdir -p "$TEST_DIR"
|
||||
cd "$TEST_DIR"
|
||||
|
||||
cat > nyash.toml << EOF
|
||||
[using.json_native]
|
||||
path = "$NYASH_ROOT/apps/lib/json_native/"
|
||||
main = "parser/parser.nyash"
|
||||
|
||||
[using.aliases]
|
||||
json = "json_native"
|
||||
EOF
|
||||
|
||||
cat > driver.nyash << 'EOF'
|
||||
using json_native as JsonParserModule
|
||||
|
||||
static box Main {
|
||||
main() {
|
||||
local samples = new ArrayBox()
|
||||
samples.push("[1,[2,3],{\"x\":[4]}]")
|
||||
samples.push("{\"a\":{\"b\":[1,2]},\"c\":\"d\"}")
|
||||
samples.push("{\"n\":-1e-3,\"z\":0.0}")
|
||||
|
||||
local i = 0
|
||||
loop(i < samples.length()) {
|
||||
local s = samples.get(i)
|
||||
local r = JsonParserModule.roundtrip_test(s)
|
||||
print(r)
|
||||
i = i + 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
expected=$(cat << 'TXT'
|
||||
[1,[2,3],{"x":[4]}]
|
||||
{"a":{"b":[1,2]},"c":"d"}
|
||||
{"n":-1e-3,"z":0.0}
|
||||
TXT
|
||||
)
|
||||
|
||||
output=$("$NYASH_BIN" --backend vm driver.nyash 2>&1 | filter_noise)
|
||||
compare_outputs "$expected" "$output" "json_nested_ast"
|
||||
|
||||
cd /
|
||||
rm -rf "$TEST_DIR"
|
||||
@ -9,8 +9,17 @@ TEST_DIR="/tmp/json_roundtrip_ast_$$"
|
||||
mkdir -p "$TEST_DIR"
|
||||
cd "$TEST_DIR"
|
||||
|
||||
cat > nyash.toml << EOF
|
||||
[using.json_native]
|
||||
path = "$NYASH_ROOT/apps/lib/json_native/"
|
||||
main = "parser/parser.nyash"
|
||||
|
||||
[using.aliases]
|
||||
json = "json_native"
|
||||
EOF
|
||||
|
||||
cat > driver.nyash << 'EOF'
|
||||
using "apps/lib/json_native/parser/parser.nyash" as JsonParserModule
|
||||
using json_native as JsonParserModule
|
||||
|
||||
static box Main {
|
||||
main() {
|
||||
@ -61,7 +70,7 @@ false
|
||||
TXT
|
||||
)
|
||||
|
||||
output=$(run_nyash_vm driver.nyash)
|
||||
output=$("$NYASH_BIN" --backend vm driver.nyash 2>&1 | filter_noise)
|
||||
compare_outputs "$expected" "$output" "json_roundtrip_ast"
|
||||
|
||||
cd /
|
||||
|
||||
Reference in New Issue
Block a user