diff --git a/README.pdf b/README.pdf index af4bbfb..b52ee09 100644 Binary files a/README.pdf and b/README.pdf differ diff --git a/README.tex b/README.tex index fa72d97..b8f441c 100644 --- a/README.tex +++ b/README.tex @@ -75,7 +75,7 @@ The entire program revolves around the main struct defined as:\\ ; - output: String\\ ; - program: Program\\ ; - ip: InstructionPointer\\ -; - error: Option\\ +; - error: Option\\ ; Interpretation: the current state of execution of a brainf*ck program.\\ \\ \textbf{\large (struct prog-state (tape dp tape-len output program ip error)}} @@ -94,14 +94,16 @@ And, likewise, each term in the struct has its own type definition: \\ ; - "+" (add1)\\ ; - "-" (sub1)\\ ; - "." (out)\\ -; - ","\\ +; - "," (in)\\ ; - "[" (loop-start)\\ ; - "]" (loop-end)\\ ; Interpretation: the brainf*ck program.\\\\ ; A InstructionPointer (IP) is a NonNegInt\\ ; Interpretation: a pointer to the instruction to execute.\\\\ ; An ErrorCode is one of:\\ -; - 'error1\\ +; - 'error1 (Interp: negative tape position when <)\\ +; - 'error2 (Interp: non-matching [)\\ +; - 'error3 (Interp: non-matching ])\\ ; Interpretation: an error code for the bf interpreter.} \subsubsection{Execute Function} @@ -129,7 +131,7 @@ List of helper functions for execute: \item[] \textbf{\large \texttt{exec-sub1}}:\\ ProgState -$>$ ProgState\\ Given a ProgState, returns a new ProgState with the $-$ instruction executed. -\item[] \textbf{\large \texttt{exec-out}}:\\ ProgState -$>$ ProgState\\ Given a ProgState, returns a new ProgState with the . instruction executed. +\item[] \textbf{\large \texttt{exec-out}}:\\ ProgState -$>$ ProgState\\ Given a ProgState, returns a new ProgState with the $.$ instruction executed. \item[] \textbf{\large \texttt{exec-loop-start}}:\\ ProgState -$>$ ProgState\\ Given a ProgState, returns a new ProgState with the $[$ instruction executed. diff --git a/interpreter.rkt b/interpreter.rkt index 570b8a8..dbd5d79 100644 --- a/interpreter.rkt +++ b/interpreter.rkt @@ -29,7 +29,7 @@ ; - "+" (add1) ; - "-" (sub1) ; - "." (out) -; - "," +; - "," (in) ; - "[" (loop-start) ; - "]" (loop-end) ; Interpretation: the brainf*ck program. @@ -38,7 +38,9 @@ ; Interpretation: a pointer to the instruction to execute. ; An ErrorCode is one of: -; - 'error1 +; - 'error1 (Interp: negative tape position when <) +; - 'error2 (Interp: non-matching [) +; - 'error3 (Interp: non-matching ]) ; Interp: an error code for the bf interpreter. ; A ProgState is a (prog-state tape dp output program ip) where: @@ -48,7 +50,7 @@ ; - output: String ; - program: Program ; - ip: InstructionPointer -; - error: Option +; - error: Option ; Interpretation: the current state of execution of a brainf*ck program. (struct prog-state (tape dp tape-len output program ip error) #:transparent