Correction to docs and type def
This commit is contained in:
parent
f5491a2b44
commit
bdb2b33c01
3 changed files with 11 additions and 7 deletions
BIN
README.pdf
BIN
README.pdf
Binary file not shown.
10
README.tex
10
README.tex
|
@ -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.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue