Skip to content
| Marketplace
Sign in
Visual Studio Code>Visualization>Automata DiagsNew to Visual Studio Code? Get it now.
Automata Diags

Automata Diags

Godson Ajodo

|
1 install
| (1) | Free
Visualize and analyze DFAs, NFAs, CFGs, PDAs, Turing machines, Mealy machines, and more — powered by the automata-diags Python package.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Automata Diags — VS Code Extension

PyPI version License: MIT

Visualize and analyze DFAs, NFAs, CFGs, PDAs, Turing machines, Mealy machines, and more — directly from the VS Code Command Palette. Powered by the automata-diags Python package.

Prerequisites

  • Python 3.8+ with the Python extension installed
  • automata-diags is auto-installed on activation (no manual pip required)
  • Graphviz (required for diagram commands):
    • macOS: brew install graphviz
    • Ubuntu/Debian: sudo apt-get install graphviz
    • Windows: Download from graphviz.org

Getting Started

  1. Install the extension — automata-diags is auto-installed on first activation
  2. Open any text file and write a definition:
    type: dfa
    start: q0
    accept: q2
    transitions: q0,a,q1; q1,b,q2
    
  3. Select the text, then Cmd+Shift+P → "Automata Diags: Run from Editor"
  4. Pick an action (Draw, Accept, Minimize, etc.)

That's it. No pip commands, no terminal, no configuration.

The "Run from Editor" workflow

Write a simple definition block in any file, select it, and run. The extension auto-detects the automaton type and does what you ask. Supported definition fields:

type: dfa | nfa | cfg | pda | tm | mealy
start: q0
accept: q2, q3
transitions: q0,a,q1; q1,b,q2
word: ab
blank: _
method: hopcroft

For grammars, just write the rules directly:

S -> a S b | a b

You can also use each command individually via the Command Palette — see below.

Commands

General

Command Description
Verify Installation Check that automata-diags is installed, show version and Graphviz status
Install / Upgrade Package Run pip install --upgrade automata-diags in the active environment
Run Current File Execute the active Python file and show output
Run File & Show Diagram Execute the active file and open the most recent generated diagram

DFA (Deterministic Finite Automaton)

Command Description
DFA — Test Word Acceptance Parse a DFA from a transition string and test if it accepts a word
DFA — Draw Diagram Render a DFA state diagram
DFA — Minimize (Hopcroft / Myhill-Nerode) Minimize a DFA and show equivalence classes
KMP Pattern Search Find all occurrences of a pattern in text using KMP

NFA (Nondeterministic Finite Automaton)

Command Description
NFA — Test Word Acceptance Parse an NFA and test word acceptance
NFA — Draw Diagram Render an NFA state diagram
NFA → DFA Conversion Convert NFA to DFA via subset construction, render both
Regex → NFA (Thompson Construction) Build an NFA from a regular expression and render it

CFG (Context-Free Grammar)

Command Description
CFG — CYK Membership Check Test if a string belongs to a CFG using the CYK algorithm
CFG — Convert to CNF Convert a grammar to Chomsky Normal Form
CFG — BFS Acceptance Check Test string acceptance on any CFG (no CNF required)
CFG — Show Derivation Show the step-by-step derivation of a string
CFG — Generate Strings Generate all derivable strings up to a given length

PDA (Pushdown Automaton)

Command Description
PDA — Test Word Acceptance Parse a PDA and test word acceptance
PDA — Configuration Trace Show the state/position/stack at each step of acceptance
PDA — Draw Diagram Render a PDA transition diagram
CFG → PDA Conversion Convert a grammar to an equivalent PDA and render it

Turing Machine

Command Description
Turing Machine — Test Word Acceptance Parse a TM and test word acceptance (handles non-halting)
Turing Machine — Draw Diagram Render a TM transition diagram

Mealy Machine (Transducer)

Command Description
Mealy Machine — Transduce Word Run a word through a Mealy machine and see the output
Mealy Machine — Draw Diagram Render a Mealy machine diagram

SCFG (Stochastic Context-Free Grammar)

Command Description
SCFG — Probabilistic Parse (CYK) Compute the probability of a sentence under a weighted grammar

Input Formats

Commands accept the same string formats as the Python package's from_string methods:

  • DFA: q0,a,q1;q1,b,q2 (from,symbol,to)
  • NFA: q0,a,q0,q1;q1,b,q2 (from,symbol,to1,to2,...)
  • PDA: q0,a,Z,q0,aZ;q0,b,a,q1,e (from,input,stack_top,to,push — use e for epsilon)
  • TM: q0,0,q0,0,R;q0,_,qa,_,N (state,read,next,write,direction)
  • CFG: S -> a S b | a b (one rule per line, | for alternatives)
  • SCFG: S -> NP VP [0.8] (weighted rules)
  • Mealy transitions: q0,0,q0;q0,1,q1 + output function q0,0,1;q0,1,0

You can also select text in the editor — many commands will use the selection as input instead of prompting.

Settings

Setting Default Description
automataDiags.pythonPath "" Explicit Python path (leave empty to use the Python extension's selection)
automataDiags.outputFormat png Diagram format: png, svg, or pdf

Links

  • PyPI Package
  • Documentation
  • Web App
  • GitHub
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft