Antlr4: "grun Hello r -gui" doesn't show up any dialog box and error

Created on 24 Mar 2015  Â·  18Comments  Â·  Source: antlr/antlr4

I have done git clone https://github.com/antlr/antlr4
And run python script "./bild all" to build the antlr-4.5-complete.jar file
And followed the below steps and example everything worked fine but at last step “grun Hello r –gui” it doesn’t show up dialog and any error after providing the input to it and ctrl+d

please guide me already wasted couple of days to resolve this.

UNIX

  1. Install Java (version 1.6 or higher)
  2. Download
    ?
    $ cd /usr/local/lib
    $ curl -O http://www.antlr.org/download/antlr-4.5-complete.jar
    Or just download in browser from website:
    http://www.antlr.org/download.html
    and put it somewhere rational like /usr/local/lib.
  3. Add antlr-4.5-complete.jar to your CLASSPATH:
    ?
    $ export CLASSPATH=".:/usr/local/lib/antlr-4.5-complete.jar:$CLASSPATH"
    It's also a good idea to put this in your .bash_profile or whatever your startup script is.
  4. Create aliases for the ANTLR Tool, and TestRig.
    ?
    $ alias antlr4='java -Xmx500M -cp "/usr/local/lib/antlr-4.5-complete.jar:$CLASSPATH" org.antlr.v4.Tool'
    $ alias grun='java org.antlr.v4.runtime.misc.TestRig'
    Testing the installation
    Either launch org.antlr.v4.Tool directly:
    ?
    $ java org.antlr.v4.Tool
    ANTLR Parser Generator Version 4.5
    -o ___ specify output directory where all output is generated
    -lib ___ specify location of .tokens files
    ...
    or use -jar option on java:
    ?
    $ java -jar /usr/local/lib/antlr-4.5-complete.jar
    ANTLR Parser Generator Version 4.5
    -o ___ specify output directory where all output is generated
    -lib ___ specify location of .tokens files
    ...
    A First Example
    In a temporary directory, put the following grammar inside file Hello.g4:
    Hello.g4
    ?
    // Define a grammar called Hello
    grammar Hello;
    r : 'hello' ID ; // match keyword hello followed by an identifier
    ID : [a-z]+ ; // match lower-case identifiers
    WS : [ trn]+ -> skip ; // skip spaces, tabs, newlines
    Then run ANTLR the tool on it:
    ?
    $ cd /tmp
    $ antlr4 Hello.g4
    $ javac Hello*.java
    Now test it:
    ?
    $ grun Hello r -tree
    hello parrt
    ^D
    (r hello parrt)
    (That ^D means EOF on unix; it's ^Z in Windows.) The -tree option prints the parse tree in LISP notation.
    It's nicer to look at parse trees visually.
    ?
    $ grun Hello r -gui
    hello parrt
    ^D
    That pops up a dialog box showing that rule r matched keyword hello followed by identifier parrt.
cannot-reproduce invalid

Most helpful comment

have you tried giving it some input? ;)

All 18 comments

which error? also, don't build it. just download it.

the command grun Hello r -gui doesn't show up dialog box for abstract tree structure and no errors its shows up.

let me know how to compile, build and test after downloading the antlr code from git repo. As am using ./bild.py all script to build the jars and then I added antlr-4.5-complete.jar file to classpath.

First try downloading the pre-built version - see if it makes any
difference.

Jim

On Wed, Mar 25, 2015 at 12:23 PM, ngundu [email protected] wrote:

the command grun Hello r -gui doesn't show up dialog box for abstract
tree structure and no errors its shows up.

let me know how to compile, build and test after downloading the code from
git repo.

—
Reply to this email directly or view it on GitHub
https://github.com/antlr/antlr4/issues/844#issuecomment-85827917.

yeah Jim I first tried with downloaded antlr-4.5-complete.jar file where faced same issue no dialog and no errors it showsup. please guide me steps to work with antlr4.

What operating system is this?

On Wed, Mar 25, 2015 at 12:51 PM, ngundu [email protected] wrote:

yeah Jim I first tried with downloaded antlr-4.5-complete.jar file where
faced same issue no dialog and no errors it showsup. please guide me steps
to work with antlr4.

—
Reply to this email directly or view it on GitHub
https://github.com/antlr/antlr4/issues/844#issuecomment-85831332.

using unix env.

