diff options
1 files changed, 25 insertions, 0 deletions
| -rw-r--r-- | assembler/src/parser/mod.rs | 25 |
diff --git a/assembler/src/parser/mod.rs b/assembler/src/parser/mod.rs index 79b8835..d43b9c5 100644 --- a/assembler/src/parser/mod.rs +++ b/assembler/src/parser/mod.rs @@ -1,5 +1,6 @@ mod code_gen; mod syntax; +mod semantic; mod instruction; use std::{ @@ -53,6 +54,30 @@ impl Address { *self = Address::None; val } + + fn is_memory(&self) -> bool { + if let Address::Memory(_) = &self { true } else { false } + } + + fn is_constant(&self) -> bool { + if let Address::Constants(_) = &self { true } else { false } + } + + fn is_instruction(&self) -> bool { + if let Address::Instruction(_) = &self { true } else { false } + } + + fn is_definition(&self) -> bool { + if let Address::Definitions(_) = &self { true } else { false } + } + + fn is_none(&self) -> bool { + if let Address::None = &self { true } else { false } + } + + fn is_location(&self) -> bool { + self.is_memory() || self.is_instruction() + } } #[derive(Debug, Default, Clone)] |
