跳到正文
cccskills
免费在 GitHub 公开

vyper-compiler

Helps contributors work inside the Vyper smart contract compiler by explaining its compilation stages, semantic analysis, code generation, and experimental Venom intermediate representation. It also guides testing and codebase changes.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

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,183(GitHub 5,183 + cccskills 0)

实测评分 未实测

查看安装方法

适用场景

  • Understand the Vyper compilation pipeline
  • Make changes to AST or semantic analysis
  • Work on Venom IR passes or code generation
  • Write compiler tests

包含的文件(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(原文)

安装前可以查看交给 AI 代理的指令内容。

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 的隐私权政策和服务条款。

报告此技能的问题