Web Assembly WAT Reference
You will find all the instructions used in the WAT programming language.
| Instruction |
Description |
| (local...) |
Create a local variable. |
| local.get |
Push a local variable onto the stack. |
| local.set |
Pop a value off the stack and set a local variable. |
| local.tee |
Pop a value off the stack and set a local variable, but keeps the value on the stack. |
| (global...) |
Create a global variable. |
| global.get |
Push a global variable onto the stack. |
| global.set |
Pop a value off the stack and set a global variable. |
| Instruction |
Description |
| (module...) |
Create the WASM module. |
| (func...) |
Create a function. |
| call |
Call a function. |
| (param...) |
Declare a parameter to a code block. |
| (result...) |
Declare a result to be returned for a code block. |
| return |
Return out of a function. |
| (if...) |
Create an if...then...else block. |
| (loop...) |
Create a looping code block. |
| (block...) |
Create a code block you can exit. |
| br |
Branch to the top of a loop or the bottom or a block. |
| br_if |
Branch if a condition was met. |
| br_table |
Branch a list of code blocks. |
| Instruction |
Description |
| (table...) |
Create the a table of function references. |
| table.get |
Get a reference to a function from a table. |
| table.set |
Set a reference to a function into a table. |
| table.size |
Gets number of elements in a table. |
| table.grow |
Increase the number of elements a table contains. |
| table.fill |
Fill a table with the a set value. |
| table.copy |
Copy functions references from one table to another. |
| table.init |
Copy functions references from data into a table. |
| (type...) |
Declares what parameters and result data types a function uses. |
| call_indirect |
Declare a table's function references. |
| (element...) |
Declare a collection of function references. |
| elem.drop |
Remove a passive element data block from memory. |
| ref.null |
Push a NULL reference for a function onto the stack. |
| ref.is_null |
Check to see if a reference to a function is NULL or not. |
| ref.func |
Push a reference to a function onto the stack. |
| Instruction |
Description |
| (memory...) |
Create the a memory area. |
| memory.size |
Gets size (number of pages) the memory currently has. |
| memory.grow |
Increase the size of the memory (in pages). |
| memory.fill |
Fill an area of memory with a set value. |
| memory.copy |
Copy one area of memory to another. |
| memory.init |
Copy passive data into memory. |
| (data...) |
Declare a block of constant data that can be copied into memory. |
| data.drop |
Remove a passive data block from memory. |
| Instruction |
Description |
| (start...) |
Set which function to call when the WASM module starts up. |
| nop |
Do nothing. |
| unreachable |
Declare an area in code that should be unreachable and throw an exception if reached. |
| drop |
Pop a value off the stack and do nothing with it. |
| select |
Select between two items depending on a condition. |