Files
kraken/doc/Manual.tex
2015-11-17 18:31:04 -05:00

150 lines
5.7 KiB
TeX

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Kraken Documentation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------------------------------------------------
% PACKAGES AND DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
\documentclass{article}
\usepackage{graphicx} % Required for the inclusion of images
\usepackage{amsmath} % Required for some math elements
\renewcommand{\labelenumi}{\alph{enumi}.} % Make numbering in the enumerate environment by letter rather than number (e.g. section 6)
\usepackage{times} % Uncomment to use the Times New Roman font
\usepackage{listings}
%----------------------------------------------------------------------------------------
% DOCUMENT INFORMATION
%----------------------------------------------------------------------------------------
\title{Kraken Programming Guide} % Title
\author{Jack \textsc{Sparrow}} % Author name
\date{\today} % Date for the report
\begin{document}
\maketitle % Insert the title, author and date
%----------------------------------------------------------------------------------------
% SECTION Compiling
%----------------------------------------------------------------------------------------
\section{Compiling}
Kraken compilation currently only supports building the compiler from source.
You can clone the repository from a terminal using:
\begin{lstlisting}
git clone https://github.com/Limvot/kraken.git
\end{lstlisting}
Once you have the repository, run the following commands:
\begin{lstlisting}
mkdir build %Create a build directory
cd build
cmake .. %Requires cmake to build the compiler
make %Create the compiler executable
\end{lstlisting}
This will create a kraken executable, which is how we will call the compiler.
Kraken supports several ways of invoking the compiler. These include:
\begin{lstlisting}
kraken source.krak
kraken source.krak outputExe
kraken grammarFile.kgm source.krak outputExe
\end{lstlisting}
The grammar file is a file specific to the compiler, and should be included
in the github repository. When you run the compile command, a new directory
with the name of the outputExe you specified will be created. In this directory
is a shell script, which will compile the created C file into a binary executable.
This binary exectuable can then be run as a normal C executable.
%----------------------------------------------------------------------------------------
% SECTION Variables
%----------------------------------------------------------------------------------------
\section{Variables}
\label{sec:var}
Kraken has automatic type deduction. This is sort of like the duck typing of
Python. The difference is that variables cannot change types. In this way, it
is much more like an implicit "auto" keyword in C++. Unlike C++, semicolons are
optional after declarations.
\subsection{Variable Declaration}
\begin{lstlisting}[language=C++]
var A: int; //A is unitialized int
var B = 1; //B is integer
var C = 2.0; //C is double
var D: float = 3.14 //D is double
\end{lstlisting}
\subsection{Primitive Types}
The primitive types found in kraken are:
\begin{enumerate}
\item int
\item float
\item double
\item char
\item bool
\item void
\end{enumerate}
%----------------------------------------------------------------------------------------
% SECTION 2: Functions
%----------------------------------------------------------------------------------------
\section{Functions}
Section func
%----------------------------------------------------------------------------------------
% SECTION I/O
%----------------------------------------------------------------------------------------
\section{Input and Output}
%----------------------------------------------------------------------------------------
% SECTION Memory Management
%----------------------------------------------------------------------------------------
\section{Memory Management}
\subsection{Pointers}
\subsection{References}
\subsection{Dynamic Memory Allocation}
%----------------------------------------------------------------------------------------
% SECTION Classes
%----------------------------------------------------------------------------------------
\section{Classes}
\subsection{Constructors}
\subsection{Operator Overloading}
\subsection{Inheritance}
%----------------------------------------------------------------------------------------
% SECTION Templates
%----------------------------------------------------------------------------------------
\section{Templates}
Section T
%----------------------------------------------------------------------------------------
% SECTION Standard Library
%----------------------------------------------------------------------------------------
\section{Standard Library}
\subsection{Import Statements}
\subsection{Vector}
\subsection{String}
\subsection{Regex}
\subsection{Util}
\subsection{Data Structures}
\subsubsection{Stack}
\subsubsection{Queue}
\subsubsection{Set}
\subsubsection{Map}
%----------------------------------------------------------------------------------------
% SECTION Understanding Kraken Errors
%----------------------------------------------------------------------------------------
\section{Understanding Kraken Errors}
Section error
%----------------------------------------------------------------------------------------
% SECTION C Passthrough
%----------------------------------------------------------------------------------------
\section{C Passthrough}
\end{document}