| 1 |
|
| 2 |
|
| 3 |
\documentclass[times]{article} |
| 4 |
|
| 5 |
\usepackage{vdmlisting} |
| 6 |
\usepackage{hyperref} |
| 7 |
%\usepackage{vdm} |
| 8 |
\def\vdmlisting{\texttt{vdmlisting}} |
| 9 |
\def\envvdmsl{\texttt{vdmsl}} |
| 10 |
\def\envvdmpp{\texttt{vdmpp}} |
| 11 |
\def\envvdmrt{\texttt{vdmrt}} |
| 12 |
|
| 13 |
\title{The \textbf{\vdmlisting} Package} |
| 14 |
\author{Kenneth Lausdahl\\ |
| 15 |
Dept. of Engineering\\ |
| 16 |
Aarhus University\\ |
| 17 |
Denmark.\\ |
| 18 |
\texttt{[email protected]}} |
| 19 |
\date{10 Novemberl 2020 \\ |
| 20 |
Version 1.1} |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
\begin{document} |
| 26 |
|
| 27 |
|
| 28 |
\maketitle |
| 29 |
\begin{abstract} |
| 30 |
The \vdmlisting package is a Vienna Development Method (VDM) source code printer for \LaTeX . The package uses the listings package and provides a number of new listing environments for the three VDM dialects: VDM-SL,VDM-PP and VDM-RT. If one wants to typeset VDM with a mathematical syntax instead of the ASCII syntax used here then use the \texttt{vdm} package instead. |
| 31 |
\end{abstract} |
| 32 |
|
| 33 |
\tableofcontents |
| 34 |
|
| 35 |
\section{Getting started} |
| 36 |
|
| 37 |
Before using the \vdmlisting package, you should be familiar with the \LaTeX typesetting system and the listings package which this packages depends upon. |
| 38 |
|
| 39 |
\subsection{A minimal example} |
| 40 |
Here is a minimal file for \vdmlisting showing a VDM function: |
| 41 |
|
| 42 |
|
| 43 |
\begin{verbatim} |
| 44 |
\documentstyle{article} |
| 45 |
\usepackage{vdmlisting} |
| 46 |
|
| 47 |
\begin{document} |
| 48 |
\begin{vdmsl} |
| 49 |
add : int * int -> |
| 50 |
add(a,b) == a+b; |
| 51 |
\end{vdmsl} |
| 52 |
\end{document} |
| 53 |
\end{verbatim} |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
\subsection{Typesetting VDM with listings} |
| 58 |
This package defined three listing environments that can be used to typeset VDM. The environments are defined as: |
| 59 |
|
| 60 |
\begin{verbatim} |
| 61 |
\begin{listing-name}[options] |
| 62 |
VDM specification |
| 63 |
\end{listing-name} |
| 64 |
\end{verbatim} |
| 65 |
|
| 66 |
\noindent The \texttt{options} are parsed directly to the \texttt{lstlisting} environment and could be used to e.g. set the label or caption like \texttt{label=lst:mymodel,caption=My special specification}. The \texttt{listing-name} may be any of the following: |
| 67 |
|
| 68 |
\begin{description} |
| 69 |
\item[\envvdmsl] The \envvdmsl environment configures the listing environment to use the VDM-SL language definition: |
| 70 |
|
| 71 |
\begin{verbatim} |
| 72 |
\begin{vdmsl}[label=lst:mymodule,caption=My module] |
| 73 |
module MyModule |
| 74 |
end MyModule |
| 75 |
\end{vdmsl} |
| 76 |
\end{verbatim} |
| 77 |
it typesets as follows: |
| 78 |
|
| 79 |
\begin{vdmsl}[label=lst:mymodule,caption=My module] |
| 80 |
module MyModule |
| 81 |
end MyModule |
| 82 |
\end{vdmsl} |
| 83 |
|
| 84 |
\item[\envvdmpp] The \envvdmpp environment configures the listing environment to use the VDM-PP language definition: |
| 85 |
|
| 86 |
\begin{verbatim} |
| 87 |
\begin{vdmpp}[label=lst:myclass,caption=My Class] |
| 88 |
class MyClass |
| 89 |
end MyClass |
| 90 |
\end{vdmpp} |
| 91 |
\end{verbatim} |
| 92 |
it typesets as follows: |
| 93 |
|
| 94 |
\begin{vdmpp}[label=lst:myclass,caption=My Class] |
| 95 |
class MyClass |
| 96 |
end MyClass |
| 97 |
\end{vdmpp} |
| 98 |
|
| 99 |
\item[\envvdmrt] The \envvdmrt environment configures the listing environment to use the VDM-RT language definition: |
| 100 |
|
| 101 |
\begin{verbatim} |
| 102 |
\begin{vdmrt}[label=lst:myclass,caption=My System] |
| 103 |
system MySystem |
| 104 |
end MySystem |
| 105 |
\end{vdmrt} |
| 106 |
\end{verbatim} |
| 107 |
it typesets as follows: |
| 108 |
|
| 109 |
\begin{vdmrt}[label=lst:myclass,caption=My System] |
| 110 |
system MySystem |
| 111 |
end MySystem |
| 112 |
\end{vdmrt} |
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
\end{description} |
| 117 |
|
| 118 |
Furthermore, the environments are configured with \texttt{escapeinside=\{(*@\}\{@*)\}} enabling the command \texttt{\textbackslash vdmnotcovered\{ VDM specification\}} to be used to mark execution coverage for the VDM specification displayed. |
| 119 |
|
| 120 |
\subsection{Previous versions} |
| 121 |
|
| 122 |
This package includes all environments from the previous version \texttt{1.0} of this package. All environments and language definitions can be post fixed with \texttt{\_10} to get the previous version. |
| 123 |
|
| 124 |
\section{Package loading} |
| 125 |
As usual in \LaTeX, the package is loaded by \texttt{\textbackslash usepackage[optionsi]\{vdmlisting\}}, |
| 126 |
where [optionsi] is optional and gives a comma separated list of options: |
| 127 |
|
| 128 |
\begin{description} |
| 129 |
|
| 130 |
\item[color] This loads the \texttt{color} package and defines the \texttt{vdmnotcovered} command to use a red color. |
| 131 |
|
| 132 |
\item[notimes] This package loads the \texttt{times} package, by default, so if you do not want that to happen use this option to skip the load of \texttt{times}. |
| 133 |
|
| 134 |
\end{description} |
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
\section{Installing the \vdmlisting \ files} |
| 139 |
|
| 140 |
Place the file {\tt vdmlisting.sty} in your standard directory for \LaTeX\ |
| 141 |
style files (your system administrator will know where this is). |
| 142 |
|
| 143 |
|
| 144 |
\section{The License} |
| 145 |
The vdmlisting.sty and vdmlisting.tex file is copyright 2012--2020 Kenneth Lausdahl and is released under the LaTeX Project Public License 1.3 or later. |
| 146 |
|
| 147 |
\end{document} |