move instructions to its seperate crate
This commit is contained in:
17
src/instruction.rs
Normal file
17
src/instruction.rs
Normal file
@@ -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,
|
||||
}
|
||||
@@ -1 +1,3 @@
|
||||
pub mod machine;
|
||||
pub mod parser;
|
||||
pub mod instruction;
|
||||
|
||||
@@ -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,
|
||||
|
||||
0
src/parser.rs
Normal file
0
src/parser.rs
Normal file
Reference in New Issue
Block a user