use crate::states::{CompilerState, CompilerStates};
use std::sync::Arc;
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Compiler {
state: Arc<CompilerState>,
}
impl Compiler {
pub fn set_state(&mut self, state: CompilerStates) -> &Self {
self.state = Arc::new(CompilerState::new(None, None, Some(state)));
self
}
pub fn init(&mut self) -> &Self {
self.set_state(CompilerStates::init());
self
}
pub fn read_input(&mut self) -> &Self {
self.set_state(CompilerStates::read());
self
}
pub fn compile(&mut self) -> &Self {
self.set_state(CompilerStates::compile());
self
}
pub fn write_output(&mut self) -> &Self {
self.set_state(CompilerStates::write());
self
}
pub fn finish(&mut self) -> &Self {
self.set_state(CompilerStates::complete());
self
}
pub fn run(&mut self) {
}
}