Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TreeViewer package not working in ANTLR v4 w/ Java [closed]

I am trying to display a GUI of a tree I have parsed in from a pascal program using ANTLR v4. I have used this import to get access to the TV package: import org.antlr.v4.runtime.tree.gui.TreeViewer;

However whenever I try to compile my java program using ANTLR is says that the package org.antlr.v4.runtime.tree.gui. doesn't exist and that it cannot find the symbol for TreeViewer.

Any ideas on why it might be doing this and am I missing something from my imports? I am defining this TreeViewer in java with:

TreeViewer viewr = new TreeViewer(Arrays.asList(
                        parser.getRuleNames()), tree);
like image 377
broliverparker Avatar asked Oct 24 '25 12:10

broliverparker


1 Answers

Running a grammar requires antlr4-runtime package

using maven :

<dependency>
   <groupId>org.antlr</groupId>
   <artifactId>antlr4-runtime</artifactId>
   <version>4.7</version>
</dependency>

Gui tools like TreeViewer requires antlr4 package

using maven :

<dependency>
   <groupId>org.antlr</groupId>
   <artifactId>antlr4</artifactId>
   <version>4.7</version>
</dependency>
like image 91
Alice Oualouest Avatar answered Oct 26 '25 02:10

Alice Oualouest



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!