Skip to content

kkshinkai/little-regex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️ Deprecated: Will not continue to adapt Unicode parsing.

Little Regex

A small program I written while learning F#.

Features

  • Generate AST from regular expression (LALR parser / SDT);
  • Generate DFA from AST (Thompson's construction);
  • Convert NFA to DFA (Subset construction);
  • Minimize DFA (Hopcroft Algorithm);
  • Support UTF-8;

Quick Start

Install .NET Core and run the following commands:

cd <path-to-proj-dir>
dotnet run

Examples

>>> parse (a|b)*|(c|d)*

ast "(a|b)*|(c|d)*"
`- alter |
  |- alter |
  | |- char 'a'
  | `- char 'b'
  `- alter |
    |- char 'c'
    `- char 'd'

>>> match (a|b)* ababbb
match

>>> match (a|b)* abbbc
mismatch

>>> match (a|b)*(c*|d) aabababbccc 
match

>>> match (a|b)*(c*|d) aabababbd 
match

>>> match (a|b)*(c*|d) aabababbcd
mismatch

License

Microsoft Reciprocal License (MS-RL), see LICENSE.txt for details.

About

A small program I written while learning F#.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages