SkillAgentSearch skills...

Dfa2regex

Converts Deterministic finite automata to regular expressions.

Install / Use

/learn @phiresky/Dfa2regex
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

dfa2regex

Converts Deterministic finite automata to regular expressions.

Hosted Version

Example:

dfa

Becomes

((1|((ε|0)(ε|0)*1))|((1|((ε|0)(ε|0)*1))((ε|1)|(0(ε|0)*1))*((ε|1)|(0(ε|0)*1))))

Which is automatically simplified to

((0*1)|((0*1)(1?|(0+1))+))

The algorithm itself is short: https://github.com/phiresky/dfa2regex/blob/gh-pages/src/dfa2regex.ts#L108-L116

Related Skills

View on GitHub
GitHub Stars5
CategoryDevelopment
Updated1y ago
Forks0

Languages

JavaScript

Security Score

55/100

Audited on Nov 5, 2024

No findings