21 lines
863 B
Rust
21 lines
863 B
Rust
// © 2023 John Breaux
|
|
/// TODO: tree traversal and label resolution
|
|
use crate::parser::preamble::*;
|
|
pub trait Visitor<T> {
|
|
// visit_node for all nodes
|
|
fn visit_register(&mut self, r: &Register) -> T;
|
|
fn visit_number(&mut self, n: &Number) -> T;
|
|
fn visit_width(&mut self, w: &Width) -> T;
|
|
fn visit_primary_operand(&mut self, p: &PrimaryOperand) -> T;
|
|
fn visit_secondary_operand(&mut self, d: &SecondaryOperand) -> T;
|
|
fn visit_jump_target(&mut self, t: &JumpTarget) -> T;
|
|
fn visit_encoding(&mut self, e: &Encoding) -> T;
|
|
fn visit_opcode(&mut self, o: &Opcode) -> T;
|
|
fn visit_instruction(&mut self, i: &Instruction) -> T;
|
|
fn visit_directive(&mut self, d: &Directive) -> T;
|
|
// the most important one: resolve identifiers
|
|
fn visit_identifier(&mut self, i: &Identifier) -> T;
|
|
}
|
|
/// TODO: [Linker]
|
|
pub struct Linker;
|