Major mode for the Vienna Development Method
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
gifs
snippets/vdm-mode
LICENSE
README.org
demo.gif
flycheck-vdm.el
vdm-mode-util.el
vdm-mode.el
vdm-snippets.el

README.org

vdm-mode.el

https://melpa.org/packages/vdm-mode-badge.svg http://melpa-stable.milkbox.net/packages/vdm-mode-badge.svg http://img.shields.io/:license-gpl3-blue.svg?style=flat-square

Emacs package for writing VDM specifications using VDM-SL, VDM++ and VDM-RT.

gifs/demo.gif

Features

vdm-mode currently supports the following features:

  • Syntax highlighting and editing
  • Replacement of ASCII syntax (e.g. lambda) with more aesthetically looking symbols (e.g. λ) using prettify-symbols-mode
  • On the fly syntax checking using Flycheck
  • VDM YASnippets

Installation and configuration

The features described above are packaged separately as vdm-mode, vdm-snippets and flycheck-vdm. The last two packages are optional but necessary to use the VDM snippets and enable syntax checking.

Installation using MELPA (recommended)

All three packages are available via MELPA and can be installed by executing the following commands:

package-install RET vdm-mode RET
package-install RET flycheck-vdm RET
package-install RET vdm-snippets RET

Finally, add the following to your Emacs configuration:

(require 'vdm-mode)
(setq flycheck-vdm-tool-jar-path "/path/to/vdm-tool-jar")
(vdm-mode-setup)

Manual installation

Download the files from this repository and add the following to your Emacs configuration:

(add-to-list 'load-path "/folder/where/vdm-mode/is/")
(require 'vdm-mode)
(setq flycheck-vdm-tool-jar-path "/path/to/vdm-tool-jar")
(vdm-mode-setup)

Usage

Recognised file extensions

The following file extensions are recognised as VDM files:

  • VDM-SL: .vdmsl and .vsl
  • VDM++: .vdmpp and .vpp
  • VDM-RT: .vdmrt and .vrt

Syntax checking

To enable syntax checking of VDM files flycheck-vdm-tool-jar-path must contain a path to either a VDMJ or Overture jar file. The syntax checker integration is created using Flycheck.

VDM YASnippets

vdm-mode offers several VDM YASnippets to improve the editing experience. Calling yas-insert-snippet is a useful way to obtain an overview of the different snippets currently offered by vdm-mode.

Multi-file models

By default, vdm-mode only performs syntax checking of the current buffer. However, for large models, vdm-mode uses a special file named .vdm-project to group files into VDM projects or multi-file models. As an example, consider the VDM project structure below, which lists three VDM files.

project-root-folder   
|
+-- .vdm-project
+-- A.vdmsl
+-- B.vdmsl
+-- sub-folder
    +-- C.vdmsl

Every time syntax checking is triggered vdm-mode locates the root of the project (if it exists) and recursively finds all VDM files associated with that project. These files are then passed as arguments to the underlying VDM tool, which performs the syntax check. A VDM project may be created using the vdm-mode-create-project function.

Planned features

Below is a list of features that I’m considering adding to vdm-mode.

  • Interpreter integration (model execution)
  • VDM libraries import
  • Jump to definition

If you have any ideas for how to improve vdm-mode feel free to create an issue or submit a pull request.