-
Notifications
You must be signed in to change notification settings - Fork 196
Closed
Description
Consider the following code (slow.re):
/*!re2c
[ac]{0,12} [a] [ac]{0,12} {}
*/
It takes re2c a long time to compile this code and the generated lexer is very large:
$ time re2c slow.re > slow.c && stat -c '%s' slow.c
real 0m2.764s
user 0m2.743s
sys 0m0.022s
1384716
Increasing repetition counter (any of the two, or both):
/*!re2c
[ac]{0,14} [a] [ac]{0,14} {}
*/
Causes insane increase of time and size:
$ time re2c slow.re > slow.c && stat -c '%s' slow.c
real 1m54.837s
user 1m54.733s
sys 0m0.120s
5627102
If we minimize the generated DFA, it would get reasonably small. (I experimented with minimization a bit; the number of states is reduced by several orders of magnitude and the minimization itself takes reasonable time, which suggests that the slowdown might be caused by inefficiency in FSA determinisation).
Metadata
Metadata
Assignees
Labels
No labels