Correction to docs and type def

This commit is contained in:
Claudio Maggioni 2018-12-12 20:41:31 +01:00
parent f5491a2b44
commit bdb2b33c01
3 changed files with 11 additions and 7 deletions

Binary file not shown.

View File

@ -75,7 +75,7 @@ The entire program revolves around the main struct defined as:\\
; - output: String\\
; - program: Program\\
; - ip: InstructionPointer\\
; - error: Option<ErrorCode>\\
; - error: Option<String>\\
; 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.

View File

@ -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<ErrorCode>
; - error: Option<String>
; Interpretation: the current state of execution of a brainf*ck program.
(struct prog-state (tape dp tape-len output program ip error)
#:transparent