From 13b95941183666fadd090314e4e9af33283084cd Mon Sep 17 00:00:00 2001 From: Sophie Forrest Date: Fri, 30 Aug 2024 23:35:45 +1200 Subject: feat(engine)!: implement u32 engine --- src/executor.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/executor.rs') diff --git a/src/executor.rs b/src/executor.rs index eddf443..da7d676 100644 --- a/src/executor.rs +++ b/src/executor.rs @@ -9,14 +9,14 @@ use crate::{engine::Engine, parser::Instruction}; /// Runtime errors that can occur in brainfuck executor. #[derive(Debug, Diagnostic, Error)] pub enum Error { + /// Brainfuck engine ran into an error at runtime. + #[error(transparent)] + Engine(#[from] crate::engine::Error), + /// Brainfuck code performed an out of bounds index on the tape during /// runtime. #[error("tape indexed out of bounds, attempted index at `{0}`")] IndexOutOfBounds(usize), - - /// Executor was unable to read an input byte from stdin. - #[error("could not read input from stdin")] - ReadInput(#[from] std::io::Error), } /// Struct for executor implementation, allows u8 Engine to be implemented. @@ -27,6 +27,10 @@ pub struct U8; #[derive(Clone, Copy, Debug)] pub struct U16; +/// Struct for executor implementation, allows u32 Engine to be implemented. +#[derive(Clone, Copy, Debug)] +pub struct U32; + /// Executes the provided instruction set, utilising the provided tape.. /// /// # Errors -- cgit 1.4.1