discuss regex ir opt

This commit is contained in:
Youmu Liu
2026-06-22 18:18:16 +08:00
parent 062ffacf88
commit 7e5e4d1f7a
18 changed files with 1499 additions and 127 deletions
+3 -3
View File
@@ -26,7 +26,7 @@
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.RegularAnalysis.Abstraction;
using StgSharp.RegularAnalysis.TextRegex;
using StgSharp.RegularAnalysis.Text;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -44,7 +44,7 @@ namespace StgSharp
@"abc[0-9]x|abc[0-9]y|abd[0-9]x|abd[0-9]y|xyz",
@"get_name|get_value|get_type|set_name|set_value|set_type",
@"helix|hello|help|hero|hers|her",
@"a*.[abc]*(abcd|a(bc)c)+(?<name>abc)"
@"a*.[abc]*(abcd|a(bc)c)+(?<name>abc{11,13})"
];
public static void Run()
@@ -61,7 +61,7 @@ namespace StgSharp
Console.Write(new string('|', enumerator.Depth));
Console.WriteLine($"\t{node.Source.Value}\t{node.Source.Flag}");
}
List<RegexIR> ir = RegexInterpreter.GenerateIR(tree);
List<RegexHIR> ir = RegexInterpreter.GenerateIR(tree);
Console.WriteLine("-----IR-----");
for (int i = 0; i < ir.Count; i++) {
Console.WriteLine(ir[i].AsCommand(i));