renamed language, added operator precedence

This commit is contained in:
2026-07-09 08:21:55 -05:00
parent 3c7cd3c4c7
commit 9a0716ced0
5 changed files with 47 additions and 6 deletions
+9
View File
@@ -8,6 +8,15 @@ pub enum Operator {
Slash, // division
}
impl Operator {
pub fn get_precedence(&self) -> usize {
match self {
Operator::Plus | Operator::Minus => 0,
Operator::Star | Operator::Slash => 1,
}
}
}
pub fn parse_operator(input: &str) -> Option<(Token, &str)> {
let c: char = input.chars().next()?;
let input = &input[1..];