yurloc commented on code in PR #5751: URL: https://github.com/apache/incubator-kie-drools/pull/5751#discussion_r1506252394
########## drools-drl/drools-drl-parser/Developer_Notes.md: ########## @@ -0,0 +1,70 @@ +# drools-drl-parser + +In this `dev-new-parser` branch, `drools-drl-parser` has 2 implementations of the DRL parser. The new parser is under development, and the old parser is used in the current drools code base. + +The old DRL parser is based on Antlr3 and contains lots of hard-coded logic in generated java codes, so it's hard to maintain. e.g. [DRL6Parser](https://github.com/apache/incubator-kie-drools/blob/main/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6Parser.java). It is the reason why the new parser is being developed. The old parser resources is placed under `src/main/java/org/drools/drl/parser/lang` and `src/main/resources/org/drools/drl/parser`. Review Comment: ```suggestion The old DRL parser is based on Antlr3 and contains lots of hard-coded logic in generated java codes, so it's hard to maintain e.g. [DRL6Parser](https://github.com/apache/incubator-kie-drools/blob/main/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6Parser.java). It is the reason why the new parser is being developed. The old parser resources are placed under `src/main/java/org/drools/drl/parser/lang` and `src/main/resources/org/drools/drl/parser`. ``` ########## drools-drl/drools-drl-parser/Developer_Notes.md: ########## @@ -0,0 +1,70 @@ +# drools-drl-parser + +In this `dev-new-parser` branch, `drools-drl-parser` has 2 implementations of the DRL parser. The new parser is under development, and the old parser is used in the current drools code base. + +The old DRL parser is based on Antlr3 and contains lots of hard-coded logic in generated java codes, so it's hard to maintain. e.g. [DRL6Parser](https://github.com/apache/incubator-kie-drools/blob/main/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/DRL6Parser.java). It is the reason why the new parser is being developed. The old parser resources is placed under `src/main/java/org/drools/drl/parser/lang` and `src/main/resources/org/drools/drl/parser`. + +The new DRL parser is based on Antlr4, which has Visitor and Listener support, so the parser would have cleaner separation between the parser syntax (`DRLParser.g4`) and Java code which generates Descr objects (`DRLVisitorImpl.java`). It would be easier to maintain and extend the parser. The new parser resources is placed under `src/main/java/org/drools/drl/parser/antlr4` and `src/main/antlr4/org/drools/drl/parser/antlr4`. + +## The current status of the new parser development +The new DRL parser doesn't introduce new syntax at the first stage. In order to keep the compatibility with the old parser, we make use of existing unit tests. + +As of 2024/02/27, we hit lots of test failures in existing drools unit tests. The test failures are filed as child issues of the parent issue [Experiment: New DRL Parser](https://github.com/apache/incubator-kie-drools/issues/5678). We will fix the test failures one by one. + +## How to contribute to the development + +**Contribution would be highly appreciated!** Here is a rough guide to contribute to the development. + +1. Look at the parent issue [Experiment: New DRL Parser](https://github.com/apache/incubator-kie-drools/issues/5678) and choose a child issue which you want to work on. +2. If you have an ASF committer role, assign yourself to the child issue. If you don't have the role, post a comment on the child issue that you are working on it so that we can avoid duplicated work. +3. Create a feature branch based on the `dev-new-parser` branch. +4. Fix the issue and make sure that the test in problem is passed and also all tests under `drools-drl-parser-tests` are passed. +5. Add new tests to `drools-drl-parser-tests` to cover the issue. Hopefully, such a test would be a Descr comparison test. See `MiscDRLParserTest`. Review Comment: ```suggestion 5. Add new tests to `drools-drl-parser-tests` to cover the issue. Hopefully, such a test would be a Descr comparison test. See `MiscDRLParserTest` and `DRLExprParserTest`. ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
