本文へ移動
cccskills
無料GitHub で公開日本語紹介

vyper-compiler

Vyperコンパイラの解析・コード生成・Venom IRなどの内部構造を案内し、実装変更やテスト作成を進めるための手がかりを示します。

原文原文の説明を見る

Vyper smart contract compiler internals. Use when working on the Vyper compiler codebase — compilation pipeline, Venom IR, semantic analysis, code generation, testing, or contributing. Triggers on vyper compiler development, Venom passes, AST/semantics changes, codegen work, or test writing.

vyperlang/vyperスター 5,184(GitHub 5,184 + cccskills 0)

実行スコア 未検証

インストール方法を見る

こんなときに便利

  • Vyperのコンパイル処理を理解したいとき
  • 意味解析や構文木を変更したいとき
  • Venomの最適化処理に取り組みたいとき
  • コンパイラのテストを追加したいとき

日本語での紹介

できること

Vyperコンパイラのコードベースを扱う開発者に、ソース解析からバイトコード生成までの構成を案内します。AST(構文木)の解析、型チェックなどの意味解析、従来のIR(中間表現)によるコード生成、実験的なVenom IRの変換パスを説明します。主要な関数やディレクトリ、テストの場所も示すため、変更対象を見つけて実装やテスト作成を進める手がかりになります。

こんなときに便利

Vyperコンパイラへ初めて参加する人や、構文・型・コード生成の変更、Venomの最適化パス、テスト追加に取り組む開発者に向いています。コンパイル結果や中間表現、アセンブリを確認するコマンドも紹介します。

使い方の例

  • 「Vyperのコンパイル処理の流れと、各段階のコードの場所を教えてください」
  • 「Venom IRの最適化パスを変更するときに見るべき場所を案内してください」
  • 「この意味解析の変更に対応するテストの構成を説明してください」

注意点

対象はVyper v0.4.xの開発で、Python 3.11以降を前提とします。依存関係の管理にはuvを推奨し、コマンドはuv run経由で実行するよう案内しています。

この紹介文は、公開されている SKILL.md をもとに AI(OpenAI Codex)が作成しました。正確な仕様は下の原文を確認してください。

含まれるファイル(6)

  • SKILL.md4.4 KB
  • codegen.md1.1 KB
  • contributing.md7.8 KB
  • semantics.md2.3 KB
  • testing.md1.6 KB
  • venom.md2.0 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Vyper Compiler

Pythonic smart contract language targeting the EVM. v0.4.x, Python 3.11+.

Quick Commands

uv sync                                 # install deps (per-worktree .venv, recommended, includes dev group)
uv run vyper contract.vy                # compile a contract
uv run vyper -f ir_runtime contract.vy  # inspect Venom IR
uv run vyper -f asm contract.vy         # inspect assembly
uv run ./quicktest.sh                   # run tests (`-nauto -m "not fuzzing"` by default via setup.cfg)
uv run make lint                        # enforces code style (same as CI)

Prefix all commands with uv run — it activates the local .venv per invocation, which is necessary in non-interactive shells. Each worktree gets its own .venv, so no cross-contamination.

Alternative: pip install . --group dev + PYTHONPATH=. prefix on every command. Never pip install -e . — it creates an egg-link in site-packages that permanently points the venv at one worktree, breaking all others.

Compilation Pipeline

Source (.vy)
  │
  ├─ vyper/ast/            → Parse to AST (pre_parser → Python AST → Vyper AST)
  ├─ vyper/semantics/      → Type check, validate, annotate AST
  ├─ vyper/codegen/        → AST → s-expr IR (default production pipeline)
  ├─ vyper/ir/             → s-expr IR → assembly → bytecode
  └─ vyper/evm/            → Assembly → bytecode

Experimental Venom path (--experimental-codegen):

  ├─ vyper/codegen_venom/  → AST → Venom SSA IR
  └─ vyper/venom/          → Venom IR optimization passes → assembly

Orchestrated by vyper/compiler/phases.py (CompilerData). Each phase is lazy.

Directory Map

DirectoryPurpose
vyper/ast/Parsing, AST nodes, pre-parser. See AST README
vyper/semantics/Type system, analysis, validation. See Semantics README
vyper/codegen/AST → s-expr IR (default production pipeline)
vyper/ir/s-expr IR → assembly → bytecode. See IR README
vyper/codegen_venom/AST → Venom IR (experimental, --experimental-codegen)
vyper/venom/Venom SSA IR: passes, analysis, assembly emission. See Venom README
vyper/compiler/Pipeline orchestration, settings, output formats. See Compiler README
vyper/builtins/Built-in functions and interfaces
vyper/evm/EVM opcodes, assembler
vyper/cli/CLI entry points (vyper, vyper-ir, venom)
tests/unit/Unit tests (ast, semantics, compiler, venom)
tests/functional/Functional tests (builtins, codegen, grammar, syntax, venom)

Topic Deep-Dives

  • Venom IR — SSA IR design, passes, optimization, working with Venom code
  • Semantics & Frontend — Type system, analysis phases, namespace, validation
  • Code Generation — Legacy IR, Venom codegen, the two pipelines
  • Testing — Test structure, fixtures, running tests, writing new tests
  • Contributing — Commit message standards, PR workflow, code style summary

Code Style

Enforced by make lint (also what CI runs). Includes black, flake8, isort, mypy.

  • Line length: 100
  • No inline imports; standard library → third-party → local
  • snake_case for variables (tmp = ...), DromedaryCase (aka upper camelCase) for classes (ExprAnalyzer), type classes end in T (e.g. IntegerT, ModuleT)

Key Entry Points

WhatWhere
Main compile functionvyper.compiler.compile_code()
Pipeline phasesvyper.compiler.phases.CompilerData
AST parsingvyper.ast.parse.parse_to_ast()
Semantic analysisvyper.semantics.analyze_module()
Legacy codegenvyper.codegen.module
AST → Venom IRvyper.codegen_venom.module
Venom → assemblyvyper.venom.generate_assembly_experimental()
CLI entryvyper.cli.vyper_compile

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

このスキルの問題を報告する