summaryrefslogtreecommitdiff
path: root/doc/language.tex
diff options
context:
space:
mode:
Diffstat (limited to 'doc/language.tex')
-rw-r--r--doc/language.tex103
1 files changed, 103 insertions, 0 deletions
diff --git a/doc/language.tex b/doc/language.tex
index f79e663..cce2fcb 100644
--- a/doc/language.tex
+++ b/doc/language.tex
@@ -77,8 +77,111 @@ Examples:
\section{Strings and characters}
+Single \textit{characters} are enclosed in single quotation marks
+(\textquotesingle).\@ \textit{Strings} are sequences of characters enclosed in
+double quotation marks (\textquotedbl). The number of characters in a string is
+called the \textit{the length} of the string.
+
+\begin{grammar}
+<escaped-character> = `\\' \\
+ (`n' | `a' | `b' | `t' | `f' | `r' | `v' | `\\' | `\textquotesingle' | `\textquotedbl' | `0').
+
+<hex-character> = `\\x' <hex-digit> \{<hex-digit>\}.
+
+<character> = <printable-character> | <escaped-character> | <hex-character>.
+
+<character-literal> = `\textquotesingle' <character> `\textquotesingle'.
+
+<string-literal> = `\textquotedbl' \{<character>\} `\textquotedbl'.
+\end{grammar}
+
+Alternatively, a single character may be represented by a
+\textit{escape sequence} (see~\ref{table:escape}), a character combination
+beginning with a backslash (\textbackslash).
+
+\begin{table}[ht]
+\centering
+\begin{tabular}{r l}
+ \textbf{Sequence} & \textbf{Meaning} \\
+ \toprule
+ \verb|\n| & Newline \\
+ \midrule
+ \verb|\a| & Bell \\
+ \midrule
+ \verb|\b| & Backspace \\
+ \midrule
+ \verb|\t| & Horizontal tab \\
+ \midrule
+ \verb|\f| & Form feed \\
+ \midrule
+ \verb|\r| & Carriage return \\
+ \midrule
+ \verb|\v| & Vertical tab \\
+ \midrule
+ \verb|\\| & Backslash \\
+ \midrule
+ \verb|\'| & Single quote \\
+ \midrule
+ \verb|\"| & Double quote \\
+ \midrule
+ \verb|\0| & Null character \\
+ \midrule
+ \verb|\xh…| & Arbitrary hexadecimal value, where \verb|n| is a hexadecimal digit \\
+ \bottomrule
+\end{tabular}
+\caption{Escape sequences}\label{table:escape}
+\end{table}
+
+Examples:
+
+\begin{itemize}
+ \item \verb|"String"|
+ \item \verb|'c'|
+ \item \verb|'\''|
+ \item \verb|"\"multi\nline\nquoted\nstring\""|
+\end{itemize}
+
\section{Operators and delimiters}
+\textit{Operators} and \textit{delimiters} are the special characters, character
+pairs, or reserved words listed below. These reserved words consist exclusively
+of letters and cannot be used in the role of identifiers.
+
+\begin{itemize}
+ \item{}:=
+ \item $@\quad\hat{}\quad\sim$
+ \item $.\quad,\quad;\quad:\quad|$
+ \item $<\quad>\quad>=\quad<=\quad<>\quad=$
+ \item $+\quad-\quad*\quad/$
+ \item $or\quad{}xor\quad\&$
+ \item (\ and\ )
+ \item \lbrack{} and \rbrack{}
+ \item \{ and \}
+ \item Pointer
+ \item module
+ \item import
+ \item type
+ \item const
+ \item var
+ \item begin
+ \item end
+ \item proc
+ \item record
+ \item while
+ \item do
+ \item case
+ \item of
+ \item if
+ \item then
+ \item elsif
+ \item else
+ \item cast
+ \item return
+ \item true
+ \item false
+ \item nil
+\end{itemize}
+
\section{Comments}
\textit{Comments} may be inserted between any two tokens in a program. They