Repository navigation
v0.6.0-alpha
Pre-release
Pre-release
TeapotLang v0.6.0-alpha
Semantic analysis
- Reworked the
Symbolmodel to separate declaration scope from owned scope:scopenow consistently means the scope a symbol is declared in.- A new
child_scopefield represents the scope a symbol owns (e.g. a function's body scope, a struct's field scope). Previouslyscopeconflated both meanings depending on symbol kind, which made function and variable symbols behave inconsistently. - Removed the now-redundant
paramsfield fromSymbol.
- Added real semantic support for struct fields, enum declarations, enum members, error declarations, and error members. These were previously unregistered and would raise
SemanticError("Unknown node") when encountered.- New handlers:
register_struct_field,register_enum,register_enum_member,register_error,register_error_member. - Structs, enums, and errors now each get their own child
SymbolTable, so their members are scoped correctly rather than being ignored or leaking into the enclosing scope.
- New handlers:
Tests and fixtures
- Added
examples/fixtures/parser-sem-an.tp, a larger end-to-end fixture exercising structs, enums, errors, and operators together. - Rewrote
examples/fixtures/semanticanalysis.tpto include enum and error declarations, which it previously omitted. - Updated the semantic and integration test suites to assert against
child_scopeinstead ofscopefor functions and structs, and added new coverage for enum, error, and struct-field registration, plus nested-function scope-chain behaviour.
Notes
This release focuses entirely on internal semantic-analysis structure and does not change the language surface, parser grammar, or CLI behaviour. Code generation and executable output remain unimplemented.