# basic

URL: /kida/api/compiler/statements/basic/
Section: statements
Description: Basic statement compilation for Kida compiler.

Provides mixin for compiling basic output statements (data, output).

Uses inline TYPE_CHECKING declarations for host attributes.
See: plan/rfc-mixin-protocol-typing.md

---

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

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

Share with AI

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

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

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

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

Module

#
`compiler.statements.basic`

Basic statement compilation for Kida compiler.

Provides mixin for compiling basic output statements (data, output).

Uses inline TYPE_CHECKING declarations for host attributes.
See: plan/rfc-mixin-protocol-typing.md

1Class

## Classes

`BasicStatementMixin`

3

▼

Mixin for compiling basic output statements.

Host attributes and cross-mixin dependencies are decl…

Mixin for compiling basic output statements.

Host attributes and cross-mixin dependencies are declared via inline
TYPE_CHECKING blocks.

#### Methods

Internal Methods
3

▼

`_compile_data`

1

`list[ast.stmt]`

▼

Compile raw text data.

StringBuilder mode: _append("literal text")
Streaming m…

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

Compile raw text data.

StringBuilder mode: _append("literal text")
Streaming mode: yield "literal text"

##### Parameters

Name
Type
Description

`node`
`—`

##### Returns

`list[ast.stmt]`

`_expr_may_produce_none`

1

`bool`

▼

Check if an expression involves optional chaining that may produce None.

When …

staticmethod

`def _expr_may_produce_none(node: Expr) -> bool`

Check if an expression involves optional chaining that may produce None.

When optional chaining (?., ?[, ?|>) is the outermost expression in
{{ ... }} output (not wrapped in ??), str(None) renders as "None".
We detect this and use _str_safe to render "" instead.

##### Parameters

Name
Type
Description

`node`
`—`

##### Returns

`bool`

`_compile_output`

1

`list[ast.stmt]`

▼

Compile {{ expression }} output.

StringBuilder mode: _append(_e(expr)) or _app…

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

Compile {{ expression }} output.

StringBuilder mode: _append(_e(expr)) or _append(_s(expr))
Streaming mode: yield _e(expr) or yield _s(expr)

When the expression involves optional chaining (?., ?[) without
null coalescing (??), uses _str_safe instead of _s so that None
renders as "" instead of "None".

##### Parameters

Name
Type
Description

`node`
`—`

##### Returns

`list[ast.stmt]`
