1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
\section{Input format}
The input format of Cadabra~II follows the Python language
specification, with the following additional rules:
\begin{enumerate}
\item A line containing a \verb|:=| token is interpreted as a Cadabra
expression declaration. If the line does not end with a semi-colon
\verb|;| following lines are added until a line is found which does
end with a semi-colon. The newlines between these lines are replaced
with a single space character.
[example]
This is translated to the following expression before it is being
handed to the Python interpreter.
[translation]
\item A line containing a \verb|::| token is interpreted as a Cadabra
property declaration. The same rule for line continuation is used.
\item Anything inbetween two dollar symbols is interpreted as a
Cadabra expression (just like \TeX{} handles mathematical
expressions).
\item A line ending with a semi-colon \verb|;| will lead to the output
of the last-used expression being printed. To be precise, it will
insert a \verb|print(latex(_))| into the input.
\end{enumerate}
The interactive shell \verb|cadabra2| will indicate Cadabra line
continuations by showing a `|' symbol as prompt (instead of the
`\verb|>|' shown for new lines.
|