[ 
https://issues.apache.org/jira/browse/GROOVY-12173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18097275#comment-18097275
 ] 

ASF GitHub Bot commented on GROOVY-12173:
-----------------------------------------

codecov-commenter commented on PR #2720:
URL: https://github.com/apache/groovy/pull/2720#issuecomment-5011003998

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2720?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :x: Patch coverage is `20.00000%` with `8 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 69.2034%. Comparing base 
([`c76e8dc`](https://app.codecov.io/gh/apache/groovy/commit/c76e8dc8df30e569789792a250280a447b25bb69?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`a76dcfd`](https://app.codecov.io/gh/apache/groovy/commit/a76dcfd73db98d8d18e3a2a6fede0e314b5a3f4f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 1 commits behind head on master.
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2720?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[...va/org/apache/groovy/parser/antlr4/AstBuilder.java](https://app.codecov.io/gh/apache/groovy/pull/2720?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2FAstBuilder.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L0FzdEJ1aWxkZXIuamF2YQ==)
 | 20.0000% | [6 Missing and 2 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2720?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/2720/graphs/tree.svg?width=650&height=150&src=pr&token=1r45138NfQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/groovy/pull/2720?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #2720        +/-   ##
   ==================================================
   - Coverage     69.2065%   69.2034%   -0.0031%     
   - Complexity      34466      34469         +3     
   ==================================================
     Files            1539       1539                
     Lines          129852     129852                
     Branches        23650      23651         +1     
   ==================================================
   - Hits            89866      89862         -4     
   - Misses          31939      31941         +2     
   - Partials         8047       8049         +2     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2720?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...va/org/apache/groovy/parser/antlr4/AstBuilder.java](https://app.codecov.io/gh/apache/groovy/pull/2720?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2FAstBuilder.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L0FzdEJ1aWxkZXIuamF2YQ==)
 | `86.8062% <20.0000%> (+0.0628%)` | :arrow_up: |
   
   ... and [4 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/2720/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test 
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, 
report on failures, and find test suite problems.
   - :package: [JS Bundle 
Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save 
yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>




> Left-factor parser rules to reduce lookahead on hot parse paths
> ---------------------------------------------------------------
>
>                 Key: GROOVY-12173
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12173
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Daniel Sun
>            Priority: Major
>
> h3. Motivation
> Successful parse cost in the ANTLR4 (Parrot) parser is dominated by adaptive 
> prediction. Several grammar rules still force the simulator to explore 
> *sibling alternatives that share a long common prefix*, or to re-run an 
> expensive semantic predicate that was already evaluated. That inflates DFA 
> growth and SLL work even when the input is valid.
> This improvement left-factors and simplifies a small set of 
> non-left-recursive rules so decisions commit earlier, *without* changing 
> language semantics or the AST shapes {{AstBuilder}} relies on.
> h3. Changes
> *1. {{importDeclaration}} — left-factor {{annotationsOpt IMPORT}}*
> ** Before: two alternatives both started with {{annotationsOpt IMPORT}}, so 
> prediction replayed the shared prefix to choose module vs ordinary import.
> ** After: one {{IMPORT}}, then {{MODULE qualifiedName}} vs {{STATIC? 
> qualifiedName ...}}. Decision is effectively one token after {{IMPORT}}.
> *2. {{typeNamePairs}} — left-factor {{LPAREN}} / {{RPAREN}}*
> ** Before: two alternatives both wrapped the list in parentheses (positional 
> multi-assign vs GEP-20 keyed pairs).
> ** After: open paren once; choose {{typeNamePair}} vs {{keyedPair}} (keyed 
> form distinguished by {{COLON}}).
> *3. {{pathElement}} — left-factor {{DOT}}*
> ** Before: {{DOT nls NEW creator}} and {{DOT nls namePart}} were separate 
> alternatives, both starting with {{DOT}}, so every property access paid for 
> exploring both.
> ** After: {{DOT nls}} then {{NEW creator}} vs name selection. After {{DOT}}, 
> {{NEW}} is LL(1). Non-DOT selectors ({{?.}}, {{*.}}, {{??.}}, {{.&}}, {{::}}) 
> stay separate.
> *4. {{blockStatement}} — drop redundant local-variable alternative*
> ** Before:
> {noformat}
> blockStatement
>     : localVariableDeclaration
>     | statement
>     ;
> {noformat}
> ** {{statement}} already includes {{localVariableDeclaration}} 
> ({{#localVariableDeclarationStmtAlt}}). Inside a block, command-style calls 
> such as {{foo bar}} therefore evaluated {{isInvalidLocalVariableDeclaration}} 
> *twice* (fail on the first alt, fail again via {{statement}}).
> ** After: {{blockStatement : statement}} only. Observationally equivalent; 
> halves predicate traffic on that path.
> ** {{AstBuilder#visitBlockStatement}} updated to visit {{statement}} only.
> h3. Non-goals / deliberate non-changes
> * Do *not* left-factor the three {{#relationalExprAlt}} alternatives under 
> left-recursive {{expression}} into one subrule group. ANTLR's left-recursion 
> rewriter only preserves operator precedence for direct {{expression OP 
> expression}} forms; factoring the operator into a parenthesised group lets 
> {{right=expression}} accept lower-precedence ops (e.g. {{&&}}), so {{x >= min 
> && x <= max}} can parse as {{x >= (min && ...)}} and break type checking.
> * Index vs named property args ({{indexPropertyArgs}} / 
> {{namedPropertyArgs}}) still share {{SAFE_INDEX|LBRACK}}; merging them would 
> reshape the CST and force a larger {{AstBuilder}} change for limited gain — 
> left for a follow-up if measured.
> h3. Compatibility
> * Language surface and AST construction paths are unchanged for correct 
> programs.
> * No public API additions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to