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

Use a more modern and optimized version of antlr4ts #25

Open
getlarge opened this issue Dec 14, 2023 · 2 comments · May be fixed by #26
Open

Use a more modern and optimized version of antlr4ts #25

getlarge opened this issue Dec 14, 2023 · 2 comments · May be fixed by #26

Comments

@getlarge
Copy link

Hey, thanks for the great lib, it gave me great hope in a NestJS project where i attempt to use Ory permissions.
Still i noticed some issues at runtime and they are related to antlr4ts, notably this one.
Since this lib is not maintained i looked for alternatives and found antlr4g which acts like a drop in replacement… except that is built and published as an ES module.
So it would involve producing an ESM lib as well…

@getlarge getlarge linked a pull request Dec 14, 2023 that will close this issue
@nidomiro
Copy link
Owner

Hey, you are welcome :) Sorry for responding late.
Thanks for your work and PR. It is really cool that you found a drop-in replacement 👍
Unfortunately I already started replacing antlr with an custom parser, which is several times faster for this simple syntax. You can see the result in #22 . Apparently I didn't merge it 🙈.
Maybe I find some time in the near future to finish the work and merge the changes made there.

@getlarge
Copy link
Author

Thanks for the reply.
Yes I get why you are going that path.
I started to work on a Regexp to parse tuple with a bit more flexibility (allow namespace | namespace:object | namespace:object#relation only) and the performance tests are quite surprising.

the result gives Regex winner apparently ... ;)

method elements time
antlr 100 w/ subject 12.93383ms
antlr 100 w/ subjectSet 12.521252ms
regex 100 w/ subject 0.318202ms
regex 100 w/ subjectSet 0.121128ms

I was not yet able to correctly isolate parentheses in subject segment so it's still WIP.

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

Successfully merging a pull request may close this issue.

2 participants