A JavaScript library that compiles a regular-expression-like syntax into fast deterministic finite automata (DFA). Version 1.2.0 is the latest as of 2025, with no active development in recent years. It is designed for pattern matching against non-string sequences (e.g., arrays of symbols) and provides a portable state machine representation. Supports common regex operators like alternation, concatenation, repetition, and tagging. Files are written in a custom CoffeeScript-like DSL and compiled to efficient match tables.
npm install dfaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to define a state machine DSL, compile it, and find matches in an array of symbols.
Use import syntax or set up your environment to handle ESM packages. If you must use require(), use require('dfa/compile').default.Consider using an alternative library or forking the repository if updates are needed.
Read the file contents using fs.readFileSync or similar, then pass the string to compile.
Adjust your logic: the match covers indices from start to end-1 inclusive.
Map your input values to integers before using match().
If upgrading from <1.2.0, update import statements from require('dfa/compile') to import compile from 'dfa/compile'.Use import syntax or set type: 'module' in package.json, or use dynamic import().
Use the correct import: import compile from 'dfa/compile'.
Ensure your bundler (webpack, rollup, etc.) supports ESM and that the package is installed correctly.
No dependency data recorded yet.