[antlr-interest] Getting CMinus example to work

Mark van Assem mark at cs.vu.nl
Wed Nov 11 08:36:52 PST 2009


Hi,

The behaviour seems different now. I get the error:

   java.net.BindException: Address already in use: JVM_Bind

on the code below. Apparently there is some port setting I need to 
change, but DebugEventSocketProxy.DEFAULT_DEBUGGER_PORT is hidden in the 
jar file. I experimentally changed the port to 35505, but to no effect. 
There's no indication in the book that I need ANTLRworks or anything 
else to run on that port.

Anybody an idea?

Thanks,
Mark.

--------------------------------------------------------------------------
public CMinusParser(TokenStream input) {
             this(input, DebugEventSocketProxy.DEFAULT_DEBUGGER_PORT, 
new RecognizerSharedState());
         }
--------------------------------------------------------------------------

Mark van Assem wrote:
> Hi,
> 
> I'm trying to get the CMinus example from the ANTLR reference book to 
> work inside Eclipse (see [1,2]). I used ANTLRworks to generate java code 
> for the lexer/parser and the tree walker. (This is all to get an idea 
> about how to get my own grammar working.)
> 
> I imported the CMinusParser.java, CMinusLexer.java and CMinusWalker.java 
> into Eclipse, and added the class TestCMinus.java, a test rig given in 
> [3]. I run the code and enter the example input given in [4]. I then 
> press CTLR-D/CTRL-Z to end the input file as normal in Eclipse [5], but 
> the console does not react at all. I'm wondering whether there's a 
> problem with the example or not. I am able to signal EOF in other programs.
> 
> I  also tried to compile the generated .java files on the command line, 
> but failed:
> 
> javac -cp ./antlr-3.0.jar:./antlr-2.7.7.jar:./antlr-runtime-3.0.jar 
> TestCMinus.java
> 
> gets me errors like "package org.antlr.runtime.tree does not exist". I 
> tried the same thing with the antlrworks jar file, but that just starts 
> ANTLRworks instead of compiling.
> 
> I'm obviously doing something stupid, but I've run out of options to try 
> myself. Hope someone can help out this newbie...
> 
> Mark van Assem.
> 
> 
> [1]http://media.pragprog.com/titles/tpantlr/code/trees/CMinus/CMinus.g
> [2]http://media.pragprog.com/titles/tpantlr/code/trees/CMinus/CMinusWalker.g
> [3]http://media.pragprog.com/titles/tpantlr/code/trees/CMinus/TestCMinus.java
> [4]http://media.pragprog.com/titles/tpantlr/code/trees/CMinus/t.cm
> [5]http://archive.eclipse.org/eclipse/downloads/drops/R-3.1-200506271435/eclipse-news-part1c.html

-- 
  Mark van Assem - Vrije Universiteit Amsterdam
            http://www.cs.vu.nl/~mark


More information about the antlr-interest mailing list