Skip to content

Ability to run parsers for symbols like A*, A+, {A ","}+ and A? without introducing a dummy non-terminal - #2809

Merged
jurgenvinju merged 62 commits into
mainfrom
feat/toplevel-regular-parsers
Aug 27, 2026
Merged

Ability to run parsers for symbols like A*, A+, {A ","}+ and A? without introducing a dummy non-terminal#2809
jurgenvinju merged 62 commits into
mainfrom
feat/toplevel-regular-parsers

Conversation

@jurgenvinju

@jurgenvinju jurgenvinju commented Jun 19, 2026

Copy link
Copy Markdown
Member
  • add tests on Java level
  • write tests on Rascal level
  • wire in ability in parser and parsers feature in ParseTree.rsc
  • optional adaptations to ParserGenerator.rsc
    • generate parse methods with one artifical nonterminal wrapper
    • change names of parse methods to avoid clashes with non-terminal nested classes
  • fix new name collisions in generated parser code
  • fix double outermost nesting of regular productions in resulting trees
  • applications of subtree parsing in formatter fixed by removing trailing spaces

@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 58.62069% with 36 lines in your changes missing coverage. Please review.
✅ Project coverage is 45%. Comparing base (16abf95) to head (cd57531).

Files with missing lines Patch % Lines
...org/rascalmpl/values/parsetrees/SymbolFactory.java 33% 9 Missing and 1 partial ⚠️
...g/rascalmpl/values/RascalFunctionValueFactory.java 58% 6 Missing and 1 partial ⚠️
...g/rascalmpl/runtime/RascalRuntimeValueFactory.java 0% 5 Missing ⚠️
src/org/rascalmpl/parser/ParserGenerator.java 63% 4 Missing ⚠️
src/org/rascalmpl/parser/gtd/SGTDBF.java 85% 2 Missing and 1 partial ⚠️
src/org/rascalmpl/exceptions/Throw.java 50% 0 Missing and 2 partials ⚠️
...interpreter/utils/ReadEvalPrintDialogMessages.java 0% 2 Missing ⚠️
...rc/org/rascalmpl/repl/rascal/RascalLineParser.java 0% 2 Missing ⚠️
...c/org/rascalmpl/interpreter/result/JavaMethod.java 66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##              main   #2809     +/-   ##
=========================================
- Coverage       46%     45%     -1%     
- Complexity    6776    6791     +15     
=========================================
  Files          844     844             
  Lines        67103   68785   +1682     
  Branches     10022   10023      +1     
=========================================
+ Hits         30903   31334    +431     
- Misses       33828   35080   +1252     
+ Partials      2372    2371      -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DavyLandman
DavyLandman force-pushed the feat/toplevel-regular-parsers branch 2 times, most recently from 47dbf95 to 8fea7a7 Compare June 26, 2026 12:02
@sonarqubecloud

Copy link
Copy Markdown

Comment thread src/org/rascalmpl/parser/gtd/SGTDBF.java
@jurgenvinju
jurgenvinju marked this pull request as ready for review August 27, 2026 08:51
@sonarqubecloud

Copy link
Copy Markdown

@jurgenvinju
jurgenvinju merged commit f4b6caa into main Aug 27, 2026
9 checks passed
@jurgenvinju
jurgenvinju deleted the feat/toplevel-regular-parsers branch August 27, 2026 09:45

@DavyLandman DavyLandman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but there's some things that need to be cleaned up.

Comment thread .vscode/launch.json
Comment on lines +7 to +41
{
"type": "java",
"name": "$GENERATED_PARSER$244372483",
"request": "launch",
"mainClass": "org.rascalmpl.test.parser.$GENERATED_PARSER$244372483",
"projectName": "rascal"
},
{
"type": "java",
"name": "$GENERATED_PARSER$279786030",
"request": "launch",
"mainClass": "org.rascalmpl.test.parser.$GENERATED_PARSER$279786030",
"projectName": "rascal"
},
{
"type": "java",
"name": "TopLevelStarListEmpty",
"request": "launch",
"mainClass": "org.rascalmpl.test.parser.TopLevelStarListEmpty",
"projectName": "rascal"
},
{
"type": "java",
"name": "TopLevelStarList",
"request": "launch",
"mainClass": "org.rascalmpl.test.parser.TopLevelStarList",
"projectName": "rascal"
},
{
"type": "java",
"name": "NonTerminalStarListEmpty",
"request": "launch",
"mainClass": "org.rascalmpl.test.parser.NonTerminalStarListEmpty",
"projectName": "rascal"
},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as this shows up for everyone, shall we drop these from the file?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Comment thread src/org/rascalmpl/interpreter/result/JavaMethod.java
}
}
catch (ImplementationError e) {
throw e;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we document the reason why the REPL needs to not catch this error? (but rethrow it without any message/integration with the jline3 expectations?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember why this is again. could be debug code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that would make more sense indeed, let's get it our of there again 👍🏼

Comment thread pom.xml
Comment on lines -6 to 8
<version>0.43.0-RC13-SNAPSHOT</version>
<version>0.43.0-RC16-PREVIEW-REGULAR-PARSERS-SNAPSHOT</version>
<packaging>jar</packaging>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this version change should not be merged to mainbranch, it shoudl be reset to RC13-SNAPSHOT

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants