Skip to content

Commit 68ebe92

Browse files
authored
doc: dialect module docstring (#194)
1 parent dacb401 commit 68ebe92

File tree

21 files changed

+221
-6
lines changed

21 files changed

+221
-6
lines changed

src/kirin/dialects/eltype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""this dialect offers a statement `eltype` for other dialects'
1+
"""This dialect offers a statement `eltype` for other dialects'
22
type inference to query/implement the element type of a value.
33
For example, the `ilist` dialect implements the `eltype` statement
44
on the `ilist.IList` type to return the element type.

src/kirin/dialects/lowering/cf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def new_block_arg_if_inside_loop(frame: Frame, capture: ir.SSAValue):
4747
)
4848
body_frame.next_block = next_block
4949
next_value = body_frame.entry_block.args.append_from(ir.types.Any, "next_value")
50-
py.unpack.unpackable(state, node.target, next_value)
50+
py.unpack.unpacking(state, node.target, next_value)
5151
state.exhaust(body_frame)
5252
next_stmt = body_frame.append_stmt(py.iterable.Next(iter_stmt.iter))
5353
cond_stmt = body_frame.append_stmt(py.cmp.Is(next_stmt.value, none_stmt.result))

src/kirin/dialects/py/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
"""Python dialects module.
2+
3+
This module contains a set of dialects that represent
4+
different fractions of the Python language. The dialects
5+
are designed to be used in a union to represent the
6+
entire Python language.
7+
"""
8+
19
from . import (
210
cmp as cmp,
311
len as len,

src/kirin/dialects/py/assertion.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
"""Assertion dialect for Python.
2+
3+
This module contains the dialect for the Python `assert` statement, including:
4+
5+
- The `Assert` statement class.
6+
- The lowering pass for the `assert` statement.
7+
- The concrete implementation of the `assert` statement.
8+
- The type inference implementation of the `assert` statement.
9+
- The Julia emitter for the `assert` statement.
10+
11+
This dialect maps `ast.Assert` nodes to the `Assert` statement.
12+
"""
13+
114
import ast
215

316
from kirin import ir, types, interp, lowering

src/kirin/dialects/py/assign.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
"""Assignment dialect for Python.
2+
3+
This module contains the dialect for the Python assignment statement, including:
4+
5+
- Statements: `Alias`, `SetItem`.
6+
- The lowering pass for the assignments.
7+
- The concrete implementation of the assignment statements.
8+
9+
This dialects maps Python assignment syntax.
10+
"""
11+
112
import ast
213

314
from kirin import ir, interp, lowering, exceptions

src/kirin/dialects/py/attr.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
"""Attribute access dialect for Python.
2+
3+
This module contains the dialect for the Python attribute access statement, including:
4+
5+
- The `GetAttr` statement class.
6+
- The lowering pass for the attribute access statement.
7+
- The concrete implementation of the attribute access statement.
8+
9+
This dialect maps `ast.Attribute` nodes to the `GetAttr` statement.
10+
"""
11+
112
import ast
213

314
from kirin import ir, interp, lowering, exceptions

src/kirin/dialects/py/binop/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
"""The binop dialect for Python.
2+
3+
This module contains the dialect for binary operation semantics in Python, including:
4+
5+
- The `Add`, `Sub`, `Mult`, `Div`, `FloorDiv`, `Mod`, `Pow`,
6+
`LShift`, `RShift`, `BitOr`, `BitXor`, and `BitAnd` statement classes.
7+
- The lowering pass for binary operations.
8+
- The concrete implementation of binary operations.
9+
- The type inference implementation of binary operations.
10+
- The Julia emitter for binary operations.
11+
12+
This dialect maps `ast.BinOp` nodes to the `Add`, `Sub`, `Mult`, `Div`, `FloorDiv`,
13+
`Mod`, `Pow`, `LShift`, `RShift`, `BitOr`, `BitXor`, and `BitAnd` statements.
14+
"""
15+
116
from . import (
217
julia as julia,
318
interp as interp,

src/kirin/dialects/py/boolop.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
"""Boolean operators for Python dialect.
2+
3+
This module contains the dialect for the Python boolean operators, including:
4+
5+
- The `And` and `Or` statement classes.
6+
- The lowering pass for the boolean operators.
7+
- The concrete implementation of the boolean operators.
8+
- The Julia emitter for the boolean operators.
9+
10+
This dialect maps `ast.BoolOp` nodes to the `And` and `Or` statements.
11+
"""
12+
113
import ast
214

315
from kirin import ir, interp, lowering

src/kirin/dialects/py/builtin.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
"""builtin dialect for python builtins
2+
3+
This dialect provides implementations for builtin functions like abs and sum.
4+
5+
- Statements: `Abs`, `Sum`.
6+
- The lowering pass for the builtin functions.
7+
- The concrete implementation of the builtin functions.
8+
- The type inference implementation of the builtin functions.
9+
10+
This dialect maps `ast.Call` nodes of builtin functions to the `Abs` and `Sum` statements.
11+
"""
12+
113
from ast import Call
214

315
from kirin import ir, types, interp, lowering
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
"""The cmp dialect for Python.
2+
3+
This module contains the dialect for comparison semantics in Python, including:
4+
5+
- The `Eq`, `NotEq`, `Lt`, `LtE`, `Gt`, `GtE`, `Is`, and `IsNot` statement classes.
6+
- The lowering pass for comparison operations.
7+
- The concrete implementation of comparison operations.
8+
- The Julia emitter for comparison operations.
9+
10+
This dialect maps `ast.Compare` nodes to the `Eq`, `NotEq`, `Lt`, `LtE`,
11+
`Gt`, `GtE`, `Is`, and `IsNot` statements.
12+
"""
13+
114
from . import julia as julia, interp as interp, lowering as lowering
215
from .stmts import * # noqa: F403
316
from ._dialect import dialect as dialect

0 commit comments

Comments
 (0)