1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use crate::parser::instruction::Instruction;
use std::collections::HashMap;

use super::operand::CellAddress;

#[derive(Debug, PartialEq, Eq, Clone)]
pub struct RamCode {
    pub instructions: Vec<Instruction>,
    pub jump_table: HashMap<String, CellAddress>,
}

impl RamCode {
    pub fn new() -> RamCode {
        RamCode {
            instructions: Vec::new(),
            jump_table: HashMap::new(),
        }
    }

    pub fn add_instruction(&mut self, instruction: Instruction) {
        self.instructions.push(instruction)
    }
}