Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ dependencies = [
readme = "README.md"
requires-python = ">= 3.10"

[project.optional-dependencies]
pydantic = [
"pydantic>=2.9.2",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
Expand Down
Empty file added src/kirin/schema/__init__.py
Empty file.
25 changes: 25 additions & 0 deletions src/kirin/schema/ir.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from pydantic import BaseModel


class SSAValue(BaseModel):
id: int
name: str | None = None


class Statement(BaseModel):
dialect: str
name: str
args: list[SSAValue]
results: list[SSAValue]
successors: list[int] = []
regions: list["Region"] = [] # NOTE: stmt owns regions


class Block(BaseModel):
id: int
args: list[SSAValue] = []
stmts: list[Statement] = []


class Region(BaseModel):
blocks: list[Block] = []
Loading