1

I am reading the programming for the Java Virtual Machine by Joshua Engel, and I tried typing in one of the examples in the book. I understand that the book uses Oolong, and I am using Jasmin, however for such a simple example, and because the syntax of Oolong and Jasmin are so similar, I don't see why this doesn't work. As a side note, I haven't been able to find anything about the difference in syntax between Oolong and Jasmin. Could anyone point me towards a resource like this?

Here's the code, exactly as it is in the book:

.class Test
.method static run()I
    bipush 9
    bipush 6
    imul

    ireturn
.end method

And when I run Jasmin on this, I get the following errors:

Test.j:2: Warning - Syntax error.
.method
        ^
Test.j:2: Error - Couldn't repair and continue parse.
.method 
        ^

So what is it that I'm doing wrong?

Blake F.
  • 153
  • 13

1 Answers1

2

Jasmin requires .super keyword after .class.

The following code should compile fine:

.class Test
.super java/lang/Object
.method static run()I
    bipush 9
    bipush 6
    imul

    ireturn
.end method
apangin
  • 92,924
  • 10
  • 193
  • 247