-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Evaluation: moving from Xtext to ANTLR for integration in metafacture-core #298
Conversation
- Copy generated grammar to `src/main/antlr/` - Run `./gradlew generateGrammarSource` - See output in `metafix/build/generated-src`
Thanks for the initial evaluation! Agree with your assessment and conclusion. From a "purity" standpoint, I would prefer option 3), though. But I have no idea how time-consuming it would be. There were also some practical reasons to move away from Xtext (#90, hbz/lobid-resources#1462), aside from the integration with metafacture-core. But if it turns out that switching to pure ANTLR is not feasible, then we'd probably just have to live with it. |
According to my research there's no easy way for an ANTLR grammar to build an Language Server like there is for Xtext like we did for the VSC extension following this instructions. So if we switch to ANTLR we need to write a Language Server ourselves or do it like for the flux extension. |
We discussed this in our meeting today and depending on our priorities we could either start with 1), the move into the core repo (if our priority is to unify the repo and build) or with 3), moving to plain ANTLR (if our priority is to get rid of the Xtext dependencies). So basically, these two are independent and would not block each other. We also discussed that it might make sense to clean up and upgrade Gradle in the metafacture-core build before 1), see metafacture/metafacture-core#484. And to assess what we'd actually lose initially when switching to plain ANTLR, it would be great to have an overview of the functionality that's currently coming from the language server (vs. highlighting implemented in the VSC extension itself), assigned @katauber for that. |
This might actually be blocked by Xtext not being compatible with Gradle 8.x (see #283). Will check if this is still the case. |
After my research I think we do not loose much when switching to ANTLR because the Xtext Language server generated by the gradle plugin is very simple. The server only evaluates if a fix file meets the requirements of the grammar file (e.g. if there is and |
Basic idea: implement the DSL part of Fix like Flux See metafacture/metafacture-fix#298
Generate Java sources after edit: `./gradlew generateGrammarSource` See metafacture/metafacture-fix#298
I've pushed an initial draft setup for what an ANTLR-based Fix implementation could look like to the https://github.com/metafacture/metafacture-core/compare/metafix Perhaps this can help us to decide which way to go here, in particular when assessing the effort required for our options. |
Discussed in our meeting: we will open a new issue and try to implement as described in 1). |
Initial setup with ANTLR grammar:
src/main/antlr/
./gradlew generateGrammarSource
metafix/build/generated-src
While the basic idea of reusing the ANTLR grammar generated by Xtext seems to work, there are some issues:
Overall, I see these different ways we could go, depending on our priorities:
Both 2) and 3.) would also require considering how to implement the Language Server which is currently generated by Xtext, and which we use for the VSC extensions.
Perhaps 1.) would be a good first step, and we'll see how to proceed from there (to 2, to 3, or stay)?