diff options
| Commit | 9517d3d05e86621b6c4ed58edd7f5821632e0872 (patch) | |
|---|---|---|
| Author | 2025-02-14 08:23:08 +0200 | |
| Committer | 2025-02-14 08:24:27 +0200 | |
| Files | 2d633e6452e8167bada5db90d061cbdbd8ffcf89 /assembler/src/parser/mod.rs | |
| tonkobali-9517d3d05e86621b6c4ed58edd7f5821632e0872.tar tonkobali-9517d3d05e86621b6c4ed58edd7f5821632e0872.tar.gz tonkobali-9517d3d05e86621b6c4ed58edd7f5821632e0872.zip | ||
| Parent | 2cf1097e124c5a0c5836987416b080b6aa4cdd0f (diff) | |
feat(assembler): Implemented semantic analysis
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)] |
