dua 0.0.1
A lightweight embeddable scripting language runtime implemented in D.
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
Dua
Dua は、D 言語アプリケーションへ組み込み可能な軽量スクリプトランタイムです。
このリポジトリでは、字句解析・構文解析・AST・実行エンジンまでを source/dua 以下に実装しています。
特徴
- D から簡単に埋め込める
Dua.ScriptEngineAPI - 値の橋渡しを行う
Dua.Value(数値、文字列、配列、テーブル、関数など) run/runSafe,load/loadSafe,runFile/runFileSafe,loadFile/loadFileSafeによる実行導線bind/bindNativeによる D 側データと関数の公開bindAuto/engine["name"] = valueによる自動変換バインド(aggregate は reflect)registerModule+require(...)によるモジュール読み込みRunOutcomeによるエラー情報とスタックトレース取得
クイックスタート
1. ビルド
dub build --compiler=ldc2
2. 実行
dub run --compiler=ldc2
3. 最小埋め込み例
import dua;
import std.stdio;
void main()
{
auto engine = new Dua.ScriptEngine();
engine.bind("base", Dua.Value.from(10));
engine.bindNative("add", (scope const(Dua.Value)[] args) {
return Dua.Value.from(args[0].toInt() + args[1].toInt());
});
auto result = engine.run(q{
let v = add(base, 5);
return v;
});
writeln(result.toInt()); // 15
}
ドキュメント
公開向けドキュメントは docs/ に整理しています。
リポジトリ構成
source/dua/lexer.d: Lexersource/dua/parser.d: Parsersource/dua/ast.d: AST 定義source/dua/runtime.d: Script 実行エンジンsource/dua/value.d: 値モデルと相互変換source/dua/package.d: 公開ファサード(module dua)
開発者向け
dub test --compiler=ldc2
CI を導入する場合も、まずこの 2 コマンド(build / test)を通す運用を推奨します。
- 0.0.1 released 27 days ago
- Zero-error-no-warning/Dua
- github.com/Zero-error-no-warning/Dua
- MIT
- Copyright (c) 2026 Zenw
- Authors:
- Dependencies:
- none
- Versions:
-
Show all 3 versions0.0.1 2026-Apr-19 ~main 2026-Apr-21 ~codex/implement-interpolation-expression-sequence 2026-Apr-21 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
5 downloads this month
-
5 downloads total
-
- Score:
- 0.1
- Short URL:
- dua.dub.pm