JFlutter is a Flutter reimplementation of the JFLAP educational tool. It offers an interactive, touch-first workspace for creating, analysing, and simulating finite automata, grammars, and Turing machines on mobile and desktop platforms.
Status: Work in Progress – the core learning workflows are available while UI polish and advanced visualisations are still being built.
- Touch-friendly canvas for creating and editing automata
- Step-by-step simulators for finite automata, pushdown automata, and Turing machines
- Grammar editors with validation and conversion helpers
- Inline explanations and diagnostics to support classroom use
- Conversions between NFA, DFA, and regular expressions
- DFA minimisation and automaton simulation traces
- Grammar analysis utilities and the Pumping Lemma training game
- Single-tape Turing machine construction and execution
- Material 3 interface with light and dark themes
- Adaptive layouts for phones, tablets, desktops, and the web
- Optimised canvas rendering (viewport culling, level-of-detail drawing, and highlight tracing)
- Persistent trace management across simulators and resilient import/export flows for JFLAP XML, JSON, and SVG
The repository bundles ready-to-use examples covering DFAs, NFAs, CFGs, PDAs, and Turing Machines in jflutter_js/examples/. They are declared in pubspec.yaml so the material is available without a network connection.
┌─────────────────────────────────────┐
│ Presentation Layer │
│ (UI Components, Pages, Providers) │
├─────────────────────────────────────┤
│ Core Layer │
│ (Algorithms, Models, Business) │
├─────────────────────────────────────┤
│ Data Layer │
│ (Services, Repositories, Storage) │
└─────────────────────────────────────┘
lib/
├── app.dart # Root widget and global configuration
├── core/ # Core business logic
│ ├── algorithms/ # Automata algorithms and utilities
│ ├── constants/ # Shared constants and definitions
│ ├── entities/ # Domain entities shared across layers
│ ├── models/ # Immutable data models and value objects
│ ├── parsers/ # File/grammar parsing helpers
│ ├── regex/ # Regex helpers and transformation pipeline
│ ├── repositories/ # Repository contracts
│ ├── services/ # Core services (diagnostics, trace, etc.)
│ ├── use_cases/ # Application-specific business rules
│ ├── validators/ # Input and semantic validators
│ ├── algo_log.dart # Algorithm execution logging
│ ├── error_handler.dart # Error handling helpers
│ └── result.dart # Result/Either pattern implementation
├── data/ # Data layer implementations
│ ├── data_sources/ # Concrete data sources (e.g., file system)
│ ├── models/ # DTOs and serialization helpers
│ ├── repositories/ # Repository implementations
│ ├── services/ # High-level services used by the app
│ └── storage/ # Persistent storage adapters (e.g., SharedPreferences)
├── features/ # Cross-cutting feature modules
│ ├── canvas/ # Canvas orchestration layers
│ │ └── graphview/ # GraphView controllers, mappers, and highlight channels
│ └── layout/ # Layout helpers and view-specific configs
├── injection/ # Dependency injection setup
│ └── dependency_injection.dart # Service registration and bootstrap
├── main.dart # Application entry point
└── presentation/ # UI layer and state management
├── pages/ # Screens and navigation flows
├── providers/ # Riverpod providers
├── theme/ # App theming (Material 3)
└── widgets/ # Reusable UI components
- Flutter SDK 3.24.0+
- Dart SDK 3.8.0+
- Android Studio / VS Code (recommended)
# Clone the repository
git clone https://github.com/ThalesMMS/jflutter.git
cd jflutter
# Install dependencies
flutter pub get
# Run the app
flutter runAndroid release builds are signed with the dev.jflutter.app application ID. The Gradle script loads release keystore
credentials from android/key.properties, which can now be generated from environment variables using
android/scripts/create_key_properties.sh.
- Generate or obtain a release keystore (for example
android/keystores/jflutter-release.jks). Keep this file out of version control. - Export the following environment variables before building or running the helper script:
JFLUTTER_KEYSTORE_PASSWORDJFLUTTER_KEY_ALIASJFLUTTER_KEY_PASSWORD- (optional)
JFLUTTER_KEYSTORE_PATH(defaults tokeystores/jflutter-release.jks, relative toandroid/)
- Run
./android/scripts/create_key_properties.shto generateandroid/key.propertiesfrom the exported values.
For CI/CD, store the keystore and credential values as encrypted secrets. During the workflow, recreate the keystore file
and call the helper script before flutter build. Example (GitHub Actions):
mkdir -p android/keystores
echo "$JFLUTTER_KEYSTORE_BASE64" | base64 --decode > android/keystores/jflutter-release.jks
export JFLUTTER_KEYSTORE_PASSWORD="$JFLUTTER_KEYSTORE_PASSWORD"
export JFLUTTER_KEY_ALIAS="$JFLUTTER_KEY_ALIAS"
export JFLUTTER_KEY_PASSWORD="$JFLUTTER_KEY_PASSWORD"
./android/scripts/create_key_properties.sh- Android – Primary target with touch-first workflows
- iOS – Daily-driver support, verified on current iOS devices
- Web – Responsive build suitable for classroom demos
- Desktop – Windows, macOS, and Linux builds share the same UI
- Open the FSA workspace.
- Add states with the + action and drag them into place.
- Choose the arrow tool to connect states with transitions.
- Double tap to edit state names or toggle initial/final markers.
- Run conversions or minimisation from the algorithms panel.
- Enter a string in the simulation panel.
- Select Simulate to execute the automaton.
- Inspect the trace output or canvas highlights to understand each step.
- Open the Grammar workspace.
- Provide the grammar metadata and production rules.
- Use the available algorithms to convert or analyse the grammar.
- Test sample strings directly within the editor.
Run flutter test (Flutter 3.24.0+ / Dart 3.8.0+) to execute the full suite. Tests are organised to mirror the architecture:
- Algorithm validation –
test/unit/keeps DFA/NFA conversions, grammar analysis, and regex tooling aligned with the references. - Core services –
test/core/services/verifies utilities such as the simulation highlight broadcaster. - Canvas features –
test/features/canvas/graphview/exercises controllers, mappers, and models for the interactive canvas. - Integration –
test/integration/io/performs round-trips across JFLAP XML, JSON, SVG, and the offline example bundle. - Widget harnesses –
test/widget/presentation/drives UI flows while production widgets are completed.
test/widget/presentation/visualizations_test.dartintentionally fails to track the future golden-test pipeline.- Temporary widget stubs live in
test/widget/presentation/ux_error_handling_test.dartuntil the design-system components ship.
# Run all tests
flutter test
# Run specific test suites
flutter test test/unit/ # Core algorithm suites
flutter test test/features/ # Feature-level canvas suites
flutter test test/integration/ # Integration tests
flutter test test/widget/ # Widget harnesses
# Run with code coverage
flutter test --coverage
lcov --list coverage/lcov.info
# Static analysis
flutter analyzeDuring the ongoing migration we rely on the projects stored in References/ as the source of truth for algorithms and data structures. The Dart repositories and the Python automata-main module provide validation checkpoints while the Flutter core is rebuilt.
The References/ directory contains authoritative implementations used as the source of truth for algorithms and data structures during the migration process. Each algorithm modification is cross-validated against these references to ensure correctness and maintainability.
- Algorithm Development - Implement new algorithms based on reference implementations
- Cross-Validation - Compare outputs with reference implementations
- Test Suite Validation - Validate against reference test cases
- Performance Benchmarking - Ensure performance meets or exceeds references
- Documentation - Record any deviations with rationale in
docs/reference-deviations.md
- Algorithm Coverage - Deterministic automata, grammar, and regex suites in
test/unit/back the domain layer. - Integration Guardrails - Serialization and examples are validated through the IO round-trip suites in
test/integration/io/. - UI Exercisers - Canvas and control widgets are kept regression-safe via the harnesses in
test/widget/presentation/, with golden coverage tracked by the pendingvisualizations_test.dartplaceholder. - Performance Monitoring - Regular benchmarking against reference implementations.
- Deviation Tracking - All deviations documented with impact assessment and cross-checked with references.
- Continuous Validation - Ongoing comparison with reference implementations.
- Version Control - References maintained in separate directories
- Update Process - Regular updates to reference implementations
- Compatibility - Ensure compatibility with reference API changes
- Documentation - Keep reference usage documentation current
- 13 algorithms covering DFA/NFA conversions, regex tooling, and grammar processing
- Riverpod-based state management with a clean-architecture layout
- Responsive UI components for automata, grammars, PDAs, and Turing machines
- Offline example library and import/export flows for JFLAP interoperability
- Richer visual explanations for algorithm steps
- Expanded export formats and sharing workflows
- Guided tutorials for first-time learners
- Additional grammar analysis tooling and PDA/TM canvas refinements
- Clean Architecture - Separation of concerns
- Type Safety - Strong typing throughout
- Error Handling - Comprehensive error management
- Testing - Unit, integration, and contract tests
- Documentation - Inline documentation and examples
- Responsive Design - Mobile-first approach
- Fork the repository
- Create a feature branch
- Follow the coding standards
- Add tests for new features
- Submit a pull request Try to maintain compatibility. Avoid changing core automata/grammar/pda/turing machine algorithms without discussing it first.
- Optimise for mobile devices and accessibility
- Keep tests and documentation current
- Coordinate changes to shared algorithms before altering behaviour
JFlutter is designed for:
- Computer Science Students - Learning automata theory
- Educators - Teaching formal languages
- Researchers - Prototyping automata
- Developers - Understanding regular expressions
This project is distributed under a dual license structure:
- License: Apache License 2.0
- Copyright: 2025–present JFlutter contributors (see Contributors)
- Contact: [email protected]
- File: LICENSE.txt
- License: JFLAP 7.1 License (Non-commercial)
- Copyright: 2002-2009 Susan H. Rodger (Duke University)
- File: LICENSE_JFLAP.txt
- The Flutter port (all new code) is licensed under Apache 2.0, allowing free use, modification, and distribution with proper attribution
- The original JFLAP algorithms and concepts remain under the original JFLAP license, which prohibits commercial use
- This dual structure ensures compliance with the original license while allowing the Flutter port to be freely used and modified
- Thales Matheus Mendonça Santos - Complete JFlutter development until 2025-10-07, graphview fork optimization for loop transitions rendering
- Email: [email protected]
- Year: 2025
- Susan H. Rodger (Duke University) - Original JFLAP creator and maintainer
- JFLAP Team - Thomas Finley, Ryan Cavalcante, Stephen Reading, Bart Bressler, Jinghui Lim, Chris Morgan, Kyung Min (Jason) Lee, Jonathan Su, Henry Qin
- Duke University - For the foundational educational tool
- Website: http://www.jflap.org
-
References/automata-main/- Python implementation of automata algorithms- Source: automata-main by Caleb Evans
- Usage: Primary reference for NFA to DFA conversion, DFA minimization, regex operations
- Validation: All core algorithms validated against this implementation
-
References/dart-petitparser-examples-main/- Dart parser examples and utilities- Source: dart-petitparser-examples by PetitParser
- Usage: Regex parsing, grammar analysis, parser construction
- Validation: Parser implementations validated against these examples
-
References/AutomataTheory-master/- Dart automata theory implementations- Source: AutomataTheory by Pedro Lemos
- Usage: Finite automata operations, language theory concepts
- Validation: Automaton operations validated against this reference
-
References/nfa_2_dfa-main/- NFA to DFA conversion algorithms- Source: nfa_2_dfa by Na7iD
- Usage: NFA to DFA conversion algorithms, state minimization
- Validation: Conversion algorithms validated against this implementation
-
References/turing-machine-generator-main/- Turing machine implementations- Source: turing-machine-generator by Nikhil Narayanan
- Usage: Turing machine simulation, tape operations, state management
- Validation: TM operations validated against this reference
- JFLAP Educational Philosophy - Interactive learning approach
- Material Design 3 - Modern UI/UX principles
- Flutter Best Practices - Mobile-first development patterns
- Academic Automata Theory - Hopcroft, Ullman, and Sipser algorithms
- Flutter Team - For the excellent mobile framework
- Dart Team - For the programming language
- Riverpod Team - For state management solutions
- GraphView Contributors - For the graph rendering toolkit powering the native automaton canvas
- Material Design Team - For design system and components
- Open Source Community - For inspiration and support
- Prof. Zenilton Kleber Gonçalves do Patrocínio Júnior - For educational guidance and feedback
- @Gaok1 - Luis Phillip Lemos Martins - For inspiring this Flutter project



