teaching machines

CS 330 Homework 3 – JSONograph

See the PDF.

Comments

  1. Adam King says:

    I’ve been using Eclipse to compile and test my code as I go, which works great. However, when I try to run it on the thingies, I get a ClassCastException error:

    Exception in thread “main” java.lang.ClassCastException: class Interpreter
    at java.lang.Class.asSubclass(Class.java:3046)
    at org.antlr.v4.runtime.misc.TestRig.process(TestRig.java:157)
    at org.antlr.v4.runtime.misc.TestRig.main(TestRig.java:142)

    I’ve commented out everything in my main method so I only have the class declaration extending JSONographBaseListener and the main method throwing an IOException. All I could find on the web on this subject were a few scatterings about duplicate classes (which I don’t believe I have) or issues with the grammar (needing carots in some regex areas?).

    1. Chris Johnson says:

      If you experience this on the thingies but not in Eclipse, I’m guessing the problem is in your configuration. In Eclipse, you added the JAR to your build path. Did you do the equivalent thing on the thingies?

      The equivalent thing is to include the JAR file in the Java build path. This can be done per command-line:

      $ javac -cp ~/w330/jsonograph/antlr-4.0-complete.jar:. MyClass.java

      Or once, in an environment variable in .bashrc or .zshrc:

      export CLASSPATH="$HOME/w330/jsonograph/antlr-4.0-complete.jar:."

      1. Adam King says:

        My misunderstanding; I was using grun to test it in Linux after compiling. It runs the same as Eclipse using java instead of grun.

  2. Mike Wengelski says:

    In the 7th specification, should fragment HEX be a..z or a..f?

    1. Chris Johnson says:

      It depends on whether you want to be right or to follow the specification.

Leave a Reply

Your email address will not be published. Required fields are marked *