0

我目前正在为应该编译到 java 虚拟机的给定语言编写编译器。

我目前正在让数组工作,并且我的语言中的以下代码遇到了以下问题

package foo
func main() {
    var i int[2];
    i[0] = 5;
}

目前它正在编译为

.class  public  test
.super  java/lang/Object
.method  public static  main([Ljava/lang/String;)V
ldc 2
newarray    int
astore  0
aload   0
ldc 0
ldc 5
iastore 0
return
.limit  locals  2    ;over estimate
.limit  stack  20    ;over estimate
.end    method

并引发以下错误

test.j:11: JAS Error Bad arguments for instruction iastore.
    r
     ^

现在根据https://cs.au.dk/~mis/dOvs/jvmspec/ref--20.html堆栈应该看起来像

|  value  |
|  index  | 
|array ref|
 _________

这是我所做的,所以我的问题是这个错误指的是什么?

4

0 回答 0