basicdoc: keycodes, latex code cleanup, split long table

This commit is contained in:
minjaesong
2020-12-23 14:42:15 +09:00
parent 68b2b70ca0
commit d143b32ff2
6 changed files with 172 additions and 35 deletions

View File

@@ -101,11 +101,7 @@ Functions are a form of expression that may taks input arguments surrounded by p
Clears all declared variables. Clears all declared variables.
\subsection{DATA} \subsection{DATA}
\codeline{\textbf{DATA} CONST0 [\textbf{,} CONST1]\ldots}\par \codeline{\textbf{DATA} CONST0 [\textbf{,} CONST1]\ldots}\par
Adds data that can be read by \code{READ} function. Adds data that can be read by \code{READ} function. \code{DATA} declarations need not be reacheable in the program flow.
\subsubsection*{Notes}
\begin{itemlist}
\item \code{DATA} declarations need not be reacheable in the program flow.
\end{itemlist}
\subsection{END} \subsection{END}
\codeline{\textbf{END}}\par \codeline{\textbf{END}}\par
Stops program execution and returns control to the user. Stops program execution and returns control to the user.
@@ -158,7 +154,7 @@ Functions are a form of expression that may taks input arguments surrounded by p
Returns a substring of \code{STR} starting at \code{POSITION} with specified \code{LENGTH}.\par Returns a substring of \code{STR} starting at \code{POSITION} with specified \code{LENGTH}.\par
When \code{OPTIONBASE 1} is specified, the position starts from 1; otherwise it will start from 0. When \code{OPTIONBASE 1} is specified, the position starts from 1; otherwise it will start from 0.
\subsection{RIGHT} \subsection{RIGHT}
\codeline{SUBSTR \textbf{= RIGHT(}STR\textbf{,}NUM\_CHARS\textbf{)}}\par \codeline{SUBSTR \textbf{= RIGHT(}STR \textbf{,} NUM\_CHARS\textbf{)}}\par
Returns the rightmost \code{NUM\_CHARS} characters of \code{STR}. Returns the rightmost \code{NUM\_CHARS} characters of \code{STR}.
\subsection{SPC} \subsection{SPC}
\codeline{STR \textbf{= SPC(}STR \textbf{,} NUM\_CHARS\textbf{)}}\par \codeline{STR \textbf{= SPC(}STR \textbf{,} NUM\_CHARS\textbf{)}}\par
@@ -177,12 +173,10 @@ Functions are a form of expression that may taks input arguments surrounded by p
Specifies at which number the array/string/pixel indices begin. Specifies at which number the array/string/pixel indices begin.
\subsection{OPTIONDEBUG} \subsection{OPTIONDEBUG}
\codeline{\textbf{OPTIONDEBUG} \{\textbf{0}|\textbf{1}\}}\par \codeline{\textbf{OPTIONDEBUG} \{\textbf{0}|\textbf{1}\}}\par
Specifies whether or not the debugging messages should be printed out.\par Specifies whether or not the debugging messages should be printed out. The messages will be printed out to the \emph{serial debugging console}, or to the stdout.
The messages will be printed out to the \emph{serial debugging console}, or to the stdout.
\subsection{OPTIONTRACE} \subsection{OPTIONTRACE}
\codeline{\textbf{OPTIONTRACE} \{\textbf{0}|\textbf{1}\}}\par \codeline{\textbf{OPTIONTRACE} \{\textbf{0}|\textbf{1}\}}\par
Specifies whether or not the line numbers should be printed out.\par Specifies whether or not the line numbers should be printed out. The messages will be printed out to the \emph{serial debugging console}, or to the stdout.
The messages will be printed out to the \emph{serial debugging console}, or to the stdout.
\section{System} \section{System}

View File

