compiler
How the atopile compiler builds and links TypeGraphs from `.ato` (ANTLR front-end → AST → TypeGraph → Linker → DeferredExecutor), plus the key invariants and test entrypoints.
Install
mkdir -p .claude/skills/compiler && curl -L -o skill.zip "https://mcp.directory/api/skills/download/4182" && unzip -o skill.zip -d .claude/skills/compiler && rm skill.zipInstalls to .claude/skills/compiler
About this skill
Compiler Module
The compiler builds a linked, self-contained TypeGraph from .ato sources. Export/manufacturing artifacts are handled later by build steps/exporters; the compiler’s job is parsing + typegraph construction + linking.
Start with:
src/atopile/compiler/README.md(stage overview + example usage)src/atopile/compiler/parser/README.md(how to regenerate ANTLR output)
Quick Start
Build a single .ato file into a linked TypeGraph (and instantiate its entrypoint):
import faebryk.core.faebrykpy as fbrk
import faebryk.core.graph as graph
import faebryk.core.node as fabll
from atopile.compiler.build import Linker, StdlibRegistry, build_file
from atopile.compiler.deferred_executor import DeferredExecutor
from atopile.config import config
g = graph.GraphView.create()
tg = fbrk.TypeGraph.create(g=g)
stdlib = StdlibRegistry(tg)
linker = Linker(config, stdlib, tg)
result = build_file(g=g, tg=tg, import_path="app.ato", path="path/to/app.ato")
linker.link_imports(g=g, state=result.state)
DeferredExecutor(g=g, tg=tg, state=result.state, visitor=result.visitor).execute()
app_type = result.state.type_roots["ENTRYPOINT"]
app_root = tg.instantiate_node(type_node=app_type, attributes={})
app = fabll.Node.bind_instance(app_root)
Relevant Files
- Core pipeline:
src/atopile/compiler/build.py(build_file,build_source,Linker,StdlibRegistry, stage helpers)src/atopile/compiler/parse.py(ANTLR parse + error listener →UserSyntaxError)src/atopile/compiler/antlr_visitor.py(ANTLR CST → internal AST graph with source info)src/atopile/compiler/ast_visitor.py(AST → TypeGraph “preliminary” construction)src/atopile/compiler/gentypegraph.py(typegraph generation utilities + import refs)src/atopile/compiler/deferred_executor.py(terminal stage: inheritance/retypes/for-loops)
- Parser frontend:
src/atopile/compiler/parser/(AtoLexer.g4,AtoParser.g4, generated Python)
Dependants (Call Sites)
- CLI (
src/atopile/cli/build.py): Calls the compiler to build the project. - LSP (
src/atopile/lsp/lsp_server.py): Builds per-document graphs and keeps the last successful result for completions/hover.
How to Work With / Develop / Test
Core Concepts
- ANTLR front-end: parse
.atointo an ANTLR parse tree; syntax errors are converted toUserSyntaxError. - AST graph:
ANTLRVisitorconverts ANTLR output into internal AST nodes (FabLL nodes with source info). - TypeGraph build: AST visitor emits a preliminary TypeGraph.
- Linking:
Linkerresolves imports, executes inheritance ordering, applies retypes, and prepares a self-contained compilation unit. - Deferred execution (terminal):
DeferredExecutor.execute()runs operations that require resolved types (inheritance, retypes, for-loops).
Development Workflow
- Grammar changes:
- edit
src/atopile/compiler/parser/AtoLexer.g4/AtoParser.g4 - regenerate (see
src/atopile/compiler/parser/README.md)
- edit
- Language features:
- CST → AST:
src/atopile/compiler/antlr_visitor.py - AST → TypeGraph:
src/atopile/compiler/ast_visitor.py/gentypegraph.py
- CST → AST:
- Linking/terminal behavior:
src/atopile/compiler/build.py/src/atopile/compiler/deferred_executor.py
Testing
- Compiler tests:
ato dev test --llm test/compiler -q - Linker behavior:
ato dev test --llm test/compiler/test_linker.py -q - End-to-end smoke:
ato dev test --llm test/test_end_to_end.py -q
Best Practices
- Keep errors source-attached: raise
DslRichException/UserExceptionwith AST source info when possible. - Watch graph lifetimes: most entrypoints accept
(g, tg)explicitly; ensure you destroyGraphViewin long-running processes (LSP does this).
More by atopile
View all →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
rust-coding-skill
UtakataKyosui
Guides Claude in writing idiomatic, efficient, well-structured Rust code using proper data modeling, traits, impl organization, macros, and build-speed best practices.
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.