Added comment-emission to the compiler

This commit is contained in:
2024-05-03 21:04:57 -05:00
parent 72e980a2db
commit bde91901e2
8 changed files with 96 additions and 16 deletions
+17
View File
@@ -224,3 +224,20 @@ impl From<&str> for Expr {
Self::Name(String::from(value))
}
}
impl Statement {
pub fn description(&self) -> String {
String::from(
match self {
Statement::Return(_) => "return",
Statement::Assignment(_) => "assignment",
Statement::Expr(_) => "expr",
Statement::VarDecl(_) => "varDecl",
Statement::Conditional(_) => "conditional",
Statement::WhileLoop(_) => "whileLoop",
Statement::RepeatLoop(_) => "repeatLoop",
Statement::Asm(_) => "asm"
}
)
}
}