@@ -1,2 +1,123 @@
\label{implementation} \label{implementation}
Keycodes follow LWJGL2 lol
This chapter explains implementation details of \tbas{} running on TSVM.
\section{Keycodes}
This is a keycodes recognised by LibGDX, a framework that TSVM runs on.
\begin{longtable}{*{2}{m{\textwidth}}}\hline
\endfirsthead
\endhead
\endfoot
\hline
\endlastfoot
\centering
\begin{tabulary}{\textwidth}{rl}
Key & Code \\
\hline
\ttfamily{1} & 8 \\
\ttfamily{2} & 9 \\
\ttfamily{3} & 10 \\
\ttfamily{4} & 11 \\
\ttfamily{5} & 12 \\
\ttfamily{6} & 13 \\
\ttfamily{7} & 14 \\
\ttfamily{8} & 15 \\
\ttfamily{9} & 16 \\
\ttfamily{0} & 17 \\
$\hookleftarrow$ & 66 \\
\condensedfont{BkSp} & 67 \\
\condensedfont{Tab} & 61 \\
\ttfamily{`} & 68 \\
\ttfamily{'} & 75 \\
\ttfamily{;} & 43 \\
\ttfamily{,} & 55 \\
\ttfamily{.} & 56 \\
\ttfamily{/} & 76 \\
\ttfamily{[}\hspace*{0.083em} & 71 \\
\ttfamily{]}\hspace*{-0.083em} & 72 \\
\ttfamily{-} & 69 \\
\end{tabulary}
\begin{tabulary}{\textwidth}{rl}
Key & Code \\
\hline
\ttfamily{+} & 70 \\
\ttfamily{A} & 29 \\
\ttfamily{B} & 30 \\
\ttfamily{C} & 31 \\
\ttfamily{D} & 32\\
\ttfamily{E} & 33 \\
\ttfamily{F} & 34 \\
\ttfamily{G} & 35 \\
\ttfamily{H} & 36 \\
\ttfamily{I} & 37 \\
\ttfamily{J} & 38 \\
\ttfamily{K} & 39 \\
\ttfamily{L} & 40 \\
\ttfamily{M} & 41 \\
\ttfamily{N} & 42 \\
\ttfamily{O} & 43 \\
\ttfamily{P} & 44 \\
\ttfamily{Q} & 45 \\
\ttfamily{R} & 46 \\
\ttfamily{S} & 47 \\
\ttfamily{T} & 48 \\
\ttfamily{U} & 49 \\
\end{tabulary}
\begin{tabulary}{\textwidth}{rl}
Key & Code \\
\hline
\ttfamily{V} & 50 \\
\ttfamily{W} & 51 \\
\ttfamily{X} & 52 \\
\ttfamily{Y} & 53 \\
\ttfamily{Z} & 54 \\
\condensedfont{LCtrl} & 57 \\
\condensedfont{RCtrl} & 58 \\
\condensedfont{LShift} & 59 \\
\condensedfont{RShift} & 60 \\
\condensedfont{LAlt} & 129 \\
\condensedfont{RAlt} & 130 \\
$\uparrow$ & 19 \\
$\downarrow$ & 20 \\
$\leftarrow$ & 21 \\
$\rightarrow$ & 22 \\
\condensedfont{Ins} & 133 \\
\condensedfont{Del} & 112 \\
\condensedfont{PgUp} & 92 \\
\condensedfont{PgDn} & 93 \\
\condensedfont{Home} & 3 \\
\condensedfont{End} & 132 \\
F1 & 244 \\
\end{tabulary}
\begin{tabulary}{\textwidth}{rl}
Key & Code \\
\hline
F2 & 245 \\
F3 & 246 \\
F4 & 247 \\
F5 & 248 \\
F6 & 249 \\
F7 & 250 \\
F8 & 251 \\
F9 & 252 \\
F10 & 253 \\
F11 & 254 \\
\condensedfont{Num} \ttfamily{0} & 144 \\
\condensedfont{Num} \ttfamily{1} & 145 \\
\condensedfont{Num} \ttfamily{2} & 146 \\
\condensedfont{Num} \ttfamily{3} & 147 \\
\condensedfont{Num} \ttfamily{4} & 148 \\
\condensedfont{Num} \ttfamily{5} & 149 \\
\condensedfont{Num} \ttfamily{6} & 150 \\
\condensedfont{Num} \ttfamily{7} & 151 \\
\condensedfont{Num} \ttfamily{8} & 152 \\
\condensedfont{Num} \ttfamily{9} & 153 \\
\condensedfont{NumLk} & 78 \\
\ttfamily{*} & 17 \\
\end{tabulary}
\end{longtable}
Keys not listed on the table may not be available depending on the system, for example, F12 may not be recognised.

View File

@@ -85,21 +85,43 @@ Float & $ \pm 4.9406564584124654 \times 10^{-324} $ -- $ \pm 1.7976931348623157
The order of precedence of the operators is as shown below, lower numbers means they have higher precedence (more tightly bound) The order of precedence of the operators is as shown below, lower numbers means they have higher precedence (more tightly bound)
\begin{tabulary}{\textwidth}{cCc|cCc} \begin{longtable}{*{2}{m{\textwidth}}}\hline
Order & Op & Associativity & Order & Op & Associativity \\ \endfirsthead
\hline \endhead
1 & \basicexp & Right & 11 & \condensedfont{BXOR} & Left \\
2 & \ast \quad $/$ \quad $\backslash$ & Left & 12 & \condensedfont{BOR} & Left \\
3 & \condensedfont{MOD} & Left & 13 & \condensedfont{AND} & Left \\
4 & $+$ \quad $-$ & Left & 14 & \condensedfont{OR} & Left \\
5 & \condensedfont{NOT} \enskip \condensedfont{BNOT} & Left & 15 & \condensedfont{TO} \enskip \condensedfont{STEP} & Left \\
6 & <\!< \quad >\!> & Left & 16 & ! & Right \\
7 & < \enskip > \enskip <\!= \enskip =\!< \enskip >\!= \enskip =\!> & Left & 17 & \sim & Left\\
8 & == \quad <\!> \quad >\!< & Left & 18 & \# & Left \\
9 & \condensedfont{MIN} \enskip \condensedfont{MAX} & Left & 19 & \basiccurry & Right \\
10 & \condensedfont{BAND} & Left & 20 & = & Right \\
\end{tabulary}
\endfoot
\hline
\endlastfoot
\centering
\begin{tabulary}{\textwidth}{cCc}
Order & Op & Associativity \\
\hline
1 & \basicexp & Right \\
2 & \ast\quad$/$\quad$\backslash$ & Left \\
3 & \condensedfont{MOD} & Left \\
4 & $+$\quad$-$ & Left \\
5 & \condensedfont{NOT}\quad\condensedfont{BNOT} & Left \\
6 & <\!<\quad>\!> & Left \\
7 & <\enskip>\enskip=\!<\enskip<\!=\enskip=\!>\enskip>\!= & Left \\
8 & ==\quad<\!>\quad>\!< & Left \\
9 & \condensedfont{MIN}\quad\condensedfont{MAX} & Left \\
10 & \condensedfont{BAND} & Left \\
\end{tabulary}
\begin{tabulary}{\textwidth}{cCc}
Order & Op & Associativity \\
\hline
11 & \condensedfont{BXOR} & Left \\
12 & \condensedfont{BOR} & Left \\
13 & \condensedfont{AND} & Left \\
14 & \condensedfont{OR} & Left \\
15 & \condensedfont{TO}\quad\condensedfont{STEP} & Left \\
16 & ! & Right \\
17 & \sim & Left\\
18 & \# & Left \\
19 & \basiccurry & Right \\
20 & = & Right \\
\end{tabulary}
\end{longtable}
\subsubsection*{Examples} \subsubsection*{Examples}
\begin{itemlist} \begin{itemlist}
@@ -227,7 +249,7 @@ Code & Operation & Result \\
%{[}\emph{x},\,\emph{y}\ldots{]} \basicclosure{} \emph{e} & Closure & Creates a closure (anonymous function) from one or more parameters \emph{x},\,\emph{y}\ldots\ and an expression \emph{e} \\ %{[}\emph{x},\,\emph{y}\ldots{]} \basicclosure{} \emph{e} & Closure & Creates a closure (anonymous function) from one or more parameters \emph{x},\,\emph{y}\ldots\ and an expression \emph{e} \\
\end{tabulary} \end{tabulary}
\emph{Currying} is an operation that returns derivative of the function that has given value applied to its first parameter.\footnote{Do \emph{not} believe in that this is \emph{the} definition of currying. In the wild, currying is applied to cascades of \lambda-expressions and the behaviour is different to \tbas{}'s, even though it seems equivalent if you compare the function that two curries would produce.} See \ref{currying101} for tutorials. \emph{Currying} is an operation that returns new function that has given value applied to the original function's first parameter. See \ref{currying101} for tutorials.
\section{Syntax In EBNF} \section{Syntax In EBNF}

View File

@@ -6,7 +6,7 @@ A Program line is composed of a line number and one or more statements. Multiple
\codeline{\textbf{IF} TRUTH\_VALUE \textbf{THEN} TRUE\_EXPRESSION [\textbf{ELSE} FALSE\_EXPERSSION]} \codeline{\textbf{IF} TRUTH\_VALUE \textbf{THEN} TRUE\_EXPRESSION [\textbf{ELSE} FALSE\_EXPERSSION]}
If \code{TRUTH\_VALUE} is truthy, executes \code{TRUE\_EXPRESSION}; if \code{TRUTH\_VALUE} is falsy and \code{FALSE\_EXPERSSION} is used, executes that expression, otherwise next line or next statement will be executed. If \code{TRUTH\_VALUE} is truthy, executes \code{TRUE\_EXPRESSION}. If \code{TRUTH\_VALUE} is falsy and \code{FALSE\_EXPERSSION} is specified, executes that expression; otherwise next line or next statement will be executed.
\subsubsection*{Notes} \subsubsection*{Notes}
@@ -20,7 +20,7 @@ If \code{TRUTH\_VALUE} is truthy, executes \code{TRUE\_EXPRESSION}; if \code{TRU
\codeline{\textbf{ON} INDEX\_EXPRESSION \{\textbf{GOTO}|\textbf{GOSUB}\} LINE0 [\textbf{,} LINE1]\ldots} \codeline{\textbf{ON} INDEX\_EXPRESSION \{\textbf{GOTO}|\textbf{GOSUB}\} LINE0 [\textbf{,} LINE1]\ldots}
Jumps to \code{INDEX\_EXPRESSION}-th line number in the argements. If \code{INDEX\_EXPRESSION} is outside of range of the arguments, no jump will be performed. Jumps to the line number returned by the \code{INDEX\_EXPRESSION}. If the result is outside of range of the arguments, no jump will be performed.
\subsubsection*{Parameters} \subsubsection*{Parameters}

View File

@@ -3,7 +3,7 @@
%% Copyright (c) 2020 CuriousTorvald and the contributors. %% Copyright (c) 2020 CuriousTorvald and the contributors.
\documentclass[10pt, stock, openany]{memoir} \documentclass[10pt, stock, openany, chapter]{memoir}
\usepackage{fontspec} \usepackage{fontspec}
@@ -20,6 +20,7 @@
\usepackage{hyperref} \usepackage{hyperref}
\usepackage{graphicx} \usepackage{graphicx}
\usepackage{tabulary} \usepackage{tabulary}
\usepackage{longtable}
\usepackage[table]{xcolor} \usepackage[table]{xcolor}
\usepackage{ltablex} \usepackage{ltablex}
\usepackage{parskip} \usepackage{parskip}
@@ -29,6 +30,7 @@
\usepackage{etoolbox} \usepackage{etoolbox}
\usepackage[most]{tcolorbox} \usepackage[most]{tcolorbox}
\usepackage{listings} \usepackage{listings}
\usepackage{amsmath,amssymb}
\usepackage{lineno} % debug \usepackage{lineno} % debug
@@ -129,8 +131,9 @@
tabsize=3 tabsize=3
} }
%\aliaspagestyle{part}{empty} \addtocontents{toc}{\protect\thispagestyle{empty}} % no page number for the TOC header page
%\aliaspagestyle{chapter}{empty} \aliaspagestyle{part}{empty} % aliasing PART as empty so that page number would not be printed
\aliaspagestyle{chapter}{section} % aliasing CHAPTER as section so that page numbering style would be the same as section
% The title % The title
@@ -157,7 +160,6 @@
\end{titlingpage} \end{titlingpage}
\setcounter{page}{3} \setcounter{page}{3}
\tableofcontents* \tableofcontents*
@@ -193,8 +195,6 @@
\chapter{Implementation Details} \chapter{Implementation Details}
\input{Implementation} \input{Implementation}
\chapter{Index}
\chapter{Bibliography} \chapter{Bibliography}
\input{bibliography} \input{bibliography}

View File

@@ -4,7 +4,7 @@ This section describes all use cases of \code{BasicVar}.
When a variable is \code{resolve}d, an object with instance of \code{BasicVar} is returned. A \code{bvType} of Javascript value is determined using \code{JStoBASICtype}. When a variable is \code{resolve}d, an object with instance of \code{BasicVar} is returned. A \code{bvType} of Javascript value is determined using \code{JStoBASICtype}.
\begin{tabulary}{\textwidth}{RLL} \begin{tabulary}{\textwidth}{R|LL}
Typical User Input & TYPEOF(\textbf{Q}) & Instanceof \\ Typical User Input & TYPEOF(\textbf{Q}) & Instanceof \\
\hline \hline
\code{\textbf{Q}=42.195} & {\ttfamily num} & \emph{primitive} \\ \code{\textbf{Q}=42.195} & {\ttfamily num} & \emph{primitive} \\