feat(ast): add type system declaration nodes

Added AST structures for new type system:
- ConceptDecl: Base type definition
- SubConceptDecl: Enum or record subtype with SubConceptKind
- ConceptComparisonDecl: Compile-time enum mapping
- ConceptMapping: Individual mapping entry

Added Declaration enum variants and stubs throughout codebase
for LSP, resolve, and semantic analysis modules.
This commit is contained in:
2026-02-13 22:41:03 +00:00
parent f258a526e3
commit 6e3b35e68f
8 changed files with 81 additions and 0 deletions

View File

@@ -70,6 +70,9 @@ pub enum Declaration {
Location(Location),
Species(Species),
Enum(EnumDecl),
Concept(ConceptDecl),
SubConcept(SubConceptDecl),
ConceptComparison(ConceptComparisonDecl),
}
/// Use statement for importing definitions
@@ -414,6 +417,46 @@ pub struct EnumDecl {
pub span: Span,
}
/// Concept declaration - base type definition
#[derive(Debug, Clone, PartialEq)]
pub struct ConceptDecl {
pub name: String,
pub span: Span,
}
/// Sub-concept declaration - enum or record subtype
#[derive(Debug, Clone, PartialEq)]
pub struct SubConceptDecl {
pub name: String,
pub parent_concept: String,
pub kind: SubConceptKind,
pub span: Span,
}
/// Sub-concept can be either enum-like or record-like
#[derive(Debug, Clone, PartialEq)]
pub enum SubConceptKind {
Enum { variants: Vec<String> },
Record { fields: Vec<Field> },
}
/// Concept comparison - compile-time enum mapping between two concepts
#[derive(Debug, Clone, PartialEq)]
pub struct ConceptComparisonDecl {
pub name: String,
pub left_concept: String,
pub right_concept: String,
pub mappings: Vec<ConceptMapping>,
pub span: Span,
}
/// A single mapping entry in a concept comparison
#[derive(Debug, Clone, PartialEq)]
pub struct ConceptMapping {
pub left_variant: String,
pub right_variant: String,
}
/// Expression AST for conditions and queries
#[derive(Debug, Clone, PartialEq)]
pub enum Expr {