Merge branch 'master' of github.com:Limvot/kraken

This commit is contained in:
Nathan Braswell
2015-12-01 16:19:52 -05:00
5 changed files with 249 additions and 135 deletions

View File

@@ -2,11 +2,29 @@
\@writefile{toc}{\contentsline {section}{\numberline {1}Compiling}{1}}
\@writefile{toc}{\contentsline {section}{\numberline {2}Variables}{1}}
\newlabel{sec:var}{{2}{1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Variable Declaration}{1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Primitive Types}{1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Variable Declaration}{2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Primitive Types}{2}}
\@writefile{toc}{\contentsline {section}{\numberline {3}Functions}{2}}
\@writefile{toc}{\contentsline {section}{\numberline {4}Classes}{2}}
\@writefile{toc}{\contentsline {section}{\numberline {5}Templates}{2}}
\@writefile{toc}{\contentsline {section}{\numberline {6}Standard Library}{2}}
\@writefile{toc}{\contentsline {section}{\numberline {7}Understanding Kraken Errors}{2}}
\@writefile{toc}{\contentsline {section}{\numberline {8}Answers to Definitions}{2}}
\@writefile{toc}{\contentsline {section}{\numberline {4}Input and Output}{2}}
\@writefile{toc}{\contentsline {section}{\numberline {5}Memory Management}{3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1}Pointers}{3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {5.2}References}{3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {5.3}Dynamic Memory Allocation}{4}}
\@writefile{toc}{\contentsline {section}{\numberline {6}Classes}{4}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1}Constructors}{4}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.2}Operator Overloading}{4}}
\@writefile{toc}{\contentsline {subsection}{\numberline {6.3}Inheritance}{4}}
\@writefile{toc}{\contentsline {section}{\numberline {7}Templates}{4}}
\@writefile{toc}{\contentsline {section}{\numberline {8}Standard Library}{5}}
\@writefile{toc}{\contentsline {subsection}{\numberline {8.1}Import Statements}{5}}
\@writefile{toc}{\contentsline {subsection}{\numberline {8.2}Vector}{5}}
\@writefile{toc}{\contentsline {subsection}{\numberline {8.3}String}{5}}
\@writefile{toc}{\contentsline {subsection}{\numberline {8.4}Regex}{5}}
\@writefile{toc}{\contentsline {subsection}{\numberline {8.5}Util}{5}}
\@writefile{toc}{\contentsline {subsection}{\numberline {8.6}Data Structures}{5}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {8.6.1}Stack}{5}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {8.6.2}Queue}{5}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {8.6.3}Set}{5}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {8.6.4}Map}{5}}
\@writefile{toc}{\contentsline {section}{\numberline {9}Understanding Kraken Errors}{5}}
\@writefile{toc}{\contentsline {section}{\numberline {10}C Passthrough}{5}}

View File

