Simple questions which I so far think the answer is no:
Is it possible to import grammars from a child directory? e.g.:
grammar literals;
import myFolder/IntegerLiterals;
with the following structure:
/
literals.g4
myFolder/
IntegerLiterals.g4
I had the same problem and found this site but got no solution. After some more googling I found a solution for this problem:
Actually there is now a way how to import grammars from other directories:
Use the -lib option when running antlr to define where your gramars are that you want to import. Here is the docu for the options: https://github.com/antlr/antlr4/blob/master/doc/tool-options.md
So you write your grammar:
grammar literals;
import IntegerLiterals;
Then you run in command line:
antlr4 -lib C:/.../myFolder literals.g4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With