continued on register allocator rewrite, slow progress as scoping is

proving to be a challenge
This commit is contained in:
2026-02-14 02:46:29 +00:00
parent d66baf6f99
commit 201b18069b
10 changed files with 1153 additions and 790 deletions
+10 -9
View File
@@ -289,12 +289,7 @@ pub enum Expression {
// Post-Semantic Analysis
type_id: Option<TypeId>,
},
Number {
value: isize,
// Post-Semantic Analysis
type_id: Option<TypeId>,
},
Number(Number),
StringLiteral(String),
CharLiteral(char),
ArrayLiteral {
@@ -308,6 +303,12 @@ pub enum Expression {
},
}
#[derive(Debug, Clone)]
pub enum Number {
Signed(i32, Option<TypeId>),
Unsigned(u32, Option<TypeId>),
}
#[derive(Debug, Clone)]
pub struct Call {
pub name: Name,
@@ -342,9 +343,9 @@ impl Expression {
pub fn type_id(&self) -> Result<TypeId, CompilerError> {
match self {
Expression::Number { type_id, .. } => {
type_id.clone().ok_or(CompilerError::UnknownType)
}
Expression::Number(
Number::Signed(_, type_id) | Number::Unsigned(_, type_id),
) => type_id.clone().ok_or(CompilerError::UnknownType),
Expression::StringLiteral(_) => Ok(TypeId::Ptr(Box::new(TypeId::Char))),
Expression::CharLiteral(_) => Ok(TypeId::Char),
Expression::Call { type_id, .. } => {