Making a WebAssembly interpreter in Ruby, part 19: script & module abstract syntax

Making a WebAssembly interpreter in Ruby, part 19: script & module abstract syntax

https://github.com/tomstuart/wasminna... 00:00:00 — Waiting to start 00:01:13 — Hello 00:02:20 — Retro 00:07:31 — Parse function bodies during definition, not execution 00:21:01 — Support optional labels after `else`/`end` for structured instructions 00:35:19 — Make `(type …)` immediate argument optional for `call_indirect` 00:46:25 — Unfold instructions during instruction parsing, not up-front 01:10:05 — Return expression (i.e. array of instructions) from #parse_folded_instruction 01:27:09 — Only unfold folded instructions one level deep 01:34:27 — Remove unused fall-through clause in #unfold 01:37:27 — Support optional immediate arguments for the `call_indirect` instruction 02:04:22 — Read consequent and alternative from the body of the `if` instruction 02:05:43 — Support multiple terminators in #read_until 02:18:17 — Support optional `else` for the `if` instruction 02:18:37 — Rename ASTParser#parse_expression to #parse_instructions 02:33:49 — Rename ASTParser#parse to #parse_expression 02:36:38 — Wire up interpreter to ASTParser#parse_script 02:39:07 — Move Parameter, Local and Function into AST namespace 02:47:44 — Move Interpreter#define_function to ASTParser#parse_function 02:48:42 — Extract ASTParser#parse_memory from the interpreter 03:11:14 — Move Table into AST namespace 03:15:17 — Extract ASTParser#parse_table from the interpreter 03:17:44 — Use local variables instead of hash in ASTParser#parse_function 03:22:21 — Extract ASTParser#parse_global 03:32:36 — Extract ASTParser#parse_module 03:45:08 — Extract ASTParser#parse_invoke 03:52:16 — Extract ASTParser#parse_assert_return 04:07:12 — Extract ASTParser#parse_script 04:23:30 — Make all script-parsing methods (except #parse_script) private 04:24:57 — Rename Interpreter#interpret_script to #evaluate_script 04:26:58 — Rename Interpreter#evaluate to #evaluate_expression 04:28:14 — Set current S-expression with #with_input in ASTParser#parse_expression 04:32:49 — Stop returning enumerator from SExpressionParser#parse 04:43:29 — Destructively consume S-expression in #parse_script 04:47:53 — Extract ASTParser#parse_commands and #parse_command 04:54:31 — Destructively consume S-expression in #parse_module 05:02:03 — Destructively consume S-expression in #parse_invoke 05:09:07 — Move `terminated_by:` outside of #parse_instructions 05:19:22 — Make #read_until stop when #finished? 05:24:40 — Call #parse_instructions in #parse_invoke to use the current S-expression 05:27:53 — Destructively consume S-expression in #parse_assert_return 05:35:48 — Destructively consume S-expression in #parse_function 05:57:31 — Destructively consume S-expression in #parse_memory 06:12:23 — Destructively consume S-expression in #parse_table 06:15:31 — Destructively consume S-expression in #parse_global 06:20:06 — Wrapping up 06:22:56 — Bye