Document operator and delimiters

This commit is contained in:
2026-05-11 23:07:50 +02:00
parent 67fdf3d233
commit eaa7fc2ca2
2 changed files with 108 additions and 5 deletions
+5 -5
View File
@@ -14,14 +14,14 @@
<binary-digit> = `0' | `1'.
<hex-character> = `\\x' <hex-digit> <hex-digit>.
<hex-character> = `\\x' <hex-digit> \{<hex-digit>\}.
<escaped-character> = `\\' \\
(`n' | `a' | `b' | `t' | `f' | `r' | `v' | `\\' | `\textquotesingle' | `\textquotedbl' | `?\@' | `0').
(`n' | `a' | `b' | `t' | `f' | `r' | `v' | `\\' | `\textquotesingle' | `\textquotedbl' | `0').
<printable-character> = \enspace? a printable ASCII character\space?.
<character> = <printable-character> | <escaped-character> | <hex-digit>.
<character> = <printable-character> | <escaped-character> | <hex-character>.
<identifier> = <letter> \{<letter> | <decimal-digit>\}.
@@ -38,10 +38,10 @@
<real-literal> = <integer-literal> `.\@' <decimal-digit> \{<decimal-digit>\}
\alt{} <integer-literal>\} `e' [`+' | `-'] <decimal-digit> \{<decimal-digit>\}.
<string-literal> = `\textquotedbl' \{<character>\} `\textquotedbl'.
<character-literal> = `\textquotesingle' <character> `\textquotesingle'.
<string-literal> = `\textquotedbl' \{<character>\} `\textquotedbl'.
<literal> = <integer-literal> | <word-literal> | <real-literal>
\alt{} <string-literal> | <character-literal>
\alt{} `true' | `false' | `nil'.
+103
View File
@@ -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