-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement redundant epsilon removing optimization
* Introduced `RedundantEpsilonRemover` that performs the following ATN optimizations (described below): * Removing of single incoming epsilon transition * Removing of single outgoing epsilon transition with several incoming transitions * Removed all optimizations from `ParserATNFactory` since they are useless, not fully correct and are performed on the separated optimization step * Introduced `ATNOptimizerHelper` that do the following: * Calculates incoming transitions that are used in ATN optimizers * Tracks replacement of state that are being removed during optimization. Old states are being replaced on the new ones in the final step (`updateAstNodes`) * Compresses array of ATN states (removes null items after previous optimization steps, `compressStates`) * Fixed the previous `ATNOptimizer` and renamed to `SetMerger`. Now it considers incoming transitions and `ATNOptimizerHelper` accurately tracks replacements. Implemented optimizations decreases ATN especially for lexers and should improve performance for generated parsers because of decreased number of method calls. Also they don't affect runtime code except of interpreter part (that is buggy anyway). Signed-off-by: Ivan Kochurkin <[email protected]>
- Loading branch information
1 parent
e09711b
commit 0eb852b
Showing
18 changed files
with
1,078 additions
and
957 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,5 +31,5 @@ s | |
1 | ||
2 | ||
3 | ||
1 [13 6] | ||
1 [8 0] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.