OK - so I presume that you are running this from an xterm, or equivalent.
Do you have your screen/display configured? If you try to start another GUI
from the command line, does that work OK? I seem to recall someone
mentioning on the list that the gui option does not always work because it
does not use the 'right' sort of panel - but first verify that if you start
something else from the same command line, that it pops up the gui
interface.

Jim

On Wed, Mar 25, 2015 at 1:49 PM, ngundu [email protected] wrote:

using unix env.

—
Reply to this email directly or view it on GitHub
https://github.com/antlr/antlr4/issues/844#issuecomment-85859101.

appreciate your kindness to help... okay I didn't configure screen/display for my Linux box. and also please list me steps to compile, build and test antlr code after checking out antlr code from git repo.

Hello

I can reproduce the issue!

I've installed antlr using homebrew (package manager) on Mac OS X 10.11.6
I created the Hello example and compiled it.
When I execute grun without any options it results in:

antlr$ grun
java org.antlr.v4.gui.TestRig GrammarName startRuleName
  [-tokens] [-tree] [-gui] [-ps file.ps] [-encoding encodingname]
  [-trace] [-diagnostics] [-SLL]
  [input-filename(s)]
Use startRuleName='tokens' if GrammarName is a lever grammar.

But trying it on the Hello example simply results in no output at all:

antlr$ grun Hello -r -tree

Any idea?

have you tried giving it some input? ;)

Gosh! I assumed it would show me the some tree of the grammar. It works (with input). :-) Thanks for the feedback!

Am 02.01.2017 um 22:38 schrieb Terence Parr notifications@github.com:

have you tried giving it some input? ;)

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/antlr/antlr4/issues/844#issuecomment-270022998, or mute the thread https://github.com/notifications/unsubscribe-auth/AJX-fjlUSPUX8-eK93QQKYLFfE9vZKUnks5rOW5PgaJpZM4Dzw6h.

a grammar has not tree w/o input. a grammar is the set of rules governing all possible parse trees.

This has good logic, but it did not occur to me after all kind of setup issues. I simply expected more of this kind. Now I can focus on using and learning antlr/grammar…

Am 05.01.2017 um 19:41 schrieb Terence Parr notifications@github.com:

a grammar has not tree w/o input. a grammar is the set of rules governing all possible parse trees.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/antlr/antlr4/issues/844#issuecomment-270721996, or mute the thread https://github.com/notifications/unsubscribe-auth/AJX-ft2lfqGAWG4pt4VnWJRwbLm9QLmMks5rPTlugaJpZM4Dzw6h.

i am having a similar issue where the gui is not showing up. Followed the setup instructions here
https://github.com/antlr/antlr4/blob/master/doc/getting-started.md
Here is what i am trying out

$ grun Hello r -gui --diagnostics
hello world

This is my folder structure

$ ls
Hello.g4            HelloBaseListener.java      HelloLexer.tokens       HelloParser.class
Hello.interp            HelloLexer.class        HelloListener.class     HelloParser.java
Hello.tokens            HelloLexer.interp       HelloListener.java
HelloBaseListener.class     HelloLexer.java         HelloParser$RContext.class

This is the version of OS i am using Mac OS 10.13.6
Am I doing something wrong here ? Can anyone help

Hi Chandra

did you see Terence response?
"a grammar has not tree w/o input. a grammar is the set of rules governing all possible parse trees."

You need to feed it actual input for parsing.

Regards
Kurt

Am 25.11.2018 um 20:55 schrieb Chandra sekhar notifications@github.com:

i am having a similar issue where the gui is not showing up. Here is what i am trying out

$ grun Hello r -gui --diagnostics
hello world

$ ls
Hello.g4 HelloBaseListener.java HelloLexer.tokens HelloParser.class
Hello.interp HelloLexer.class HelloListener.class HelloParser.java
Hello.tokens HelloLexer.interp HelloListener.java
HelloBaseListener.class HelloLexer.java HelloParser$RContext.class
This is the version of OS i am using Mac OS 10.13.6

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@killwas thanks for your response, just looked at it more closely and realized that i did given it some input but did not add Ctrl + D after new line, its working now.

Can someone help me? I am with same issue but any of the solutions worked.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fvictorio picture fvictorio  Â·  12Comments

parrt picture parrt  Â·  32Comments

parrt picture parrt  Â·  27Comments

Usnul picture Usnul  Â·  14Comments

lionelplessis picture lionelplessis  Â·  21Comments