Port action templates functionality to ANTLR5#51
Port action templates functionality to ANTLR5#51DavidGregory084 wants to merge 1 commit intoantlr:devfrom
Conversation
Signed-off-by: David Gregory <2992938+DavidGregory084@users.noreply.github.com>
|
Hey @ericvergnaud is there anything I can do to move things along here? |
|
Hi @DavidGregory084 n.b. plus, you may have noticed that |
|
@ericvergnaud I am very happy to help if I can although my free time is a bit unpredictable. |
This PR ports the action templates functionality from antlr/antlr4#4345 to ANTLR5.
This enables users to write cross-target grammars which make use of actions, by enabling users to provide action templates as StringTemplate
.stggroup files on the command line.By providing different action templates for each target language, users can provide a different implementation of the action logic for each target.
Java.stg:Javascript.stg:The example below is the motivating example for me - I have a grammar that I'd like to use in both a JVM-based compiler and a VS Code extension:
Example.g4: