summaryrefslogtreecommitdiff
path: root/src/addressing.rs
diff options
context:
space:
mode:
authorBen Bridle <bridle.benjamin@gmail.com>2024-10-28 19:52:29 +1300
committerBen Bridle <bridle.benjamin@gmail.com>2024-10-28 19:52:47 +1300
commitf4027cae775e3c9c237675f9df35a744d54f3f2e (patch)
tree733fa3af9e1bd44d61dd83983a2da86cb75c53e9 /src/addressing.rs
parent16ee0e9e8dce2c88acc88ba5ffd97e013624fa5e (diff)
downloadbedrock-asm-f4027cae775e3c9c237675f9df35a744d54f3f2e.zip
Rewrite assembler
This is an almost complete rewrite of the entire assembler from the ground up, with a different parsing strategy and a whole new symbol resolution mechanism for automatically including library files. The assembly syntax has also been slightly modified, with padding tokens now being prefixed with '#' instead of '$', and a block-style anonymous-label syntax which uses the '{' and '}' characters.
Diffstat (limited to 'src/addressing.rs')
-rw-r--r--src/addressing.rs44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/addressing.rs b/src/addressing.rs
deleted file mode 100644
index dd7638e..0000000
--- a/src/addressing.rs
+++ /dev/null
@@ -1,44 +0,0 @@
-#[derive(Clone,Copy)]
-pub struct CharAddress {
- /// The number of lines that precede this line in the file.
- pub line:usize,
- /// The number of characters that precede this character in the line.
- pub column:usize,
-}
-impl CharAddress {
- pub fn new(line:usize, column:usize) -> Self {
- Self { line, column }
- }
- pub fn zero() -> Self {
- Self::new(0,0)
- }
-}
-
-pub struct SourceLocation {
- /// The slice of the source file from which this token was parsed.
- pub source: String,
- /// The address of the first character of this token.
- pub start: CharAddress,
- /// The address of the final character of this token.
- pub end: CharAddress
-}
-impl SourceLocation {
- pub fn new(source:String, start:CharAddress, end:CharAddress) -> Self {
- Self { source, start, end }
- }
- pub fn zero() -> Self {
- Self { source:String::new(), start:CharAddress::zero(), end:CharAddress::zero() }
- }
-}
-
-pub struct BytecodeLocation {
- /// The number of bytes that precede this byte sequence in the bytecode.
- pub start: u16,
- /// The length of this byte sequence, in bytes.
- pub length: u16,
-}
-impl BytecodeLocation {
- pub fn zero() -> Self {
- Self { start:0, length:0 }
- }
-}