@@ -1,12 +1,22 @@
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Arch Linux) (preloaded format=pdflatex 2015.9.17) 18 OCT 2015 15:27
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9) (preloaded format=pdflatex 2015.9.2) 26 NOV 2015 18:56
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**\nonstopmode \input{Manual.tex}
(./Manual.tex (/usr/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
**Manual.tex
(C:\Users\Chris\Documents\GitHub\kraken\doc\Manual.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, afrikaans, ancientgreek, ar
abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan, coptic,
croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, ga
lician, german, german-x-2013-05-26, greek, gujarati, hindi, hungarian, iceland
ic, indonesian, interlingua, irish, italian, kannada, kurmanji, latin, latvian,
lithuanian, malayalam, marathi, mongolian, mongolianlmc, monogreek, ngerman, n
german-x-2013-05-26, nynorsk, oriya, panjabi, pinyin, polish, portuguese, roman
ian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, swissgerm
an, tamil, telugu, turkish, turkmen, ukenglish, ukrainian, uppersorbian, usengl
ishmax, welsh, loaded.
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\size10.clo"
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
@@ -20,31 +30,31 @@ File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/share/texmf-dist/tex/latex/graphics/graphicx.sty
Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
(/usr/share/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\keyval.sty"
Package: keyval 1999/03/16 v1.13 key=value parser (DPC)
\KV@toks@=\toks14
)
(/usr/share/texmf-dist/tex/latex/graphics/graphics.sty
Package: graphics 2014/10/28 v1.0p Standard LaTeX Graphics (DPC,SPQR)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
(/usr/share/texmf-dist/tex/latex/graphics/trig.sty
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\trig.sty"
Package: trig 1999/03/16 v1.09 sin cos tan (DPC)
)
(/usr/share/texmf-dist/tex/latex/latexconfig/graphics.cfg
File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\00miktex\graphics.cfg"
File: graphics.cfg 2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
)
Package graphics Info: Driver file: pdftex.def on input line 94.
Package graphics Info: Driver file: pdftex.def on input line 91.
(/usr/share/texmf-dist/tex/latex/pdftex-def/pdftex.def
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def"
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
(/usr/share/texmf-dist/tex/generic/oberdiek/infwarerr.sty
("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty"
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO)
)
(/usr/share/texmf-dist/tex/generic/oberdiek/ltxcmds.sty
("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty"
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
)
\Gread@gobject=\count87
@@ -52,24 +62,24 @@ Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
\Gin@req@height=\dimen103
\Gin@req@width=\dimen104
)
(/usr/share/texmf-dist/tex/latex/amsmath/amsmath.sty
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amsmath.sty"
Package: amsmath 2013/01/14 v2.14 AMS math features
\@mathmargin=\skip43
For additional information on amsmath, use the `?' option.
(/usr/share/texmf-dist/tex/latex/amsmath/amstext.sty
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amstext.sty"
Package: amstext 2000/06/29 v2.01
(/usr/share/texmf-dist/tex/latex/amsmath/amsgen.sty
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amsgen.sty"
File: amsgen.sty 1999/11/30 v2.0
\@emptytoks=\toks15
\ex@=\dimen105
))
(/usr/share/texmf-dist/tex/latex/amsmath/amsbsy.sty
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amsbsy.sty"
Package: amsbsy 1999/11/29 v1.2d
\pmbraise@=\dimen106
)
(/usr/share/texmf-dist/tex/latex/amsmath/amsopn.sty
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amsopn.sty"
Package: amsopn 1999/12/14 v2.01 operator names
)
\inf@bad=\count88
@@ -110,10 +120,10 @@ LaTeX Font Info: Redeclaring font encoding OMS on input line 567.
LaTeX Info: Redefining \[ on input line 2665.
LaTeX Info: Redefining \] on input line 2666.
)
(/usr/share/texmf-dist/tex/latex/psnfss/times.sty
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\psnfss\times.sty"
Package: times 2005/04/12 PSNFSS-v9.2a (SPQR)
)
(/usr/share/texmf-dist/tex/latex/listings/listings.sty
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\listings\listings.sty"
\lst@mode=\count100
\lst@gtempboxa=\box28
\lst@token=\toks20
@@ -127,37 +137,44 @@ Package: times 2005/04/12 PSNFSS-v9.2a (SPQR)
\lst@lineno=\count105
\lst@maxwidth=\dimen117
(/usr/share/texmf-dist/tex/latex/listings/lstmisc.sty
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\listings\lstmisc.sty"
File: lstmisc.sty 2015/06/04 1.6 (Carsten Heinz)
\c@lstnumber=\count106
\lst@skipnumbers=\count107
\lst@framebox=\box29
)
(/usr/share/texmf-dist/tex/latex/listings/listings.cfg
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\listings\listings.cfg"
File: listings.cfg 2015/06/04 1.6 listings configuration
))
Package: listings 2015/06/04 1.6 (Carsten Heinz)
(./Manual.aux)
\openout1 = `Manual.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 28.
LaTeX Font Info: ... okay on input line 28.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 28.
LaTeX Font Info: ... okay on input line 28.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 28.
LaTeX Font Info: ... okay on input line 28.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 28.
LaTeX Font Info: ... okay on input line 28.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 28.
LaTeX Font Info: ... okay on input line 28.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 28.
LaTeX Font Info: ... okay on input line 28.
LaTeX Font Info: Try loading font information for OT1+ptm on input line 28.
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\color.sty"
Package: color 2005/11/14 v1.0j Standard LaTeX Color (DPC)
(/usr/share/texmf-dist/tex/latex/psnfss/ot1ptm.fd
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\00miktex\color.cfg"
File: color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
)
Package color Info: Driver file: pdftex.def on input line 130.
)
(C:\Users\Chris\Documents\GitHub\kraken\doc\Manual.aux)
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 29.
LaTeX Font Info: ... okay on input line 29.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 29.
LaTeX Font Info: ... okay on input line 29.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 29.
LaTeX Font Info: ... okay on input line 29.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 29.
LaTeX Font Info: ... okay on input line 29.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 29.
LaTeX Font Info: ... okay on input line 29.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 29.
LaTeX Font Info: ... okay on input line 29.
LaTeX Font Info: Try loading font information for OT1+ptm on input line 29.
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\psnfss\ot1ptm.fd"
File: ot1ptm.fd 2001/06/04 font definitions for OT1/ptm.
)
(/usr/share/texmf-dist/tex/context/base/supp-pdf.mkii
("C:\Program Files (x86)\MiKTeX 2.9\tex\context\base\supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count108
\scratchdimen=\dimen118
@@ -170,107 +187,95 @@ File: ot1ptm.fd 2001/06/04 font definitions for OT1/ptm.
\MPnumerator=\count112
\makeMPintoPDFobject=\count113
\everyMPtoPDFconversion=\toks22
) (/usr/share/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO
)
(/usr/share/texmf-dist/tex/generic/oberdiek/ifluatex.sty
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO)
Package ifluatex Info: LuaTeX not detected.
)
(/usr/share/texmf-dist/tex/generic/oberdiek/ifpdf.sty
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO)
Package ifpdf Info: pdfTeX in PDF mode is detected.
)
Package pdftexcmds Info: LuaTeX not detected.
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.
)
(/usr/share/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf
(/usr/share/texmf-dist/tex/latex/oberdiek/grfext.sty
Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO)
(/usr/share/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty
Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO)
))
(/usr/share/texmf-dist/tex/latex/oberdiek/kvoptions.sty
Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO)
(/usr/share/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO)
(/usr/share/texmf-dist/tex/generic/oberdiek/etexcmds.sty
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
Package etexcmds Info: Could not find \expanded.
(etexcmds) That can mean that you are not using pdfTeX 1.50 or
(etexcmds) that some package has redefined \expanded.
(etexcmds) In the latter case, load this package earlier.
)))
Package grfext Info: Graphics extension search list:
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE
G,.JBIG2,.JB2,.eps]
(grfext) \AppendGraphicsExtensions on input line 452.
(/usr/share/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv
e
))
\c@lstlisting=\count114
LaTeX Font Info: Font shape `OT1/ptm/bx/n' in size <14.4> not available
(Font) Font shape `OT1/ptm/b/n' tried instead on input line 35.
(Font) Font shape `OT1/ptm/b/n' tried instead on input line 36.
LaTeX Font Info: Font shape `OT1/ptm/bx/n' in size <12> not available
(Font) Font shape `OT1/ptm/b/n' tried instead on input line 68.
(/usr/share/texmf-dist/tex/latex/listings/lstlang1.sty
(Font) Font shape `OT1/ptm/b/n' tried instead on input line 73.
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\listings\lstlang1.sty"
File: lstlang1.sty 2015/06/04 1.6 listings language file
)
(/usr/share/texmf-dist/tex/latex/listings/lstlang1.sty
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\listings\lstlang1.sty"
File: lstlang1.sty 2015/06/04 1.6 listings language file
)
(/usr/share/texmf-dist/tex/latex/listings/lstmisc.sty
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\listings\lstmisc.sty"
File: lstmisc.sty 2015/06/04 1.6 (Carsten Heinz)
)
LaTeX Font Info: Font shape `OT1/ptm/bx/n' in size <10> not available
(Font) Font shape `OT1/ptm/b/n' tried instead on input line 70.
LaTeX Font Info: Try loading font information for OMS+ptm on input line 70.
(Font) Font shape `OT1/ptm/b/n' tried instead on input line 75.
[1
(/usr/share/texmf-dist/tex/latex/psnfss/omsptm.fd
{C:/ProgramData/MiKTeX/2.9/pdftex/config/pdftex.map}]
LaTeX Font Info: Try loading font information for OMS+ptm on input line 97.
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\psnfss\omsptm.fd"
File: omsptm.fd
)
LaTeX Font Info: Font shape `OMS/ptm/m/n' in size <10> not available
(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 70.
LaTeX Font Info: Try loading font information for OML+ptm on input line 71.
(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 97.
(/usr/share/texmf-dist/tex/latex/psnfss/omlptm.fd
Overfull \hbox (81.00433pt too wide) in paragraph at lines 97--98
[][][][][][][][][][][][][][][][][][][][][][][][][][]
[]
[2]
Overfull \hbox (51.00403pt too wide) in paragraph at lines 130--131
[][][][][][][][][][][][][][][][][][][][][][][][]
[]
Overfull \hbox (15.00366pt too wide) in paragraph at lines 144--146
[][][][][][][][][][][][][][][][][][][][][][][][]
[]
Overfull \hbox (39.0039pt too wide) in paragraph at lines 150--152
[][][][][][][][][][][][][][][][][][][][][][]
[]
Overfull \hbox (21.00372pt too wide) in paragraph at lines 168--169
[][][][][][][][][][][][][][][][][][][][][][][][][]
[]
[3]
LaTeX Font Info: Try loading font information for OML+ptm on input line 197.
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\psnfss\omlptm.fd"
File: omlptm.fd
)
LaTeX Font Info: Font shape `OML/ptm/m/n' in size <10> not available
(Font) Font shape `OML/cmm/m/it' tried instead on input line 71.
[1
(Font) Font shape `OML/cmm/m/it' tried instead on input line 197.
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2] (./Manual.aux) )
Overfull \hbox (33.00385pt too wide) in paragraph at lines 197--198
[][][][][][][][][][][][][][][][][][][][][][][][][][]
[]
Overfull \hbox (87.0044pt too wide) in paragraph at lines 198--199
[][][][][][][][][][][][][][][][][][][][][][][][][][][]
[]
[4] [5] (C:\Users\Chris\Documents\GitHub\kraken\doc\Manual.aux) )
Here is how much of TeX's memory you used:
3541 strings out of 493089
48658 string characters out of 6140694
142499 words of memory out of 5000000
6978 multiletter control sequences out of 15000+600000
21052 words of font info for 45 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
39i,6n,60p,356b,1261s stack positions out of 5000i,500n,10000p,200000b,80000s
{/usr/
share/texmf-dist/fonts/enc/dvips/base/8r.enc}</usr/share/texmf-dist/fonts/type1
/public/amsfonts/cm/cmmi10.pfb></usr/share/texmf-dist/fonts/type1/public/amsfon
ts/cm/cmr10.pfb></usr/share/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pf
b></usr/share/texmf-dist/fonts/type1/urw/times/utmb8a.pfb></usr/share/texmf-dis
t/fonts/type1/urw/times/utmr8a.pfb></usr/share/texmf-dist/fonts/type1/urw/times
/utmri8a.pfb>
Output written on Manual.pdf (2 pages, 65177 bytes).
3293 strings out of 493921
44742 string characters out of 3144877
140396 words of memory out of 3000000
6566 multiletter control sequences out of 15000+200000
20598 words of font info for 43 fonts, out of 3000000 for 9000
841 hyphenation exceptions out of 8191
33i,6n,60p,335b,1580s stack positions out of 5000i,500n,10000p,200000b,50000s
{C:/Program Fi
les (x86)/MiKTeX 2.9/fonts/enc/dvips/fontname/8r.enc}<C:/Program Files (x86)/Mi
KTeX 2.9/fonts/type1/public/amsfonts/cm/cmmi10.pfb><C:/Program Files (x86)/MiKT
eX 2.9/fonts/type1/public/amsfonts/cm/cmsy10.pfb><C:/Program Files (x86)/MiKTeX
2.9/fonts/type1/urw/times/utmb8a.pfb><C:/Program Files (x86)/MiKTeX 2.9/fonts/
type1/urw/times/utmr8a.pfb><C:/Program Files (x86)/MiKTeX 2.9/fonts/type1/urw/t
imes/utmri8a.pfb>
Output written on Manual.pdf (5 pages, 75691 bytes).
PDF statistics:
36 PDF objects out of 1000 (max. 8388607)
25 compressed objects within 1 object stream
39 PDF objects out of 1000 (max. 8388607)
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)

Binary file not shown.

BIN
doc/Manual.synctex.gz Normal file

Binary file not shown.

View File

@@ -13,8 +13,9 @@
\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{times}
\usepackage{listings}
\usepackage{color}
%----------------------------------------------------------------------------------------
% DOCUMENT INFORMATION
%----------------------------------------------------------------------------------------
@@ -92,20 +93,110 @@ optional after declarations.
% SECTION 2: Functions
%----------------------------------------------------------------------------------------
\section{Functions}
Section func
\begin{lstlisting}[language=C++]
fun FunctionName(arg1 : arg1_type, arg2 : arg2_type) : returnType {
var result = arg1 + arg2;
return result;
}
\end{lstlisting}
Functions are declared using the {\bf{fun}} keyword. If you pass in
variables as shown, there will be passed by value, not by reference.
Therefore if you pass a variable in, it will not be modified outside the
function.
%----------------------------------------------------------------------------------------
% SECTION I/O
%----------------------------------------------------------------------------------------
\section{Input and Output}
In order to print to a terminal or file, the {\bf{io}} library must be
imported. There are a few different functions you can use to print to the
terminal.
The print() function will print out to the terminal without a newline
character. Like java, there is a println() function that will print whatever
you pass in, as well as a newline. There are also functions that can print
colors in a unix terminal. The color will continue when you print until
you call the function Reset().
\begin{enumerate}
\item {\color{red}{BoldRed()}}
\item {\color{green}{BoldGreen()}}
\item {\color{yellow}{BoldYellow()}}
\item {\color{blue}{BoldBlue()}}
\item {\color{magenta}{BoldMagneta()}}
\item {\color{cyan}{BoldCyan()}}
\end{enumerate}
\begin{lstlisting}[language=C++]
io::print(3.2); //print without a newline character
io::println(varA); //print variable A with a newline character
io::BoldRed();
io::println("This line is printed Red");
io::Reset();
io::println("This line is printed black");
\end{lstlisting}
You can also use kraken to read and write to files. The functions are as
follows:
\begin{lstlisting}[language=C++]
//returns true if file exists
var ifExists = io::file_exists("/usr/bin/clang");
//read file into string
var fileString = io::read_file("~/Documents/file.txt");
//write a string to the file
io::write_file("/",SteamString);
//read file into vector of chars
var charVec = io::read_file_binary("~/Documents/file2.txt");
//write a vector of chars to a file
io::write_file_binary("/",md5checkSum);
\end{lstlisting}
%----------------------------------------------------------------------------------------
% SECTION Memory Management
%----------------------------------------------------------------------------------------
\section{Memory Management}
\subsection{Pointers}
Pointers in kraken work like they do in C. The notation is the
{\bf{*}} symbol. This is a dereference operator. This means that it
operates on a pointer, and gives the variable pointed to. For
instance:
\begin{lstlisting}[language=C++]
var B: *int = 4; //B is a pointer to an integer 4
*B = 3; //B is now equal to 3
print(B); //would print an address, like "0xFFA3"
\end{lstlisting}
\subsection{References}
References are a way to create "automatic" pointers. If a function
takes in a reference, the variable is passed by reference, instead of by
value. This means that no copy of the variable is made, and any changes
made to the variable in the function will remain after the end of the
function. References also allow left-handed assignment. This means that
an array indexed on the left hand of an equal sign can have its value
changed.
\begin{lstlisting}[language=C++]
fun RefFunction(arg1: ref int): ref int{
return arg1 + 1;
}
var a = 6;
var b = RefFunction(a);
println(a); //a is now equal to 6
println(b); //b is now equal to 6
RefFunction(b) = 15;
println(b); //b is now equal to 15
\end{lstlisting}
\subsection{Dynamic Memory Allocation}
In order to allocate memory on the heap instead of the stack, dynamic
memory allocation must be used. The data must be explicitly allocated with
the {\bf{new}} keyword, and deleted with the {\bf{delete}} keyword. The
size in both instances must be provided.
\begin{lstlisting}[language=C++]
var data = new<int>(8); //Allocate 8 integers on the heap
delete(data,8); //Free the memory when its no longer used.
\end{lstlisting}
%----------------------------------------------------------------------------------------
% SECTION Classes