VS Code Extensions
Nereus Formal Specification Language

Nereus Formal Specification Language

by nereus-ml

Language support for Nereus — syntax highlighting, diagnostics, hover, completion, and semantic analysis

Downloads

2

Rating

— (0)

Version

1.0.0

Last updated

Aug 02, 2026

Full language support for the Nereus formal algebraic specification language (Favre, L. Formal Metamodeling for Secure Systems, 2025).


Features

Feature Description
Syntax highlighting Keywords, types, operators, associations <<Name>>, comments
Real-time diagnostics Parse errors and semantic warnings as you type
Hover documentation Type signatures and constructor info on hover
Auto-completion Keywords, declared classes, operations, attributes
Document outline Classes, associations, operations in the Explorer sidebar
Go to definition Navigate to class/operation declarations
Analysis panel Visual summary: axiom coverage, unknown refs, stats
Code snippets Templates for CLASS, ASSOCIATION, PACKAGE, LET, pre, …
Bracket matching (), [], <<>>, /* */

Semantic analysis

The extension validates:

  • Axiom coverage — every EFFECTIVE operation has an axiom for each BASIC CONSTRUCTOR
  • Constructor signatures — every constructor listed in BASIC CONSTRUCTORS has an OPERATIONS declaration
  • Attribute coverage — every ATTRIBUTE has axioms covering all constructors
  • Type references — IS-SUBTYPE-OF references are declared classes
  • Association coverage — get_role operations cover all constructors

Commands

Command Description
Nereus: Show Specification Analysis Open visual analysis panel
Nereus: Check Axiom Coverage Quick coverage report in notification
Nereus: Generate Haxe Code Generate Haxe from the current spec

File types

.nereus and .nrs


Quick start

  1. Open a .nereus file
  2. Syntax highlighting appears immediately
  3. Diagnostics appear in the Problems panel
  4. Hover over any class name or operation for documentation
  5. Run Nereus: Show Specification Analysis for the full panel
  6. Type class + Tab for a complete class template

Example

CLASS Stack [elem: ANY]
BASIC CONSTRUCTORS Stack_Empty, Stack_Insert
EFFECTIVE
TYPE Stack
OPERATIONS
  Stack_Empty:  -> Stack;
  Stack_Insert: Stack * elem -> Stack;
  Stack_IsEmpty: Stack -> Boolean;
  Stack_Top: Stack(p) -> elem
  pre: not Stack_IsEmpty(p);
AXIOMS p: Stack; e: elem;
  Stack_IsEmpty(Stack_Empty()) = True;
  Stack_IsEmpty(Stack_Insert(p, e)) = False;
  Stack_Top(Stack_Insert(p, e)) = e;
END-CLASS

Installation from source

git clone <repo>
cd nereus-vscode
npm install
cd server && npm install && npx tsc -p tsconfig.json && cd ..
cd client && npm install && npx tsc -p tsconfig.json && cd ..
# Press F5 in VS Code to launch Extension Development Host

Architecture

nereus-vscode/
├── client/src/extension.ts      ← VS Code extension client (LSP client)
├── server/src/
│   ├── nereusParser.ts          ← Lexer + recursive-descent parser → AST
│   ├── nereusAnalyzer.ts        ← Semantic analysis + symbol table
│   └── server.ts                ← LSP server (diagnostics, hover, completion)
├── syntaxes/nereus.tmLanguage.json  ← TextMate grammar
├── snippets/nereus.json         ← Code snippets
└── language-configuration.json ← Brackets, comments, indentation

Related extensions