Skip to main content

Computer Science Education / Interactive Visualization

Regex2NFA

A full-canvas learning tool that turns regular-expression syntax into a visible state machine and shows exactly how an input moves through it.

Regex2NFA workspace showing a Thompson NFA graph, centered expression, floating utilities, and input simulation dock.
Source: Live productThe full-canvas workspace keeps the automaton dominant while expression, graph, and simulation controls remain close at hand.

Public evidence

These reviewed public sources support the adjacent build claims; they do not imply adoption or unmeasured outcomes.

Problem

Target user
Students learning how regular expressions become nondeterministic finite automata and how those machines process strings.
Challenge
A correct conversion result is not enough when the state structure, epsilon transitions, and active simulation path remain difficult to follow.
Why it mattered
If construction and execution are hidden behind controls or dense panels, the learner sees an answer without building intuition for why it is correct.

Constraints

  • The graph must remain readable and interactive across desktop and mobile layouts.
  • Start, accept, active, epsilon, and symbol transitions need distinct non-color cues.
  • The redesign must retain the existing parser and simulator behavior rather than replacing it with a visual mock.

Solution

The interface treats the NFA as the primary artifact, keeps the active expression centered, and reveals authoring, guidance, export, and simulation controls only when needed.

  1. Choose an example or enter a custom regular expression from the expression drawer, then generate its Thompson NFA.
  2. Pan the full-canvas graph, distinguish start and accept rings, follow dashed epsilon edges, and recenter or export the result.
  3. Enter a test string and animate the input tape while active states progress to an accepted or rejected result.

Engineering Decisions

  1. Make the graph the workspace, not a card

    Constraint
    Persistent side panels and toolbars competed with the automaton for limited screen space.
    Decision
    Use a full-viewport graph with floating expression, information, recenter, export, and simulation controls.
    Rationale
    Keep the machine visible while controls appear only at the moment they are useful.
    Trade-off
    Some secondary actions require opening a drawer instead of remaining permanently visible.
  2. Animate one clear simulation path

    Constraint
    A full transport console added controls before a learner understood the basic run state.
    Decision
    Lead with one Animate action, a speed multiplier, and a live input tape that resolves to Accepted or Rejected.
    Rationale
    Make the primary learning loop obvious while keeping simulation feedback close to the graph.

Outcomes

Product and delivery

  1. Full canvas

    Graph stays primary

    Expression, guide, graph utility, and simulation controls float or open on demand without permanently reducing the visualization area.

Implementation evidence

  1. 4 routes

    One coherent system

    Workspace, fullscreen graph, unified guide, and legacy About redirect share one responsive visual language and URL-persisted expression state.

Learnings and Next Steps

What I learned

  • For educational visualization, progressive disclosure works only when the core artifact and current state remain continuously visible.
  • A near-monochrome graph can preserve semantic clarity through rings, dashes, labels, and motion instead of relying on color alone.

What I would improve

  • Add optional construction-step playback so learners can inspect how each regex operator contributes fragments to the final NFA.

What remains unvalidated

  • The redesign has not yet been evaluated in a structured classroom study or measured against learning outcomes.