Message from JavaScript discussions

August 2017

— They are 1:1 mapping as a DFA and regex can describe each other 100%

— 

So if you have <w{5}> how can you tell it derives the same string as /hello/ without passing in any data or otherwise running the regular expression builtins? You do simple comparison operators on the transition ranges between the nodes, very simple!

— All ranges for the first one would be {0, 65535} whereas for the second one it would vary... {72, 72} and then {69, 69} etc... since the ranges of the second expression fit into the ranges of the first you can say "Yes, these two expressions can derive the same string". If you want a strict result that says "these two expressions derive the same EXACT strings, no more and no less", then you can do a direct strict equality comparison instead

Message permanent page

— Ah.

— Thanks

— This is, again, for /hello/ except showing the code points:

-->(s1)-72->(s2)-69->(s3)-76->(s4)-76->(s5)-79->((s6))


and here's what <w{5}> looks like:
-->(s1)-0,65535->(s2)-0,65535->(s3)-0,65535->(s4)-0,65535->(s5)-0,65535->((s6))

Message permanent page

— Not yet but I might

— For now I just made a simple DFA which can function just like a regex

— Parsing the regex to the DFA is another story... haha

— Deterministic finite automata are a form of tree automation, it's how CPU's work on a low level and also parsers

Message permanent page

— A parser will use DFA/NFA to parse code one symbol at a time

— For my use case you can tell if two totally different regex can derive the same strings