vscodeVS Code Extension

To make developing Turing Machines easier, we have developed a Varphi language extension for Visual Studio Code. This extension integrates the Varphi interpreter directly into your editor, providing features like syntax highlighting, error checking, and a fully interactive debugger.

Installation

You can install the language extension via the Visual Studio Code marketplacearrow-up-right.

Features

1. Syntax Highlighting

The extension provides full syntax highlighting for .vp files (the recommended file extension for Varphi). Keywords, states, and tuples are color-coded to improve readability and help you visually structure your transition rules.

2. Live Error Reporting

The extension works in the background to validate your code as you type. It reports errors instantly via the Problems panel. Errors are underlined with red squiggles, and hovering over them reveals the specific error message from the compiler.

3. One-Click Execution

You don't need to leave the editor to run your code. The extension adds dedicated Run and Debug buttons to the editor title bar (top right).

  • Run (Play Icon): Compiles and executes the current file in a dedicated terminal.

  • Debug (Bug Icon): Starts an interactive debugging session.

When you click Run, the extension opens a dedicated "Varphi" terminal and executes your program, keeping your output separate from other terminal processes.

4. Interactive Debugging (DAP)

The extension communicates with the Varphi Interpreter using the Debug Adapter Protocol (DAP), allowing you to debug Varphi programs just like you would debug other languages.

Providing Tape Inputs

When you start a debug session, the extension will prompt you to provide initial values for your tapes via an input box at the top of the screen. You can press Enter to leave a tape blank, or Esc to finish providing inputs.

Stepping Through Code

Once the session starts, you can step through your Turing Machine line-by-line. The editor highlights the active transition rule in yellow, letting you trace exactly which logic is currently being executed.

Breakpoints

As with other language extensions, the Varphi extension fully supports breakpoints.

Configuration

By default, the extension assumes the Varphi Interpreter (vpi) is available in your system's PATH. If you have installed the interpreter in a custom location, you can configure the path in your VS Code settings:

  1. Open Settings (Ctrl+,).

  2. Search for Varphi.

  3. Set Varphi: Interpreter Path to the location of your executable.

If you prefer editing the setting in JSON, the setting is:

triangle-exclamation

Last updated

Was this helpful?