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

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

error: unexpected token get_local. (get_local $lhs)

问题

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

这是错误信息:

  1. add1.wat:3:5: 错误: 意外的标记 get_local,期望是)。
  2. get_local $lhs
  3. ^^^^^^^^^
  4. add1.wat:4:5: 错误: 意外的标记 get_local
  5. get_local $rhs
  6. 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.

  1. (module
  2. (func $add (param $lhs i32) (param $rhs i32) (result i32)
  3. get_local $lhs
  4. get_local $rhs
  5. i32.add)
  6. (export "add" (func $add))
  7. )

This is the error:

  1. add1.wat:3:5: error: unexpected token get_local, expected ).
  2. get_local $lhs
  3. ^^^^^^^^^
  4. add1.wat:4:5: error: unexpected token get_local.
  5. get_local $rhs
  6. 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:

  1. (module
  2. (func $add (param $lhs i32) (param $rhs i32) (result i32)
  3. (local.get $lhs)
  4. (local.get $rhs)
  5. (i32.add)
  6. )
  7. (export "add" (func $add))
  8. )
英文:

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

  1. (module
  2. (func $add (param $lhs i32) (param $rhs i32) (result i32)
  3. (local.get $lhs)
  4. (local.get $rhs)
  5. (i32.add)
  6. )
  7. (export "add" (func $add))
  8. )

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:

确定