+ // This function serves in different modes, DFS mode or BFS mode, indicated + // by template variable __dfs_mode. See _M_main for details.
I think this would make more sense if you replace "serves" with "operates", and __dfs_mode is a template parameter, not a variable. + // It applys a Depth-First-Search (aka backtracking) on given NFA and input + // string. s/applys/applies/ + // At the very beginning the executor stands in the start state, then it try s/try/tries/ + // It first computes epsilon clousure for every state that's still matching, s/clousure/closure/ + // The order of which states needs to be recursively applied DFS matters, + // depend on which greedy mode we use. I don't understand this sentence at all, sorry. Can you explain it in other terms, and I'll try to suggest better phrasing? + // It significantly reduces potential duplicate states, so have a better + // upper bound; but it deserves more overhead. s/have/has/ And should it say "requires" not "deserves"? + else // Ungreedy mode s/Ungreedy/non-greedy/ + // DON't attempt anything, because there's already someone s/DON't/DON'T/ someone? Should it be "something" or "another state" instead? + // has one more time ungreedy quantifier loop. ??? Maybe "requires another iteration of a non-greedy quantifier loop" ? + // This prevents the executor from get into infinite loop when use This should be "... getting into an infinite loop when using ..."