# Ada Support in Maguyva: Specs, Bodies, and Package Graphs

Canonical source: https://maguyva.ai/languages/ada

License: text under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/); code samples under [MIT-0](https://opensource.org/license/mit-0); the Maguyva name, logos, brand assets and other code are not covered. Details: [maguyva.ai/license](https://maguyva.ai/license).

Maguyva parses Ada with AST, symbol, and graph support, so AI agents can follow package specs, bodies, tasks, and tagged types in long-lived Ada systems.

## Support snapshot

- Tier: AST and symbol support
- Programming
- Extensions: .ada, .adb, .ads
- Real AST parsing for syntax-aware search and structural context.
- Named symbols feed semantic lookup and cross-reference. Graph navigation is available when relationship extraction is enabled.
- This language contributes symbols and relationships to graph-aware search; supported edge types vary with its native constructs.
- AST parsing and symbol extraction are both available.

## Best fit

- Teams maintaining long-lived Ada in aerospace, defence, rail, or other high-integrity domains where every change is reviewed.
- Codebases split across `.ads` specifications and `.adb` bodies, where the interface and the implementation live in different files.
- Engineers using AI agents for impact analysis and review preparation, not for unreviewed code generation.

## Agent workflows

- Find every unit that `with`s a package before changing its specification.
- Trace which subprograms call a routine across package boundaries.
- Map task types, protected types, and tagged-type hierarchies before a concurrency or design change.

## Why Ada repositories need a dependency map

Ada separates what a package promises (`.ads`) from how it does it (`.adb`). That is good engineering, and it also means a single change touches several files that a text search will not connect for you. Long-lived Ada systems add another layer: generics, tagged types, tasks, and protected objects whose relationships matter more than any one file.

Maguyva gives an agent that dependency map before it proposes an edit, which is the order high-integrity review expects.

## What Maguyva extracts in Ada

Maguyva covers `.ads`, `.adb`, and `.ada`. Subprogram bodies and procedure and function specifications are extracted as callable symbols, so a routine's spec and its body are both searchable. Symbol matching is case-insensitive, as Ada itself is.

Imports come from `with` and `use` clauses, with the keyword stripped so the graph stores the package name. The graph also records calls, inheritance and overrides on tagged types, instantiation, type references, reads and writes, and exception raise and handler edges.

In structural search, task types, protected types, record types, and interface types are selectable as type definitions, and entry bodies are selectable as methods.

## Example agent prompts

- "Which units depend on `Flight_Control.Sensors`, and which of its subprograms do they call?" (`dependency_search` incoming)
- "Show the spec and body for `Compute_Trajectory` and every caller." (`find_symbol`)
- "Explain how the telemetry task hands data to the logging protected object." (`get_task_context`)

## Known limits

- Ada uses the same syntax for some calls, record field access, and indexing. Maguyva filters built-in types, standard library packages, attribute functions, and operators (about 113 patterns) to keep the call graph clean, so calls into the standard library are not graph edges. Record-field access and indexing are told apart from calls by their position in the grammar, not by a list of field names. Common text I/O calls such as `Put_Line`, `Put`, and `Get` are kept on purpose.
- `use` clauses change visibility but are not selected as imports in structural search; `with` clauses are.
- Record and interface type nodes can be anonymous fragments, so name-based structural queries may miss them. Use `find_symbol` for named types.

## Next steps

Connect a repository with the [quickstart](/docs/quickstart), then check the support matrix on the [compatibility page](/docs/compatibility). If your Ada code binds to C, read the [C guide](/languages/c) too.

## Engine details

- Ada support covers `.ads` specifications, `.adb` bodies, and `.ada`. Subprogram bodies and specifications are both callable symbols.
- Symbol matching is case-insensitive, and `with` and `use` clauses become import relationships with the keyword stripped.
- About 113 built-in types, standard library packages, attribute functions, and operators are filtered from calls; record-field access and indexing are told apart from calls by their position in the grammar, and `Put_Line`, `Put`, and `Get` are kept on purpose.

## Useful MCP entry points

- `find_symbol`: Use it to find a subprogram's specification and body together, with references.
- `dependency_search`: Use incoming traversal on a package before changing its specification to see every dependent unit.
- `get_task_context`: Use it for prompts like “explain how the telemetry task hands data to the logging protected object.”
