Target languages #17
Replies: 2 comments 2 replies
-
|
While I love Kotlin, I think that no-brainers list make a lot of sense, and I would aim to keep the list as small as possible initially, as I suspect there will be a ton of work to do to get ANTLR 5 out of the door, and more targets can be added later |
Beta Was this translation helpful? Give feedback.
-
|
EDIT: I guess this comment is a bit off-topic, so I moved it to its own discussion #31 Original comment: Please design ANTLR5 grammar files to be always necessarily language-agnosticI really dislike that in ANTLR4 you have to go out of your way to write target-agnostic grammars in the first place. That's not right. Please, for ANTLR5, just force all grammar files to be target-agnostic and design the ANTLR language around that. Instead of allowing arbitrary code e.g. in actions and predicates, allow just function/method calls (using ANTLR syntax) and force all actual code implementation to be in a separate, target language file. myRule: {this.myPredicate();}? MY_TOKEN {this.myAction();} ;Please design ANTLR5 so we could do e.g.: myRule: $myPredicate()? MY_TOKEN $myAction() ;It's of course a simplistic example, but you get the idea. ANTLR5 should recognize If there's any other code (e.g. include headers, etc) that need to be in the target language, force them to be in separate files of that target language as well, even if it has to be like a "snippet" mini-file if you get what I mean. Btw, should I turn this comment into an issue or separate discussion topic? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Antlr4 officially supports:
There are also unofficial targets:
We are regularly being asked to support more languages (ruby, groovy ...), and we regularly decline, because we are already experiencing difficulties at maintaining the official targets.
Language targets are embedded in the tool, and that forces targets to either be supported by the antlr team, or for the target developer to fork and maintain their own version of the tool.
One of the business goals of antlr5 is to actually eliminate this problem altogether, by moving language targets out of the tool, in the form of add-ons. The expectation is that the tool and runtime will soon reach stability, while target developers can create targets at their own pace. With WebAssembly for the core runtime end the generated parsers, the responsibility of a target becomes much smaller i.e. generate the visitor, the listener and the parser and lexer wrappers.
That being said, it would make no sense to release antlr5 without any target. This discussion is about which targets we would provide as part of the initial official release.
In other words, which targets does the antlr5 team want to officially support ?
The no-brainers are typescript, java, C# and python.
The probable victims are dart and php.
But what about swift, go and c++ ?
Beta Was this translation helpful? Give feedback.
All reactions