Skip to content

KebanFiru/theory_of_computation_simulator

Computation Theory Simulator

Computation Theory Simulator is an interactive, canvas-first web application for building, editing, converting, and simulating multiple automata models used in formal languages and automata theory courses.

It is designed for education, experimentation, and fast visual iteration.

Computation Theory Simulator Main Page

Supported Models

  • Finite Automata (FA): NFA and DFA workflows
  • Pushdown Automata: PDA and NDPA
  • Turing Machines: deterministic and nondeterministic, single-tape and multi-tape transitions
  • Mealy Machines
  • Moore Machines

What You Can Do

Canvas Modeling

  • Create and place states on a zoomable/pannable canvas
  • Create and edit transitions directly from canvas interactions
  • Use mode-aware controls so each machine family enforces appropriate transition syntax
  • Move, duplicate, and re-place generated/saved automata on the workspace

Save, Edit, Import, Export

  • Save selected automata regions as reusable cards
  • Reopen saved automata in edit mode
  • Duplicate selected automata
  • Export a selected automaton as JSON
  • Import automata JSON (including backward compatibility handling for legacy snapshots)
  • Save and load full workspace snapshots
  • Clear workspace safely through confirmation flow

Conversion and Generation Tools

  • Regex conversion tool for finite automata workflows
  • NFA to DFA conversion for selected FA models
  • FA to GNFA generation
  • CFG generation and grammar-oriented artifacts from selected models

Simulation and Visual Feedback

  • Test strings/inputs from saved cards
  • Transition-path highlighting on canvas during simulation
  • Stack activity visualization for PDA/NDPA runs
  • Output-sequence feedback for Mealy and Moore machine simulations

Inspection Views

  • Transition table rendering per model
  • Regex summary views for finite automata cards
  • Machine summaries (model-specific tuple/style summaries)

Transition Label Syntax Reference

Finite Automata

  • Label format: single symbol per transition edge
  • Epsilon symbol: ε

PDA and NDPA

  • Label format: input,pop/push
  • Examples:
    • a,A/BA
    • ε,Z/Z
    • b,ε/A

Turing Machine

  • Single tape segment: read/write,move
  • Multi-tape label: segment;segment;...
  • Move values: L, R, N
  • Examples:
    • Single tape: 0/1,R
    • Two tapes: 0/1,R;_/_,N

Mealy Machine

  • Label format: input/output
  • Examples:
    • a/0
    • b/1

Moore Machine

  • Output is state-bound rather than transition-bound
  • Transition labels still carry input symbols for movement

Typical Workflows

1) Build from Regex

  1. Open the tools menu.
  2. Use the regex conversion action.
  3. Place the generated automaton on canvas.
  4. Save and test strings from the saved card panel.

2) Convert NFA to DFA

  1. Select a saved NFA card.
  2. Trigger NFA to DFA conversion.
  3. Place the converted automaton.
  4. Compare transition tables and run test inputs.

3) Generate GNFA/CFG Artifacts

  1. Select a compatible saved automaton.
  2. Trigger FA to GNFA or CFG generation.
  3. Place/use generated artifacts for analysis.

4) Work with Full Workspace Snapshots

  1. Save canvas to JSON.
  2. Reload later from the workspace loader.
  3. Continue editing with previous state and saved cards restored.

Technical Highlights

  • Strongly typed model layer for state and alphabet handling
  • Regex simplification utilities integrated with FA summary flows
  • Language-equivalence-aware conversion safeguards in finite automata paths
  • Shared parsing/codec utilities for pushdown and machine snapshots
  • Refactored common FA view helpers to reduce duplicated logic

Technology Stack

  • Next.js 16
  • React 19
  • TypeScript 5
  • Tailwind CSS 4
  • Lucide React

Notes

  • This project is actively evolving; conversion and simplification paths may continue to improve over time.
  • If you use exported JSON from older versions, import compatibility logic attempts to normalize legacy shapes.

About

Computation Theory Simulator is an interactive, canvas-first web application for building, editing, converting, and simulating multiple automata models used in formal languages and automata theory courses.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages