You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's no point in dragging a dependency like antlr into a project. It's easier to write a regular recursive parser or a Pratt parser. Not only will the project get rid of an obviously unnecessary dependency, but such code will also be very easy to read and write.
There're two reasons why I think it's better to stick with current solution:
It's declarative to have grammar file as source of true for parsing;
Language is not yet stable including it's syntax and parser-generators allow to move faster at MVP stage.
I agree though that manual parser allows to get rid of dependency and perhaps improve performance (it's good to have some parser benchmarks first, perhaps)
It's not just about performance, but also about maintainability. While a formalized grammar can be useful in many places (for example, for plugins in popular editors like IntelliJ IDEA), editing a regular recursive parser is still easier.
You mentioned that the language's syntax is unstable, which means that describing complex syntactic constructs will be a real pain in the ass in the future, so it's better to take care of this in advance. For IDE, we can describe a regular BNF grammar.
It's not just about performance, but also about maintainability. While a formalized grammar can be useful in many places (...), editing a regular recursive parser is still easier.
Easier how?
Grammar is not longer source of true -> you have to manually keep it in sync with the parser source code -> it's possible to get them out of sync (not possible at the moment)
You change grammar -> make antlr -> update listener/visitor (you even get compile errors after codegen)
language's syntax is unstable, which means that describing complex syntactic constructs will be a real pain in the ass in the future, so it's better to take care of this in advance
Yes and to me it's the reason to have declarative grammar!
Not directly answers your message but related to the topic.
I don't honestly think Neva syntax will get more complicated than now, I'm actually thinking about removing existing features (see #935 in case of curiousity)
Activity
emil14 commentedon Nov 13, 2025
@k1ngmang
There're two reasons why I think it's better to stick with current solution:
I agree though that manual parser allows to get rid of dependency and perhaps improve performance (it's good to have some parser benchmarks first, perhaps)
k1ngmang commentedon Nov 13, 2025
@emil14
It's not just about performance, but also about maintainability. While a formalized grammar can be useful in many places (for example, for plugins in popular editors like IntelliJ IDEA), editing a regular recursive parser is still easier.
You mentioned that the language's syntax is unstable, which means that describing complex syntactic constructs will be a real pain in the ass in the future, so it's better to take care of this in advance. For IDE, we can describe a regular BNF grammar.
emil14 commentedon Nov 13, 2025
Easier how?
make antlr-> update listener/visitor (you even get compile errors after codegen)Yes and to me it's the reason to have declarative grammar!
Not directly answers your message but related to the topic.
I don't honestly think Neva syntax will get more complicated than now, I'm actually thinking about removing existing features (see #935 in case of curiousity)