diff --git a/doc/Manual.aux b/doc/Manual.aux index 441cd9b..26677ab 100644 --- a/doc/Manual.aux +++ b/doc/Manual.aux @@ -9,22 +9,22 @@ \@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}{3}} -\@writefile{toc}{\contentsline {section}{\numberline {6}Classes}{3}} -\@writefile{toc}{\contentsline {subsection}{\numberline {6.1}Constructors}{3}} -\@writefile{toc}{\contentsline {subsection}{\numberline {6.2}Operator Overloading}{3}} -\@writefile{toc}{\contentsline {subsection}{\numberline {6.3}Inheritance}{3}} -\@writefile{toc}{\contentsline {section}{\numberline {7}Templates}{3}} -\@writefile{toc}{\contentsline {section}{\numberline {8}Standard Library}{4}} -\@writefile{toc}{\contentsline {subsection}{\numberline {8.1}Import Statements}{4}} -\@writefile{toc}{\contentsline {subsection}{\numberline {8.2}Vector}{4}} -\@writefile{toc}{\contentsline {subsection}{\numberline {8.3}String}{4}} -\@writefile{toc}{\contentsline {subsection}{\numberline {8.4}Regex}{4}} -\@writefile{toc}{\contentsline {subsection}{\numberline {8.5}Util}{4}} -\@writefile{toc}{\contentsline {subsection}{\numberline {8.6}Data Structures}{4}} -\@writefile{toc}{\contentsline {subsubsection}{\numberline {8.6.1}Stack}{4}} -\@writefile{toc}{\contentsline {subsubsection}{\numberline {8.6.2}Queue}{4}} -\@writefile{toc}{\contentsline {subsubsection}{\numberline {8.6.3}Set}{4}} -\@writefile{toc}{\contentsline {subsubsection}{\numberline {8.6.4}Map}{4}} -\@writefile{toc}{\contentsline {section}{\numberline {9}Understanding Kraken Errors}{4}} -\@writefile{toc}{\contentsline {section}{\numberline {10}C Passthrough}{4}} +\@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}} diff --git a/doc/Manual.log b/doc/Manual.log index 0d5cefc..e2dfbca 100644 --- a/doc/Manual.log +++ b/doc/Manual.log @@ -1,4 +1,4 @@ -This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9) (preloaded format=pdflatex 2015.9.2) 26 NOV 2015 16:38 +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 **Manual.tex (C:\Users\Chris\Documents\GitHub\kraken\doc\Manual.tex @@ -234,24 +234,48 @@ Overfull \hbox (39.0039pt too wide) in paragraph at lines 150--152 [][][][][][][][][][][][][][][][][][][][][][] [] -[3] [4] (C:\Users\Chris\Documents\GitHub\kraken\doc\Manual.aux) ) + +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 197. + +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: - 3263 strings out of 493921 - 44312 string characters out of 3144877 - 136396 words of memory out of 3000000 - 6539 multiletter control sequences out of 15000+200000 + 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} -Output written on Manual.pdf (4 pages, 61161 bytes). +KTeX 2.9/fonts/type1/public/amsfonts/cm/cmmi10.pfb> +Output written on Manual.pdf (5 pages, 75691 bytes). PDF statistics: - 32 PDF objects out of 1000 (max. 8388607) + 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) diff --git a/doc/Manual.pdf b/doc/Manual.pdf index dd6df89..fce4ade 100644 Binary files a/doc/Manual.pdf and b/doc/Manual.pdf differ diff --git a/doc/Manual.synctex.gz b/doc/Manual.synctex.gz index 7c6187d..e6c1b69 100644 Binary files a/doc/Manual.synctex.gz and b/doc/Manual.synctex.gz differ diff --git a/doc/Manual.tex b/doc/Manual.tex index c849ac0..9027e69 100644 --- a/doc/Manual.tex +++ b/doc/Manual.tex @@ -158,8 +158,45 @@ optional after declarations. %---------------------------------------------------------------------------------------- \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(8); //Allocate 8 integers on the heap + delete(data,8); //Free the memory when its no longer used. + \end{lstlisting} %---------------------------------------------------------------------------------------- % SECTION Classes