Skip to content
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

Consider replacing javacc with existing Antlr 4 grammar #27

Open
timboudreau opened this issue Sep 18, 2018 · 8 comments
Open

Consider replacing javacc with existing Antlr 4 grammar #27

timboudreau opened this issue Sep 18, 2018 · 8 comments

Comments

@timboudreau
Copy link

Antlr 4 is considerably more powerful than javacc, and javacc's future is a bit less certain these days; a Rust grammar is available that could probably just be picked up and used, but it would mean some rework.

More beneficially, it would allow for considerably more sophisticated syntax highlighting, such as distinguishing macro uses and more.

@timboudreau
Copy link
Author

Some work in progress on that

@Chris2011
Copy link

Wow, great @timboudreau :) Nice to see someone works on the project.

@Chris2011
Copy link

@drrb what is your status atm moment? Do you still work on the project too?

@Chris2011
Copy link

I wanted to change the grammar to use the textmate rust file. @timboudreau can antlr and textmate coexist? I mean using the rust textmate for syntax highlighting and the antlr for everything else or doesn't make it sense? Maybe we can change to textmate and using the language server for the rest.

@timboudreau
Copy link
Author

I kind of forked off from working on this to build a set of modules for supporting Antlr languages in NetBeans in general - i.e. define syntax highlighting and a few other things as an annotation that references the Antlr-generated lexer and parser, and the annotation processor generates 90% of the module including navigator panels and a bunch of other stuff - if you add some analysis stuff (also mostly annotations), you get things like finding references.

So, eventually I plan to get back to Rust+Antlr, building on that - I found one Antlr grammar that sort of worked but was kind of insanely written, and have been using that as the basis for a replacement.

@Chris2011
Copy link

Chris2011 commented Jan 6, 2022

Hey @timboudreau what is the state of your rewrite process? I see that the last commit of you was also back in 2019. Maybe the grammar ist better nowadays? Just guessing. Found this just now: https://github.com/rrevenantt/antlr4rust

@timboudreau
Copy link
Author

Funny, I just wrote a post about that a few minutes before seeing this on the netbeans-dev mailing list. I have a better Antlr grammar than that one in the works - lexer modes are really useful for handling some of the more painful corners such as macro_rules!. Will likely share it on Github in the next couple of weeks.

Digging into this project led me off on somewhat of a tangent into building generic Antlr language support (a few annotations to generate all of the antlr-to-netbeans parser and lexer glue code: https://github.com/timboudreau/ANTLR4-Plugins-for-NetBeans and only circled back to Rust support specifically around the time I needed to get a job, so it's been slow going since then).

@Chris2011
Copy link

Great to hear :). Thx for your investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants