diff --git a/src/instruction.rs b/src/instruction.rs new file mode 100644 index 0000000..fe402f5 --- /dev/null +++ b/src/instruction.rs @@ -0,0 +1,17 @@ +#[derive(Debug)] +pub enum InstructionType { + Increment, + Decrement, + Leftshift, + Rightshift, + PutChar, + GetChar, + JumpIfZero, + JumpIfNotZero, +} + +#[derive(Debug)] +pub struct Instruction { + pub itype: InstructionType, + pub argument: usize, +} diff --git a/src/lib.rs b/src/lib.rs index c685ad7..39a47dc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1 +1,3 @@ pub mod machine; +pub mod parser; +pub mod instruction; diff --git a/src/machine.rs b/src/machine.rs index 8c7f524..65c2e0d 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -1,22 +1,6 @@ use std::io::{BufReader, BufWriter, Read, Write}; -#[derive(Debug)] -pub enum InstructionType { - Increment, - Decrement, - Leftshift, - Rightshift, - PutChar, - GetChar, - JumpIfZero, - JumpIfNotZero, -} - -#[derive(Debug)] -pub struct Instruction { - pub itype: InstructionType, - pub argument: usize, -} +use crate::instruction::{Instruction, InstructionType}; pub struct Machine<'a> { ip: usize, diff --git a/src/parser.rs b/src/parser.rs new file mode 100644 index 0000000..e69de29