- nyash.tomlからすべての.so拡張子を削除 - plugin_loader_v2のresolve_library_pathが自動的に適切な拡張子を追加 - Linux: .so - Windows: .dll - macOS: .dylib - クロスプラットフォーム対応の準備完了
9.8 KiB
9.8 KiB
🐱 Nyash プログラミング言語
超真面目に作っている趣味言語
20日でゼロからネイティブバイナリへ - AI駆動の言語革命
🎮 今すぐブラウザでNyashを試そう!
👉 ブラウザプレイグラウンドを起動 👈
インストール不要 - ウェブブラウザで即座にNyashを体験!
🚀 速報: ネイティブEXE達成!
2025年8月29日 - 誕生からわずか20日で、Nyashがネイティブ実行ファイルへのコンパイルを実現!
# Nyashソースからネイティブバイナリへ(Craneliftが必要)
cargo build --release --features cranelift-jit
./tools/build_aot.sh program.nyash -o app # ネイティブEXE
./app # スタンドアロン実行!
20日間で達成したこと:
- ✅ インタープリター付き完全プログラミング言語
- ✅ 13.5倍高速化を実現したVM
- ✅ JITコンパイラ(Cranelift統合)
- ✅ WebAssemblyサポート
- ✅ プラグインシステム(C ABI)
- ✅ ネイティブバイナリ生成
- ✅ プラグイン経由のPython統合
✨ なぜNyashなのか?
🎯 Everything is Box 哲学
// 従来の言語は複雑な型システムを持つ
// Nyash: 一つの概念がすべてを支配する - Box
static box Main {
main() {
// すべての値はBox - 統一、安全、シンプル
local name = new StringBox("Nyash")
local count = new IntegerBox(42)
local data = new MapBox()
// PythonオブジェクトもBox!
local py = new PyRuntimeBox()
local math = py.import("math")
print("sqrt(9) = " + math.getattr("sqrt").call(9).str())
return 0
}
}
⚡ 前例のない開発速度
- 1日目: 基本インタープリター動作
- 4日目: すでにJIT計画開始
- 13日目: VMが13.5倍高速化達成
- 20日目: ネイティブ実行ファイル生成!
🔌 プラグインファースト・アーキテクチャ
// あらゆる機能がプラグインBoxになれる
local file = new FileBox() // ファイルI/Oプラグイン
local http = new HttpClientBox() // ネットワークプラグイン
local py = new PyRuntimeBox() // Pythonプラグイン
// プラグインもネイティブコードにコンパイル!
🏗️ 複数の実行モード
1. インタープリターモード (開発用)
./target/release/nyash program.nyash
- 即座に実行
- 完全なデバッグ情報
- 開発に最適
2. VMモード (本番用)
./target/release/nyash --backend vm program.nyash
- インタープリターより13.5倍高速
- 最適化されたバイトコード実行
- 本番環境対応のパフォーマンス
3. JITモード (高性能)
NYASH_JIT_EXEC=1 ./target/release/nyash --backend vm program.nyash
- Cranelift搭載JITコンパイル
- ほぼネイティブ性能
- ホット関数最適化
4. ネイティブバイナリ (配布用)
# 事前ビルド(Cranelift)
cargo build --release --features cranelift-jit
./tools/build_aot.sh program.nyash -o myapp
./myapp # スタンドアロン実行!
- 依存関係ゼロ
- 最高性能
- 簡単配布
簡易スモークテスト(VM と EXE の出力一致確認):
tools/smoke_aot_vs_vm.sh examples/aot_min_string_len.nyash
5. WebAssembly (ブラウザ用)
cargo build --release --features wasm-backend
./target/release/nyash --compile-wasm program.nyash
- ブラウザで実行
- デフォルトでクロスプラットフォーム
- Webファースト開発
📊 パフォーマンスベンチマーク
実世界ベンチマーク結果 (ny_bench.nyash):
モード | 時間 | 相対速度
----------------|-----------|---------------
インタープリター | 110.10ms | 1.0x (基準)
VM | 8.14ms | 13.5倍高速
VM + JIT | 5.8ms | 19.0倍高速
ネイティブ | ~4ms | ~27倍高速
🎮 言語機能
クリーンな構文
box GameCharacter {
private { name, health, skills }
// birthコンストラクタ - Boxに生命を与える!
birth(characterName) {
me.name = characterName
me.health = 100
me.skills = new ArrayBox()
print("🌟 " + characterName + " が誕生しました!")
}
learnSkill(skill) {
me.skills.push(skill)
return me // メソッドチェーン
}
}
// 使用例
local hero = new GameCharacter("ネコ")
hero.learnSkill("火魔法").learnSkill("回復")
モダンなAsync/Await
// シンプルな並行処理
nowait task1 = fetchDataFromAPI()
nowait task2 = processLocalFiles()
// 待機中に他の作業
updateUI()
// 結果収集
local apiData = await task1
local files = await task2
デリゲーションパターン
// 継承よりコンポジション
box EnhancedArray from ArrayBox {
private { logger }
override push(item) {
me.logger.log("追加中: " + item)
from ArrayBox.push(item) // 親に委譲
}
}
🔌 プラグインシステム
Nyashは「Everything is Plugin」アーキテクチャを開拓:
# nyash.toml - プラグイン設定
[libraries."libnyash_python_plugin.so"]
boxes = ["PyRuntimeBox", "PyObjectBox"]
[libraries."libnyash_net_plugin.so"]
boxes = ["HttpServerBox", "HttpClientBox", "WebSocketBox"]
C/Rustで独自のBox型を作成してシームレスに統合!
🛠️ はじめる
クイックインストール (Linux/Mac/WSL)
# クローンとビルド
git clone https://github.com/moe-charm/nyash.git
cd nyash
cargo build --release --features cranelift-jit
# 最初のプログラムを実行
echo 'print("Hello Nyash!")' > hello.nyash
./target/release/nyash hello.nyash
Windows
# Windows向けクロスコンパイル
cargo install cargo-xwin
cargo xwin build --target x86_64-pc-windows-msvc --release
# target/x86_64-pc-windows-msvc/release/nyash.exe を使用
# WindowsでのネイティブEXE(AOT)ビルド(Cranelift と MSYS2/WSL が必要)
cargo build --release --features cranelift-jit
powershell -ExecutionPolicy Bypass -File tools\build_aot.ps1 -Input examples\aot_min_string_len.nyash -Out app.exe
./app.exe
🌟 独自のイノベーション
1. AI駆動開発
- Claude、ChatGPT、Codexの協力で開発
- コンセプトからネイティブコンパイルまで20日間の旅
- AIが言語開発を30倍加速できることを証明
2. Box-Firstアーキテクチャ
- すべての最適化がBox抽象を保持
- プラグインもBox、JITもBoxを保持、ネイティブコードもBoxを尊重
- すべての実行モードで前例のない一貫性
3. 観測可能な設計
- 組み込みのデバッグとプロファイリング
- JITコンパイルのJSONイベントストリーム
- 最適化のDOTグラフ可視化
📚 例
Python統合
// NyashからPythonライブラリを使用!
local py = new PyRuntimeBox()
local np = py.import("numpy")
local array = np.getattr("array").call([1, 2, 3])
print("NumPy配列: " + array.str())
Webサーバー
local server = new HttpServerBox()
server.start(8080)
loop(true) {
local request = server.accept()
local response = new HttpResponseBox()
response.setStatus(200)
response.write("Nyashからこんにちは!")
request.respond(response)
}
ゲーム開発
box GameObject {
public { x, y, sprite }
update(deltaTime) {
// 物理シミュレーション
me.y = me.y + gravity * deltaTime
}
render(canvas) {
canvas.drawImage(me.sprite, me.x, me.y)
}
}
🤝 貢献
革命に参加しよう!以下を歓迎します:
- 🐛 バグ報告と修正
- ✨ プラグイン経由の新しいBox型
- 📚 ドキュメントの改善
- 🎮 クールなサンプルプログラム
📄 ライセンス
MIT ライセンス - プロジェクトで自由に使用してください!
👨💻 作者
charmpic - 趣味で言語作ってる人
- 🐱 GitHub: @moe-charm
- 🌟 協力: Claude、ChatGPT、Codexとのコラボレーション
🎉 歴史的タイムライン
- 2025年8月9日: 最初のコミット - "Hello Nyash!"
- 2025年8月13日: JIT計画開始(4日目!)
- 2025年8月20日: VMが13.5倍性能達成
- 2025年8月29日: ネイティブEXEコンパイル実現!
ゼロからネイティブバイナリまで20日間 - 言語開発の新記録!
🚀 Nyash - すべてがBoxであり、Boxがネイティブコードにコンパイルされる場所!
❤️、🤖 AIコラボレーション、そしてプログラミング言語は思考の速度で作れるという信念で構築