# _protocols

URL: /kida/api/compiler/_protocols/
Section: compiler
Description: Type protocols for Kida compiler.

Provides minimal type contracts for compiler mixins to enable
type-safe mixin patterns without exposing implementation details.

See: plan/rfc-mixin-protocol-typing.md

---

> For a complete page index, fetch /kida/llms.txt.

Open LLM text
(/kida/api/compiler/_protocols/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fcompiler%2F_protocols%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fcompiler%2F_protocols%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fcompiler%2F_protocols%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fcompiler%2F_protocols%2Findex.txt)

Module

#
`compiler._protocols`

Type protocols for Kida compiler.

Provides minimal type contracts for compiler mixins to enable
type-safe mixin patterns without exposing implementation details.

See: plan/rfc-mixin-protocol-typing.md

1Class

## Classes

`CompilerCoreProtocol`

8

▼

Minimal contract for cross-mixin dependencies in compiler.

Contains ONLY:
1. Host class attributes…

Minimal contract for cross-mixin dependencies in compiler.

Contains ONLY:

- Host class attributes (defined in Compiler.init)

- Core compilation methods (used by all compilation mixins)

- Operator utilities (used by expression compilation)

Individual mixin methods are NOT included—mixins declare
their own methods via inline TYPE_CHECKING declarations.

#### Attributes

Name
Type
Description

`_env`

`Environment`

—

`_name`

`str | None`

—

`_filename`

`str | None`

—

`_locals`

`set[str]`

—

`_blocks`

`dict[str, Any]`

—

`_block_counter`

`int`

—

#### Methods

Internal Methods
2

▼

`_compile_expr`

2

`ast.expr`

▼

Compile expression node to Python AST expression.

`def _compile_expr(self, node: Node, store: bool = False) -> ast.expr`

##### Parameters

Name
Type
Description

`node`
`—`

`store`
`—`

Default:`False`

##### Returns

`ast.expr`

`_compile_node`

1

`list[ast.stmt]`

▼

Compile a single AST node to Python statements.

`def _compile_node(self, node: Node) -> list[ast.stmt]`

##### Parameters

Name
Type
Description

`node`
`—`

##### Returns

`list[ast.stmt]`
