Parser Pipeline
This page describes how custom Tython syntax is processed internally.
parse_custom Flow
- Normalize source input.
- Rewrite custom syntax:
- strict import forms (
import pkg/mod as alias,import "./file.ty" as alias,pyimport module [as alias]) - brace blocks (
{}) funcdeclarations- checked error syntax (
throws,catch,try expr) recorddeclarations and literalsclassdeclarations (init,setup,pub,is)- enums
const/varbinding declarations- lowercase literals (
true,false,none) - Parse rewritten code into Python AST.
- Run semantic checks (scope, naming, mutability, declarations, conservative typing, class/record conformance).
- Lower custom IR nodes (bindings, enums, records/classes, record literals, strict imports) into final Python AST.
Stable Public API
The parser-facing API remains:
parseparse_customlower
from parser/core.py.