simple-mcp-server について
simple-mcp-server は Simple 言語ツールチェーン向けの MCP ツールを提供し、Simple プロジェクトの開発者を対象とします。タグラインに示されている機能は、コードインテリジェンス、デバッグ、ビルド、テスト、バージョン管理です。
主な機能
- 01コードインテリジェンス
- 02デバッグツール
- 03ビルドとテスト操作
- 04バージョン管理ツール
活用シーン
- 01エージェントによる Simple コードの確認
- 02Simple プロジェクトのデバッグ
- 03コードのビルドとテスト
- 04コーディングワークフローでのバージョン管理操作
MCP 対応
タグラインでは、コードインテリジェンス、デバッグ、ビルド、テスト、バージョン管理ツールを提供する MCP サーバーとされています。提供された README に個々の MCP ツールの詳細はありません。
設定
ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。
ツール
ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。
詳細
Simple 言語
Simple は、読みやすい Python 風の表層構文に、コンパイラー統合テスト、ドキュメント、アーキテクチャ規則、ベアメタル向けの実行経路を組み合わせた、セルフホスト可能な言語およびツールチェーンです。
このリポジトリの対象範囲は非常に広く、言語、コンパイラー、インタープリター、ローダー、テストランナー、ドキュメント生成、トレーサビリティツール、SDN ベースのプロジェクトデータベース、エディターツール、ハードウェア向けテストフローがすべて揃っています。
クイックナビゲーション: 特徴的な機能 | 機能のステータス | クイックスタート | 言語の基礎 | 例 | エディタープラグイン | ドキュメント
特徴的な機能
- セルフホスト型の段階的ツールチェーン:フロントエンド、型解析、借用チェック、バックエンド、ドライバー、インタープリター、ローダーの実際のソースレイヤーがリポジトリ内にあります。
- 検証を中核とするワークフロー:SSpec テスト、SPipe ランナー/ドキュメント生成プロセス、実行可能なドキュメントである SDoctest、カバレッジ、トレーサビリティチェック、生成された仕様ドキュメントが、後付けではなくツールチェーンの一部になっています。
- MDSOC アーキテクチャのサポート:仮想カプセル、マニフェスト、アーキテクチャを考慮したリポジトリ構造を第一級の概念として扱います。
- パーサーに適したマクロシステム:マクロの定義、展開、検証、衛生性は、エディターに扱いにくいテキスト置換ではなく、コンパイラーの機能です。
- 数式向け構文ブロック:
m{}、loss{}、nograd{}は、パース、評価、5 種類のレンダリングバックエンド(テキスト、デバッグ、Unicode、LaTeX、Markdown)、エディター統合(query/LSP ホバー、VSCode のハイライト/プレビュー、Neovim の conceal によるインライン Unicode プレビュー)を備えた実装済みの構文です。torch を利用する C/LLVM の対象範囲では、自動微分の経路が完成しています。 - SDN ベースのテキストデータベース:テスト、TODO、ダッシュボード、その他のプロジェクトメタデータは、リポジトリ標準の SDN データフローを通じて保存されます。
- 複数の実行経路:インタープリター、ローダー、SMF/モジュールの読み込み、ネイティブ/LLVM 向けコンパイル経路が、1 つのシステム内で共存します。
- ベアメタル向けビルド/テスト基盤:QEMU、セミホスティング、MMIO メールボックス、リモートベアメタルのフロー、アダプターを利用するハードウェアレーン(正式なものは 8 つ)が、リポジトリに組み込まれています。
- ツールを考慮した言語規則:Tree-sitter 統合、プリミティブなパブリック API のリンティング、トレーサビリティツール、言語統計がプラットフォームの一部です。
- サポート対象の各サーフェスで共有する UI コントラクト:1 つの HTTP ベースのテストプロトコル(Protocol V1)と
UITestClientが、共有のhandle_test_requestハンドラーを通じて、Web バックエンドと TUI-Web プロキシの両方を制御します。これは、サーフェス間のコントラクトテストスイートで検証されています。コントラクト:doc/04_architecture/shared_ui_contract.md
機能のステータス(概要)
実装済みで、安全に紹介できる機能:
- SSpec テスト、SPipe ランナー/ドキュメント生成、SDoctest、カバレッジ、トレーサビリティチェック、生成された仕様ドキュメント
- SPipe のモックポリシー:システムテストでのモック禁止、HAL 専用モード、カスタムパターンモード
- セルフホスト型の段階的コンパイラー、インタープリター、ローダーのアーキテクチャ
- MDSOC マニフェストとアーキテクチャ重視のプロジェクト構成
- 検証機能と衛生管理を備えた、パーサーに適したマクロ
- Tree-sitter によるアウトライン/クエリツール
- SDN を基盤とするプロジェクト、テスト、TODO データベース
- プリミティブな公開 API のリンティングと、セマンティックラッパー/単位型のパターン
- 借用チェックの基盤
- ウォッチモードと自動ビルドのサポート
- mmap を基盤とするローダーのサポートと、実行可能メモリーの配線
- ベアメタルのビルド/テストの配線と、ホストを考慮したリモートベアメタルのフロー
- サポート対象 ABI サブセットにおける C/C++ 双方向 SFFI:エクスポート、インポート、コールバックトランポリン、レイアウト検証、ラウンドトリップ証明テスト
実装済みですが、条件を明示して紹介するのが適切な機能:
- LLVM の全ファミリー対応範囲は、宣言済みの公開マトリックスについて完了しています。すべての
llvm-libとllvmバックエンドの行が明示的にstableまたはunsupportedとなり、曖昧な中間状態はありません。rust-llvmは公開ファミリーの主張の対象外で、ブートストラップ専用のシードパスとして残っています - Lean 検証ワークフローは、サポート対象の検証サブセットについて完了しています。決定的な Lean 生成、証明アーティファクトの一覧化、Lean/Lake によるチェック、キャッシュの無効化、検証状態のレポートに対応しています。契約:doc/04_architecture/lean_verification_contract.md。レポート:doc/09_report/lean_verification_complete_2026-04-04.md
- GC および no-GC ランタイムファミリー:5 つの公開ファミリー(
common、nogc_sync_mut、nogc_async_mut、gc_async_mut、nogc_async_mut_noalloc)に対応し、コンパイラー境界での適用、インタープリターの警告、ターゲットプリセットのマッピングを備えています。サポートマトリックス:doc/04_architecture/runtime_family_support_matrix.md - Web バックエンドと TUI-web プロキシ間で UI 契約を共有(Protocol V1):共有ハンドラー、構造化エラーモデル、安定した要素 ID、サーフェス間の契約テストスイートに対応しています。ただし、これは共有テストプロトコルであり、統一された UI レンダリングレイヤー全体ではありません
- リモートベアメタル実行には、信頼できる 8 つのレーン(安定版 3 つ、ホストを考慮したもの 5 つ。GHDL セミホスティングとメールボックスシミュレーションの両方を含む)があります。ただし、ハードウェアに依存するレーンは、どこでも一律に完了しているのではなく、ホストとボードに応じた対応となります。レーンマトリックス:doc/08_tracking/lane_matrix.md
範囲を限定して実装済みの機能:
m{}/loss{}/nograd{}は、torch を基盤とする昇格済みの C/LLVM 範囲で完了しています。逆伝播、切り離された入力に対する失敗、nograd{}の復元セマンティクスを含みます。他のバックエンドは引き続き後回しです- AOP は、述語ベースのポイントカット(
execution、within、attr)、決定的な before/after/around アドバイス、デフォルトのコンパイル時ウィービングバックエンド、スコープ付きランタイムインターセプトを提供します。サポートマトリックス:doc/05_design/aop_support_matrix.md - VHDL バックエンドは、文書化されたハードウェア向け Simple サブセットを、合成可能な VHDL-2008 にコンパイルし、GHDL の解析/エラボレーションを通じて検証します。サポート対象外の構文は厳格に即時失敗します。2 つの GHDL RV32 シミュレーションレーンが稼働しています:セミホスト(GDB ベース、ARM セミホスティングトラップ)とメールボックス(デバッガー不要、0x80FF0000 の MMIO と ram_sentinel による結果収集)。サポートマトリックス:doc/04_architecture/vhdl_support_matrix.md。メールボックスプロトコル:doc/04_architecture/ghdl_rv32_mailbox_protocol.md 実装済み:
- ダミー/スタブの禁止は、主要なソースおよびコンパイル済み CLI のサーフェス(
simple lint、simple verify quality)で有効です。公開向けのすべての証明スイート(SFFI、T32 ハードウェア、コンパイラー/ランタイム/システム)がゲートを通過します。残る課題は、先送りされた OS/GPU/実験的な領域のみであり、アクティブなサーフェスはすべてクリーンです。
証拠に基づく監査については、doc/report/unique_features.md を参照してください。
ランタイムファミリー
Simple では、割り当て、変更、並行処理の要件に基づいて、標準ライブラリーをランタイムファミリーに分類しています。
| ファミリー | 割り当て | 変更 | 非同期 | 用途 |
|---|---|---|---|---|
common | ヒープ(デフォルト) | 不変 | いいえ | 純粋関数、数学、テキスト、エンコーディング |
nogc_sync_mut | ヒープ/アリーナ/プール | 可変 | いいえ | ファイル I/O、ネットワーク、FFI、データベース |
nogc_async_mut | ヒープ | 可変 | はい | 非同期 I/O、スレッド、アクター、ジェネレーター |
gc_async_mut | GC 管理 | 可変 | はい | GPU/CUDA、ML パイプライン |
nogc_async_mut_noalloc | スタックのみ | 可変 | はい | ベアメタル、組み込み、RTOS |
コンパイラーはファミリーの境界を強制します。GC なしのコンテキストから GC モジュールをインポートすると、診断警告が表示されます。ターゲットプリセット(Baremetal、Hosted、EmbeddedWithHeap)は、互換性のあるファミリーだけにモジュール解決を自動的に制限します。
高度な用途には、ロックフリー並行処理に対応した永続データ構造を提供する nogc_async_immut があります。
契約の詳細についてはランタイムファミリー対応マトリクスを、現在の注意点については既知の制限事項を参照してください。
クイックスタート
インストール
含まれるもの:
- Simple コンパイラーとツールチェーンの完全なソース
- 標準ライブラリーと生成済みの仕様マニュアル
- MCP サーバー、LSP、デバッガーの各サーフェスを含む開発ツール
現在のベータ版では、ソースをチェックアウトしてください。ドキュメントとテストで使われるサンプルおよびツールのサブモジュールも初期化されます:
git clone --recurse-submodules https://github.com/ormastes/simple.git
cd simple
export PATH="$PWD/bin:$PATH"
simple --version
既存のチェックアウトの場合:
git submodule sync --recursive
git submodule update --init --recursive
注: Rust はブートストラップの種およびホスト基盤として引き続き存在します。リポジトリで表現できる製品コンパイラー、ライブラリー、ツールの開発作業は Simple ソースで行ってください。「純粋な Simple」とは、現時点でこのチェックアウトに Rust ソースが存在しないという意味ではありません。
ソースの規模
既存の追跡対象である .spl、.rs、.c、.h、.s、.S、.asm ファイルから、2026-04-23 に生成したスナップショットです。空行とコメントのみの行は除外しています。examples/ のコードは含め、ベンダー提供およびサードパーティーのソースは除外しています。
| 言語 | ファイル数 | コメントを除く LOC | src/ LOC | examples/ LOC | test/ LOC | その他の LOC |
|---|---|---|---|---|---|---|
| Simple | 13,286 | 1,780,334 | 887,121 | 158,796 | 712,254 | 22,163 |
| Rust | 1,633 | 411,106 | 409,852 | 11 | 0 | 1,243 |
| C | 158 | 73,854 | 14,953 | 58,859 | 36 | 6 |
| アセンブリ | 60 | 4,758 | 1,554 | 3,173 | 31 | 0 |
| 合計 | 15,137 | 2,270,052 | 1,313,480 | 220,839 | 712,321 | 23,412 |
ソースからのビルド(開発者のみ)
ランタイムを変更する場合にのみ必要です:
scripts/setup/setup.shs
bin/simple build bootstrap
ラッパーの内部で実行される直接コマンド:
src/compiler_rust/target/bootstrap/simple --version
bin/simple build bootstrap
sha256sum bootstrap/simple_stage2 bootstrap/simple_stage3
現在のブートストラップの流れと、残っている純粋な Simple によるセルフホスティングのメモについては、doc/02_requirements/app/build/bootstrap.md および doc/03_plan/compiler/bootstrap/pure_simple_bootstrap_stage2_remaining_2026-05-04.md を参照してください。
GPU サポートを有効にしたビルド
simple build --release --features=vulkan
最初のプログラム
# hello.spl
>>> fn main() -> i64:
... 0 # Entry point, returns exit code
# Run it
simple hello.spl
echo $? # Prints: 0
CLI の使い方
simple コマンドは Python のように動作します:
Usage:
simple Start interactive REPL
simple <file.spl> Run source file
simple <file.smf> Run compiled binary
simple -c "code" Run code string; statement snippets print only program output
simple compile <src> [-o <out>] Compile to SMF
simple watch <file.spl> Watch and auto-recompile
Build System (Self-Hosting):
simple build Build the project (debug)
simple build --release Release build (optimized)
simple build --bootstrap Bootstrap build (minimal 9.3MB)
simple build test Run all tests
simple build coverage Generate coverage reports
simple build lint Run linter (clippy)
simple build fmt Format code (rustfmt)
simple build check Run all quality checks
simple build clean Clean build artifacts
simple build --help Show all build options
Options:
-h, --help Show help
-v, --version Show version
-c <code> Run code string
--gc-log Enable verbose GC logging
--gc=off Disable garbage collection
例
# Interactive REPL
simple
>>> 1 + 2
3
>>> x = 10
>>> x * 5
50
>>> exit
# Run a program
echo "main = 42" > hello.spl
simple hello.spl
echo $? # Exit code: 42
# Compile to binary
simple compile hello.spl
simple hello.smf # Run the compiled binary
# Watch mode (auto-recompile on changes)
simple watch app.spl
言語の基礎
変数と型
# Variables - immutable by default, mutable with var
>>> x = 10
>>> x
10
>>> var y = 20
>>> y
20
>>> PI = 3.14159
>>> PI
3.14159
# Type inference works automatically
>>> count = 100
>>> count
100
# Basic types inferred
>>> a = 42
>>> a
42
>>> pi = 3.14159
>>> flag = true
>>> flag
true
# String interpolation default
>>> name = "world"
>>> msg = "Hello, {name}!"
>>> print msg
Hello, world!
制御フロー
# If/else with indentation
>>> var x = 5
>>> if x > 0:
... print "positive"
... elif x < 0:
... print "negative"
... else:
... print "zero"
positive
# Loops
>>> for i in 0..3:
... print i
0
1
2
>>> while x > 3:
... x = x - 1
>>> x
3
関数
>>> fn add(a: i64, b: i64) -> i64:
... a + b # Implicit return
>>> fn greet(greeting: text):
... print "Hello, {greeting}!"
# Function calls
>>> sum = add(1, 2)
>>> sum
3
>>> greet("Alice")
Hello, Alice!
# Lambdas with backslash
>>> double = \x: x * 2
>>> nums = [1, 2, 3, 4, 5]
>>> evens = nums.filter(\x: x % 2 == 0)
>>> evens
[2, 4]
構造体とクラス
# Structs (value types)
struct Point:
x: f64
y: f64
p = Point(x: 1.0, y: 2.0)
# Classes (reference types)
class Person:
name: text
age: i64
fn greet():
print "Hi, {self.name}!"
alice = Person(name: "Alice", age: 30)
alice.greet()
コレクション
# Arrays - short form (no val)
>>> nums = [1, 2, 3, 4, 5]
>>> first = nums[0]
>>> first
1
# Collection methods
>>> count = nums.len()
>>> count
5
# Dictionary (short form)
>>> scores = {"alice": 100, "bob": 85}
>>> alice_score = scores["alice"]
>>> alice_score
100
# Filter with lambda
>>> odds = nums.filter(\x: x % 2 == 1)
>>> odds
[1, 3, 5]
>>> big_nums = nums.filter(\x: x > 3)
>>> big_nums
[4, 5]
# Tuples
>>> pair = (1, "hello")
>>> num = pair.0
>>> num
1
>>> msg = pair.1
>>> msg
"hello"
# List comprehensions
>>> squared = [x * x for x in 0..5]
>>> squared
[0, 1, 4, 9, 16]
>>> evens = [x for x in nums if x % 2 == 0]
>>> evens
[2, 4]
単位型(後置リテラル)
型安全な単位により、互換性のない値を混在させずに済みます:
# Define measurement unit families with postfix syntax
unit length(base: f64):
mm = 0.001, cm = 0.01, m = 1.0, km = 1000.0
unit velocity(base: f64) = length / time:
mps = 1.0, kmph = 0.2777777777777778, mph = 0.44704
# The standards-backed catalog records km/h canonically as kilometre / hour
# with exact factor 5/18 relative to m/s.
# Define nominal wrappers with postfix syntax
newunit UserId: i64 as uid
newunit OrderId: i64 as oid
# Usage with postfix literals
height = 175_cm # Length type
width = 10_cm + 5_mm # Auto-converts to same base
speed = 200_kmph # Velocity type
distance = 42_km # Length type
# Type safety - compile error:
# bad = height + speed # Error: can't add Length + Velocity
# Semantic IDs prevent mix-ups
user = 42_uid # UserId
order = 100_oid # OrderId
# wrong: UserId = 100_oid # Error: OrderId ≠ UserId
# Computed units
travel_time = distance / speed # Returns Time type
print("ETA: {travel_time.to_min()} minutes")
パターンマッチング
enum Shape:
Circle(radius: f64)
Rectangle(width: f64, height: f64)
Square(side: f64)
Triangle(base: f64, height: f64)
# Pattern matching with case syntax
fn area(s: Shape) -> f64:
match s:
case Circle(r):
3.14159 * r * r # Implicit return
case Rectangle(w, h):
w * h
case Square(side):
side * side
case Triangle(b, h):
0.5 * b * h
# Preferred arrow syntax (shorter)
fn perimeter(s: Shape) -> f64:
match s:
| Circle(r) -> 2.0 * 3.14159 * r
| Rectangle(w, h) -> 2.0 * (w + h)
| Square(side) -> 4.0 * side
| Triangle(a, b, c) -> a + b + c
# Pattern matching with nil (not None)
fn get_radius(opt: Option<f64>) -> f64:
match opt:
| Some(r) -> r
| nil -> 0.0 # Use nil instead of None
パーサーフレンドリーなマクロ
シンプルなマクロはコントラクトファーストで、LL(1) で解析可能です。IDE はマクロを展開せずにオートコンプリートを提供できます。
# Macro declares what it introduces in the contract header
macro define_counter(NAME: Str const) -> (
returns result: (init: Int, step: Int),
intro counter_fn: enclosing.class.fn "{NAME}Counter"(start: Int) -> Int
):
const_eval:
const init = 0
const step = 1
emit counter_fn:
fn "{NAME}Counter"(start: Int) -> Int:
start + step
# Usage - IDE knows about UserCounter before expansion
class Demo:
define_counter!("User")
fn run() -> Int:
self.UserCounter(10) # Autocomplete works!
組み込みマクロ:
# Print with formatting
println!("Hello, {name}!") # Print with newline
print!("Value: {x}") # Print without newline
# Debug output with source location
dbg!(expression) # Prints: [file:line] expression = value
# Assertions
assert!(condition) # Panic if false
assert_eq!(a, b) # Panic if a != b
assert_ne!(a, b) # Panic if a == b
# Collections
nums = vec![1, 2, 3, 4, 5] # Create vector
formatted = format!("x={x}") # Format string without printing
# Panic with message
panic!("Something went wrong: {err}")
定数展開マクロ(複数の関数を生成):
# Generate accessor functions for each axis
macro gen_axes(BASE: Str const, N: Int const) -> (
intro axes:
for i in 0 .. N:
enclosing.class.fn "{BASE}{i}"(v: Vec[N]) -> Int
):
emit axes:
for i in 0 .. N:
fn "{BASE}{i}"(v: Vec[N]) -> Int:
v[i]
# Usage: generates x(), y(), z() accessors
class Point3D:
gen_axes!("axis_", 3) # Creates axis_0, axis_1, axis_2
AOP とアスペクト指向プログラミング
デフォルトの実行モデルとして、コンパイル時ウィービングを備えた述語ベースのポイントカットを使用します。
# Before advice — runs before matching functions
on pc{ execution(* handle_request(..)) } use log_entry before priority 10
# After advice — runs after successful return
on pc{ execution(* save(..)) & attr(audited) } use audit_write after_success priority 20
# Around advice — wraps function with proceed() contract
on pc{ within(services.*) } use trace_around around priority 50
# Architecture rules — enforce layer dependencies at compile time
forbid pc{ within(hal.*) } "HAL cannot depend on services"
allow pc{ within(services.*) } "Services can use HAL"
サポートされるセレクター: execution(*)、within(*)、attr(*)。演算子は &(AND)、|(OR)、!(NOT)です。
アドバイスの種類: before、after_success、after_error、around(proceed は必ず一度だけ実行)。
順序: 優先度(降順) > 具体性 > 名前の辞書順。
オーバーヘッドゼロ: アスペクトが定義されていない場合、ウィービング用のメタデータはありません。
ランタイムインターセプション: スコープ限定で、明示的に有効化した場合のみ使用され、リリースビルドでは無効です。
詳細なコントラクトについては、AOP サポートマトリックスを参照してください。
SDN の設定
Simple Data Notation は、設定ファイル向けの最小限でトークン効率の高い形式です。
# app.sdn - Application configuration
app:
name: MyService
version: 2.1.0
server:
host: 0.0.0.0
port: 8080
workers: 4
# Inline arrays and dicts
features = [auth, logging, metrics]
database = {driver: postgres, host: localhost, port: 5432}
# Named tables - compact tabular data
rate_limits |endpoint, requests, window|
/api/login, 5, 60
/api/search, 100, 60
/api/upload, 10, 300
Simple で SDN を読み込みます。
config = sdn::load("app.sdn")
print("Server port: {config.server.port}")
SDoctest
実行可能な例は、保守対象のテスト範囲に含まれます。Simple はデモ用ブロックと検証済みの sdoctest ブロックの両方をサポートします。sdoctest は、実行して出力を照合する必要のある例を対象としています。
>>> factorial(5)
120
>>> factorial(0)
1
## Stack data structure with LIFO semantics
struct Stack:
items: [i64]
var s = Stack(items: [])
s.items.push(1)
s.items.push(2)
print s.items.len() # 2
SDoctest の例を実行します。
simple test --sdoctest README.md # Run verified examples in Markdown/docs
simple test --spl-doctest src/math.spl # Run file-local source-comment doctests
simple test --sdoctest --tag slow # Filter by tag
--doctest は互換性のためのエイリアスとして引き続き使用できますが、実装済みの実行経路には --sdoctest のほうが明確な名前です。
標準のリリースコマンドでは、位置引数の test は仕様ツリーの選択にのみ使用されます。
--whole は引き続き、config/sdoctest.sdn で指定された Markdown と、本番用の src/lib、src/compiler、src/app のルートにあるコメント内の doctest を検出します。
関数型更新演算子(->)
# The -> operator calls a method and assigns result back
var data = load_data()
data->normalize() # data = data.normalize()
data->filter(min: 0) # data = data.filter(min: 0)
# Chaining
data->normalize()->filter(min: 0)->save("out.txt")
GPU コンピューティング
import std.gpu
# GPU kernel style 1: #[gpu] with explicit bounds check
#[gpu]
fn vector_add_kernel(a: []f32, b: []f32, result: []f32):
idx = gpu.global_id(0) # Global thread index
if idx < len(result):
result[idx] = a[idx] + b[idx]
# GPU kernel style 2: @simd with auto bounds handling
@simd
fn vector_scale(data: []f32, scale: f32):
val i = this.index() # Global linear index (same as gpu.global_id())
data[i] = data[i] * scale # Bounds auto-handled
# Host function - runs on CPU
fn main():
device = gpu.Device()
# Allocate and upload data
a = [1.0, 2.0, 3.0, 4.0]
b = [5.0, 6.0, 7.0, 8.0]
buf_a = device.alloc_buffer(a)
buf_b = device.alloc_buffer(b)
buf_result = device.alloc_buffer<f32>(4)
# Launch kernel
device.launch_1d(vector_add_kernel, [buf_a, buf_b, buf_result], 4)
# Download results
device.sync()
result = device.download(buf_result)
# result = [6.0, 8.0, 10.0, 12.0]
GPU スレッドインデクサー:
#[gpu]
fn matrix_multiply(A: []f32, B: []f32, C: []f32, N: u32):
# Multi-dimensional indexing
val row = gpu.global_id(0) # First dimension
val col = gpu.global_id(1) # Second dimension
# Thread group (workgroup) info
val local_row = gpu.local_id(0) # Index within workgroup
val group_row = gpu.group_id(0) # Workgroup index
# Alternative @simd style
# val(row, col) = this.index() # Tuple for 2D
# vallocal_idx = this.thread_index()
# valgroup_idx = this.group_index()
if row < N and col < N:
var sum = 0.0_f32
for k in 0..N:
sum += A[row * N + k] * B[k * N + col]
C[row * N + col] = sum
GPU の例: ベクトル加算、行列乗算、リダクション、画像ぼかしについては examples/gpu/vulkan/ を参照してください。
ドキュメント
トピック別クイックリンク
| トピック | 説明 | リンク |
|---|---|---|
| ドキュメントハブ | 番号付きドキュメントインデックス | doc/README.md |
| 言語仕様 | 実行可能な仕様と生成された仕様 | doc/06_spec/README.md |
| ガイド | 実践的なハウツーガイド | doc/07_guide/README.md |
| 計画 | 実装ロードマップ | doc/03_plan/README.md |
| 調査 | 設計の検討 | doc/01_research/README.md |
| アーキテクチャ | システム設計の原則 | doc/04_architecture/README.md |
| トラッキング | バグ、テスト、TODO の追跡 | doc/08_tracking/README.md |
| レポート | セッションとマイルストーンのレポート | doc/09_report/README.md |
| ディープラーニング | ニューラルネットワークと GPU コンピューティング | doc/07_guide/deep_learning/deep_learning.md |
コアドキュメント
はじめに:
- ドキュメントハブ - 番号付きドキュメントツリーの現在のエントリーポイント
- はじめに - プロジェクトのセットアップと最初の手順
- 構文クイックリファレンス - 公式の公開構文チートシート
- テストガイド - テストのワークフローとコマンド一覧
言語リファレンス:
- 構文ガイド - 表層構文と例
- 型システムガイド - 型、可変性、使用方法
- モジュールシステムガイド - インポート、パッケージ、レイアウト
- 標準ライブラリガイド - 標準ライブラリの構成と使用方法
GPU コンピューティング:
- ディープラーニングガイド - Pure Simple、モデル指向、トレーニングのワークフロー
- GPU プログラミングガイド - バックエンドとカーネルを中心とした GPU の使用方法
- GPU API - API レベルの GPU リファレンス
- LLVM バックエンドアーキテクチャ - バックエンドの実装詳細
開発:
- ビルドガイド - Simple のビルドと一般的なワークフロー
- テストガイド - テストランナーの動作とフラグ
- SSpec シナリオマニュアルガイド -
step(...)、インラインシナリオ、キャプチャ、生成されるマニュアルのスタイル - モックポリシーガイド - システムテストでのモック禁止とテストレベルの適用
- カバレッジガイド - カバレッジ、SDoctest、適用ルール
- MCP ツールガイド - MCP の登録と使用方法
高度な機能:
- マクロシステム - 実行可能なマクロ仕様とステータス
- AOP サポートマトリックス - サポート対象のセレクター、アドバイスの種類、バックエンド、エラーコード
- SDN 形式 - Note/SDN の保存およびインデックス形式
- SDoctest - ドキュメントのテストと検証済みの例
- 機能ドキュメント - 生成される機能ドキュメント成果物の形式
例
ディープラーニングの例
Simple には、Pure Simple、モデルのトレーニング、GPU 指向のワークフローにわたる複数のディープラーニングの例が含まれています。
Pure Simple ニューラルネットワーク:
# XOR neural network training
bin/simple examples/pure_nn/xor_training_example.spl
# Linear regression (learns y = 2x + 1)
bin/simple examples/pure_nn/simple_regression.spl
# Iris flower classification
bin/simple examples/pure_nn/iris_classification.spl
MedGemma の韓国語ファインチューニング:
# Progressive LoRA training to prevent catastrophic forgetting
bin/simple examples/medgemma_korean/run_all.spl
CUDA プログラミング:
# Direct CUDA C API - multi-GPU, streams, events
bin/simple examples/cuda/basic.spl
最新のドキュメントについては、ディープラーニングガイドをご覧ください。
その他の例
examples/ ディレクトリには、追加の実用例が含まれています。
| 例 | 説明 |
|---|---|
cli_demo.spl | コマンドライン引数の解析 |
file_async_basic.spl | 非同期ファイル I/O 操作 |
ui_todo_app.spl | クロスプラットフォーム UI アプリケーション |
vulkan_triangle.spl | Vulkan による GPU レンダリング |
async_tcp_echo_server.spl | 非同期 TCP ネットワーキング |
例を実行するには:
bin/simple examples/cli_demo.spl
SSpec シナリオマニュアル
機能およびシステムのドキュメントは、実行可能な SSpec .spl
シナリオから生成されます。SPipe は関連するランナー/ドキュメント生成プロセスであり、SSpec は記述スタイルです。読みやすい step("...") アクションを記述し、実行可能なアサーションを同じシナリオ内にまとめると、ドキュメント生成器がソースを折りたたんだ簡潔なマニュアル手順を生成します。
例 1:TUI の選択
これは、test/03_system/gui/editor_controller_spec.spl でテストされている実際の Code Actions ピッカーのフローに沿ったものです。選択可能なパネルに項目を表示し、行を選択して、Enter キーで適用します。操作と、選択に関するユーザーに見える仕様をひとまとめにしてください。
use std.spec.{describe, expect, it, step}
describe "Code action picker":
it "selects and applies the requested repair":
# @req REQ-EDITOR-CODE-ACTION-001
val actions = [
["First fix", "Rename first now"],
["Second fix", "Rename second now"]
]
step("Open the Code Actions menu")
step("Select \"Second fix\"")
val selected_index = 1
step("Press Enter to apply the selected action")
expect(actions[selected_index][0]).to_equal("Second fix")
expect(actions[selected_index][1]).to_equal("Rename second now")
生成されたオペレーターマニュアル:
1. Open the Code Actions menu
2. Select "Second fix"
3. Press Enter to apply the selected action
例 2:表形式の出力
これは、ダッシュボードの HTML レンダリングシステム仕様
test/03_system/feature/app/web_dashboard/dashboard_render_spec.spl を短縮したものです。同じ表形式の契約は、圧縮、ストレージ/NVMe、セキュリティ、HTML テストレポートにも役立ちます。安定した列、代表的な行、生成された出力に対するアサーションで構成されています。
use std.spec.{describe, expect, it, step}
use app.dashboard.render.table.{render_html_table}
describe "Artifact verification table":
it "renders each artifact result as a table row":
val headers = ["Artifact", "Integrity", "Status"]
val rows = [
["firmware.bin", "sha256", "passed"],
["policy.sdn", "signature", "blocked"]
]
step("Render the artifact verification table")
val html = render_html_table(headers, rows)
step("Verify the blocked policy result remains visible")
expect(html).to_contain("policy.sdn")
expect(html).to_contain("blocked")
生成された QA エビデンスには、コンパクトな表形式の結果を保持できます。
Artifact | Integrity | Status
firmware.bin | sha256 | passed
policy.sdn | signature | blocked
Given_*、When_*、Then_* のヘルパー命名はレガシースタイルです。新しい SSpec マニュアルでは step("...") を使用してください。SSpec Scenario Manual Guide を参照してください。
生成されたドキュメントは、番号付きドキュメントツリーの doc/06_spec/ 以下に配置されます。Docgen は、先頭の test/ コンポーネントを除いたテストパスを反映します。たとえば、test/03_system/plan_acceptance/evidence_showcase_spec.spl からは doc/06_spec/03_system/plan_acceptance/evidence_showcase_spec.md が生成されます。
文法と仕様
言語文法
Simple の現在の言語リファレンスは、ユーザー向けの説明を掲載するガイドツリーと、実行可能なリファレンス資料または生成されたリファレンス資料を掲載する仕様ツリーに分かれています。
現在のリファレンスドキュメント:
- 構文クイックリファレンス - 公開言語のクイックリファレンス
- 構文ガイド - ユーザー向けの言語解説
- 言語仕様インデックス - 現在の生成済み仕様インデックス
- 構文仕様 - 構文カバレッジの仕様資料
- 型仕様 - 型システムカバレッジの仕様資料
- モジュール仕様 - モジュールシステムカバレッジの仕様資料
文法クイックリファレンス:
# Top-level
program ::= statement*
# Statements
statement ::= function_def | class_def | struct_def | enum_def
| import_stmt | export_stmt | expr_stmt
# Expressions (Pratt parser)
expr ::= literal | identifier | binary_op | unary_op
| call | index | field_access | lambda
| if_expr | match_expr | block
# Types
type ::= identifier | array_type | tuple_type | fn_type
| optional_type | result_type | generic_type
# Literals
literal ::= integer | float | string | bool | array | dict | tuple
仕様インデックス
現在の仕様資料とガイド資料は、番号付きドキュメントツリーの以下の場所に整理されています。
コア言語:
- 構文仕様 - 構文を中心とする仕様資料
- 型仕様 - 型システムの仕様資料
- データ構造仕様 - データ構造のカバレッジ
- 関数仕様 - 関数とパターンマッチング
- トレイト仕様 - トレイトと実装
- メモリ仕様 - 所有権と借用
- モジュール仕様 - インポート/エクスポートシステム
高度な機能:
- 並行処理仕様 - 非同期処理と並行処理の動作
- メタプログラミング仕様 - マクロとデコレーター
- マクロ仕様 - マクロ固有の実行可能なカバレッジ
- Capability Effects - Capability/effect システム
- 標準ライブラリガイド - 標準ライブラリの構成と使い方
- SFFI ガイド - 相互運用のガイダンス
- 外部ネイティブライブラリ - オプションのホストライブラリ統合
テストとツール:
- テストガイド - テストランナーとマッチャー
- SSpec シナリオマニュアルガイド - 実行可能な仕様から生成されるシナリオマニュアル
- カバレッジガイド - カバレッジと SDoctest の適用
- Lint ガイド - Lint ルールとワークフロー
- MCP ガイド - MCP のワークフローと登録
GPU とプラットフォーム:
- GPU プログラミングガイド - GPU の使用方法
- ディープラーニングガイド - モデルを中心とする例
- ベアメタルガイド - プラットフォームとベアメタルのワークフロー
現在のドキュメントの入口については、doc/README.md、doc/06_spec/README.md、および doc/07_guide/README.md を参照してください。
プロジェクト構成
simple/
├── bin/ # CLI wrappers and admitted binaries
│ ├── simple # Main CLI
│ └── release/ # Release binaries by target
│
├── src/ # Product source
│ ├── app/ # CLI, build, MCP, LSP, test runner, tools
│ ├── compiler/ # Numbered compiler layers
│ │ ├── 00.common/ # Shared compiler contracts and cache keys
│ │ ├── 10.frontend/ # Lexer, parser, AST, desugaring
│ │ ├── 50.mir/ # Lowered intermediate representation
│ │ ├── 70.backend/ # Native, LLVM, C, WASM, and linker backends
│ │ ├── 80.driver/ # Build driver and incremental cache
│ │ │ └── cache/reference/ # Reverse-reference scheduling and receipts
│ │ ├── 95.interp/ # Interpreter execution layer
│ │ └── 99.loader/ # Module resolution, loading, and JIT instantiation
│ ├── compiler_rust/ # Rust seed bootstrap compiler
│ ├── lib/ # Standard library, imported as use std.X
│ ├── runtime/ # Native runtime and support libraries
│ └── verification/ # Formal verification
│
├── test/ # Executable specifications
│ ├── 01_unit/ # Unit tests
│ ├── 02_integration/ # Integration tests
│ ├── 03_system/ # System and feature tests
│ ├── 04_smoke/ # Fast product smoke tests
│ └── 05_perf/ # Performance tests
│
├── doc/ # Numbered lifecycle documentation
│ ├── 01_research/ # Research
│ ├── 02_requirements/ # Requirements
│ ├── 03_plan/ # Plans
│ ├── 04_architecture/ # Architecture
│ ├── 05_design/ # Detail design
│ ├── 06_spec/ # Generated/manual SSpec documents
│ └── 07_guide/ # User and contributor guides
│
├── .scv/quarantine/ # Ignored local SCV/JIT/root artifacts
└── build/ # Ignored output, bootstrap artifacts, and scratchpad probes
増分コンパイルとインタープリターの境界
src/compiler/80.driver/cache/reference/ にある逆参照レコードは、変更された宣言や成果物と、それらを使用する既知の箇所との対応を示します。ビルドドライバーはこれを使って無効化と再利用の候補を選び、ローダーは同じ依存関係の情報をスケジューリングに使います。レシートとキャッシュキーが一致すると、増分コンパイルの対象をより絞り込めますが、言語のセマンティクスを変更したり、インタープリターの実行をネイティブコンパイルに変えたりするものではありません。インタープリターの実行は引き続き src/compiler/95.interp/ が担います。
適用モデルと現在のエビデンスの限界については、逆参照の調整計画に記載されています。
開発
ビルド
# Debug build
simple build
# Release build
simple build --release
# With GPU support
simple build --release --features=vulkan
# Bootstrap build (minimal 9.3MB)
simple build --bootstrap
テスト
全テストスイートのスナップショット(2026-02-14):4,067/4,067 件合格
Simple では、仕様テスト、SDoctest、カバレッジ、システムの各レーンにまたがる幅広いテスト戦略を採用しています。以下の件数は、リンク先の2026-02-14のレポートに基づいています。
# All tests (4,067 tests in 17.4 seconds)
simple test
# Run specific test file
simple test path/to/spec.spl
# With verbose output
simple test --verbose
# Coverage reports
simple build coverage
テストカバレッジ:
- コアインタープリター:227件のテスト
- コンパイラー:306件のテスト
- 標準ライブラリー:428件のテスト
- アプリケーション:142件のテスト
- ライブラリー(ML、Physics、Game):185件のテスト
- 統合およびカバレッジ:2,779件のテスト
パフォーマンス:
- 合計実行時間:17.4秒
- テストあたりの平均時間:4.3ms
- すべてのテストが決定的で高速です
パフォーマンスプロファイル:
- 言語プロファイル:scripts/check/check-cross-language-perf.shs が doc/09_report/cross_language_perf_2026-06-06.md を生成します
- GUI プロファイル:tools/gui_perf_bench/run_all_benchmarks.shs が doc/09_report/gui_perf_benchmark_2026-06-06.md を生成します
- 起動/TUI プロファイル:scripts/check/check-startup-size-performance-audit.shs が doc/09_report/startup_size_performance_audit_2026-05-27.md に TUI の起動時の記録を残します
詳細なテスト分析については、doc/09_report/session/full_test_suite_results_2026-02-14.md をご覧ください。
コード品質
# Check before commit (fmt + lint + test)
simple build check
# Full check (includes coverage + duplication)
simple build check --full
# Format code
simple build fmt
# Lint
simple build lint
AI ツール(MCP、LSP、プラグイン)
Simple には、すべて Simple で記述された MCP サーバー、LSP サーバー、Claude Code プラグインが付属しています。
Simple MCP サーバーのインストール
Simple MCP サーバーは、コード診断、VCS、ビルド、テスト、デバッグ、および関連するワークフロー向けに、リポジトリーに組み込まれたツールを提供します。最新の登録情報については、ここに記載された固定の件数に頼らず、リポジトリーのスクリプトとガイド文書をご利用ください。
# From a repo checkout — register with Claude Code
claude mcp add simple-mcp -- \
/absolute/path/to/simple/bin/simple \
/absolute/path/to/simple/src/app/mcp/main.spl
# Or use the project .mcp.json (auto-detected by Claude Code)
sh config/mcp/install.shs
Simple MCP プラグインのインストール
simple-mcp Claude プラグインは、リポジトリーのチェックアウトから使用するプラグインです。Simple リポジトリーをチェックアウトした状態からインストールしてください。単独で持ち運べるランタイムバンドルではありません。
claude plugin marketplace add tools/claude-plugin/marketplace
claude plugin install simple-mcp@simple-local
このプラグインは、リポジトリーのルートから bin/simple_mcp_server を起動します。
Simple LSP プラグインのインストール
Simple 言語サーバーは、.spl / .shs ファイルに対して、補完、ホバー、定義へのジャンプ、診断、セマンティックトークンを提供します。
# From a repo checkout
claude plugin marketplace add tools/claude-plugin/marketplace
claude plugin install simple-lsp@simple-local
バイナリーのフルパス: bin/simple run src/app/lsp/main.spl
両方をインストール(クイックセットアップ)
cd /path/to/simple
# 1. MCP server
sh config/mcp/install.shs
# 2. LSP plugin
claude plugin marketplace add tools/claude-plugin/marketplace
claude plugin install simple-lsp@simple-local
プロンプトの例
MCP サーバーと LSP プラグインをインストールしたら、Claude Code で次のプロンプトを試してください。
> "Run the linter on src/app/cli/main.spl and fix any warnings"
> "Show me all unused variables in the compiler frontend"
> "Run the unit tests for the SDN parser"
> "Build the project in release mode and show the result"
> "What does the function `parse_expression` in the parser do?"
> "Find all TODO items in the codebase"
> "Check the doc coverage for the standard library"
> "Debug why test/01_unit/lib/common/value_spec.spl is failing"
エディタープラグイン
VSCode 拡張機能
Tree-sitter によるハイライト、LSP 統合、数式ブロックのサポートを備えた、機能豊富な拡張機能です。
cd src/app/vscode_extension
npm install && npm run compile && npm run package
code --install-extension simple-language-0.1.0.vsix
主な機能:
- セマンティック構文ハイライト(Tree-sitter による実装)
- LSP:補完、ホバー、定義へ移動、診断
m{}、loss{}、nograd{}の数式ブロックをハイライト(入れ子の波括弧に対応)- テスト用 CodeLens:
describe/it/context/sdoctestブロックのガターに「Run Test/File/Doctest」矢印を表示 - AI を活用した補完とチャット(GitHub Copilot が必要です)
詳細については、src/app/vscode_extension/README.md をご覧ください。
Neovim プラグイン
-- lazy.nvim
{ "nicholasgasior/simple.nvim", ft = "simple", opts = {} }
-- Or from project checkout
vim.opt.rtp:prepend("/path/to/simple/src/app/nvim_plugin")
require("simple").setup()
主な機能:
- 自動検出に対応した LSP 統合
- インラインの Unicode プレビュー付き数式ブロックのコンシール(
frac(1,2)->(1)/(2)、alpha->α、sqrt(x)->√(x)) - テストレンズ:テストブロックの横に「Run」の仮想テキストを表示
- Tree-sitter クエリ(ハイライト、折りたたみ、テキストオブジェクト、インジェクション)
- 簡易ビュー(シグネチャに折りたたみ)
詳細については、src/app/nvim_plugin/README.md をご覧ください。
TRACE32 ツール
Lauterbach TRACE32 デバッガー向けの MCP サーバー、CMM 言語サーバー、コマンドラインツールです。詳細については、examples/10_tooling/trace32_tools/README.md をご覧ください。
リポジトリ管理のコンテナーフローはヘッドレスで、t32mciserver を使用します。
TRACE32 GUI 互換ライブラリはバンドルされていません。ベンダーのランタイムファイルは、ローカルの /opt/t32 インストールから用意してください。
主なライフサイクルラッパー:
scripts/t32q.shs build
scripts/t32q.shs on
scripts/t32q.shs wait
scripts/t32q.shs ping
scripts/t32q.shs reopen
scripts/t32q.shs off
GUI コンテナーの再オープン手順:
scripts/t32q.shs gui-on
scripts/t32q.shs gui-reopen
scripts/t32q.shs off
gui-on はホストの X11 転送を使用する Docker/Podman の TRACE32 GUI 経路を使うため、実際のホスト X11 セッション(DISPLAY、/tmp/.X11-unix、通常は XAUTHORITY も)が必要です。簡易診断には次を使用してください。
scripts/t32q.shs doctor
Hello-world ファームウェアのスモークテスト:
scripts/t32_semihost_hello.shs --board stm32wb
scripts/t32_semihost_hello.shs --board stm32h7
scripts/t32_semihost_hello.shs --board stm32wb --build-only
オプション:T32 MCP サーバーのインストール
これらの TRACE32 MCP サーバーは、プロジェクトのデフォルトの MCP セットアップではインストールされません。TRACE32 ツールを実際に使用する場合に限り、手動で登録してください。
cd /path/to/simple
# T32 MCP — controls live TRACE32 debug sessions (23 tools)
claude mcp add t32-mcp -- \
/absolute/path/to/simple/bin/simple \
/absolute/path/to/simple/examples/10_tooling/trace32_tools/t32_mcp/main.spl
# T32 LSP MCP — CMM script analysis, no hardware needed (6 tools)
claude mcp add t32-lsp-mcp -- \
/absolute/path/to/simple/bin/simple \
/absolute/path/to/simple/examples/10_tooling/trace32_tools/t32_lsp_mcp/main.spl
バイナリのフルパス:
- T32 MCP:
bin/simple run examples/10_tooling/trace32_tools/t32_mcp/main.spl - T32 LSP MCP:
bin/simple run examples/10_tooling/trace32_tools/t32_lsp_mcp/main.spl
CMM LSP プラグインのインストール
claude plugin marketplace add tools/claude-plugin/marketplace
claude plugin install cmm-lsp@simple-local
バイナリのフルパス: bin/simple run examples/10_tooling/trace32_tools/cmm_lsp/mod.spl --lsp
T32 プロンプトの例
> "Parse this CMM script and check for errors: config/t32/stm32h7_gdb_start.cmm"
> "Connect to TRACE32 on localhost:20000 and read the CPU registers"
> "Show me all labels and macros defined in my CMM script"
> "Convert this GUI PRACTICE script to CLI batch mode"
> "Check if my CMM script has any undefined macros or unreachable code"
> "Set a breakpoint at main, run to it, and show local variables"
> "What TRACE32 commands are available for memory access?"
> "Auto-complete suggestions for 'Data.LOAD' in my CMM script"
コントリビューション
開発ガイドラインについては CLAUDE.md、AI エージェント向けの指示については AGENTS.md をご覧ください。
ドキュメントの構成:
- 仕様は doc/06_spec/ に記載します(言語がサポートする内容)
- ガイドは doc/07_guide/ に記載します(機能の使い方)
- 調査資料は doc/01_research/ に記載します(意思決定の理由と経緯)
- 計画は doc/03_plan/ に記載します(実装ロードマップ)
- レポートは doc/09_report/ に記載します(セッションの概要と完了レポート)
ライセンス
Apache License 2.0。詳細については LICENSE をご覧ください。
バンドルされているサードパーティのランタイムコンポーネントと再配布に関する通知は、 THIRD_PARTY_NOTICES.md に記載されています。
リリースパッケージにも THIRD_PARTY_NOTICES.md が含まれます。
リソース
公式ドキュメント:
クイックリファレンス:
開発:
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。