.claude/skills/compiler/SKILL.md
How the atopile compiler builds and links TypeGraphs from `.ato` (ANTLR front-end → AST → TypeGraph → Linker → DeferredExecutor), plus the key invariants and test entrypoints. Use when modifying the compiler pipeline, grammar, AST visitors, or type resolution.
npx skillsauth add atopile/atopile compilerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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)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)
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)src/atopile/compiler/parser/ (AtoLexer.g4, AtoParser.g4, generated Python)src/atopile/cli/build.py): Calls the compiler to build the project.src/atopile/lsp/lsp_server.py): Builds per-document graphs and keeps the last successful result for completions/hover..ato into an ANTLR parse tree; syntax errors are converted to UserSyntaxError.ANTLRVisitor converts ANTLR output into internal AST nodes (FabLL nodes with source info).Linker resolves imports, executes inheritance ordering, applies retypes, and prepares a self-contained compilation unit.DeferredExecutor.execute() runs operations that require resolved types (inheritance, retypes, for-loops).src/atopile/compiler/parser/AtoLexer.g4 / AtoParser.g4src/atopile/compiler/parser/README.md)src/atopile/compiler/antlr_visitor.pysrc/atopile/compiler/ast_visitor.py / gentypegraph.pysrc/atopile/compiler/build.py / src/atopile/compiler/deferred_executor.pyato dev test --llm test/compiler -qato dev test --llm test/compiler/test_linker.py -qato dev test --llm test/test_end_to_end.py -qDslRichException/UserException with AST source info when possible.(g, tg) explicitly; ensure you destroy GraphView in long-running processes (LSP does this).development
How the Faebryk parameter solver works (Sets/Literals, Parameters, Expressions), the core invariants enforced during mutation, and practical workflows for debugging and extending the solver. Use when implementing or modifying constraint solving, parameter bounds, or debugging expression simplification.
development
# SEXP Benchmark Strategy ## Goal Measure and improve S-expression pipeline performance with a focus on: - Throughput per stage - Peak memory per stage - End-to-end behavior on realistic KiCad PCB inputs ## Pipeline Stages Benchmark these layers separately: - `tokenizer` - `ast` - `parser` (typed decode) - `encode` (typed encode to raw SEXP) - `pretty` (formatting) ## Dataset Dimensions Use a matrix over: - `depth`: shallow vs deep nesting - `size`: small, medium, large Recommended size buck
development
How the Zig S-expression engine and typed KiCad models work, how they are exposed to Python (pyzig_sexp), and the invariants around parsing, formatting, and freeing. Use when working with KiCad file parsing, S-expression generation, or layout sync.
tools
How the Zig↔Python binding layer works (pyzig), including build-on-import, wrapper generation patterns, ownership rules, and where to add new exported APIs. Use when adding Zig-Python bindings, modifying native extensions, or debugging C-API interactions.