62 lines
No EOL
2.6 KiB
TeX
62 lines
No EOL
2.6 KiB
TeX
\documentclass[12pt]{scrartcl}
|
|
\title{DrBrainfuck Documentation}
|
|
\author{Tommaso Rodolfo Masera \and Claudio Maggioni}
|
|
\date{December 2018}
|
|
|
|
\usepackage[margin=2cm]{geometry}
|
|
|
|
\newcommand{\brainfuck}{\emph{Brainf*ck }}
|
|
|
|
\begin{document}
|
|
\maketitle
|
|
\tableofcontents
|
|
|
|
\section{User Level}
|
|
|
|
\subsection{Brief Introduction to \brainfuck}
|
|
|
|
\brainfuck is a programming language supposed to resemble a working Turing machine and it consists of only eight commands.
|
|
|
|
A program written in \brainfuck makes use of sequences of these commands and
|
|
said sequence might actually have other characters in between that are promptly ignored and treated as comments instead.
|
|
|
|
The way \brainfuck works includes a program and an instruction pointer, an array of
|
|
byte cells initialized to 0 as well as a movable data pointer, starting from the leftmost
|
|
position, to address such cells with the given instructions.
|
|
What's more \brainfuck makes use of the ASCII encoding for inputs and outputs.
|
|
|
|
The eight commands \brainfuck is based on are the following:
|
|
\begin{itemize}
|
|
|
|
\item[] \texttt{\textbf{\Large >}} : increments the data pointer to point the cell to the right;
|
|
\item[] \texttt{\textbf{\Large <}} : decrements the data pointer to point the cell to the left;
|
|
\item[] \texttt{\textbf{\Large +}} : increases by one the byte at the data pointer;
|
|
\item[] \texttt{\textbf{\Large -}} : decreases by one the byte at the data pointer;
|
|
\item[] \texttt{\textbf{\Large .}} : prints as output the byte at the data pointer;
|
|
\item[] \texttt{\textbf{\Large ,}} : asks for an input to store in the byte at the data pointer;
|
|
\item[] \texttt{\textbf{\Large [}} : if the byte at the data pointer is zero, jumps forward to the command after the matching \texttt{\textbf{]}} command instead of advancing the instruction pointer to the next instruction;
|
|
\item[] \texttt{\textbf{\Large ]}} : if the byte at the data pointer is non-zero, jumps backward to the command before the matching \texttt{\textbf{[}} command instead of advancing the instruction pointer to the next instruction;
|
|
|
|
\end{itemize}
|
|
|
|
\subsection{About the Interpreter}
|
|
|
|
\subsubsection{Running the Program}
|
|
You have two different options to run the program: a GUI and a CLI.
|
|
|
|
For the GUI open the ``\texttt{gui.rkt}'' file from either the `DrRacket' environment or the
|
|
Racket CLI tool.
|
|
|
|
As for the CLI version of the program you should use the ``\texttt{./cli.rkt}'' command followed by your ``\texttt{filename.bf}'' \brainfuck file that you want to execute.
|
|
|
|
\subsubsection{Current Features}
|
|
|
|
\textbf{\large TODO}
|
|
|
|
\section{Developer Level}
|
|
|
|
\subsection{Interpreter Execution}
|
|
|
|
\textbf{\large TODO}
|
|
|
|
\end{document} |