“error: 意外的令牌 get_local. (get_local $lhs)”

huangapple go评论53阅读模式
英文:

error: unexpected token get_local. (get_local $lhs)

问题

当我尝试在一个简单的示例中使用"wat2wasm file.wat"命令时,它会给我一个错误。

这是错误信息:

add1.wat:3:5: 错误: 意外的标记 get_local,期望是)。
    get_local $lhs
    ^^^^^^^^^
add1.wat:4:5: 错误: 意外的标记 get_local。
    get_local $rhs

wat2wasm add.wat 命令应该能够成功运行。请使用其中一个wabt工具生成一个wasm模块。
英文:

when I try to use the wat2wasm file.wat command into a simple example like this, it gives me error.

(module
(func $add (param $lhs i32) (param $rhs i32) (result i32)
get_local $lhs
get_local $rhs
i32.add)
(export "add" (func $add))
)

This is the error:

add1.wat:3:5: error: unexpected token get_local, expected ).
    get_local $lhs
    ^^^^^^^^^
add1.wat:4:5: error: unexpected token get_local.
    get_local $rhs

wat2wasm add.wat cmd should run successfully. use one of the wabt tools to generate a wasm module from it

答案1

得分: 0

get_local token statement line has to be inside a separate parenthesis, like this:

(module
  (func $add (param $lhs i32) (param $rhs i32) (result i32)
    (local.get $lhs)
    (local.get $rhs)
    (i32.add)
  )
  (export "add" (func $add))
)
英文:

get_local token statement line has to be inside a separate parenthesis, like this:

(module
  (func $add (param $lhs i32) (param $rhs i32) (result i32)
    (local.get $lhs)
    (local.get $rhs)
    (i32.add)
  )
  (export "add" (func $add))
)

huangapple
  • 本文由 发表于 2023年6月6日 15:24:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/76412284.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定