Making a WebAssembly interpreter in Ruby, part 20: type definitions and parser refactoring

preview_player
Показать описание

00:00:00 — Waiting to start
00:00:42 — Hello
00:02:02 — Retro
00:08:02 — Implement Memory#grow_by to increase the size of the memory
00:49:42 — Parse type uses in function definitions
01:09:15 — Store empty type definition table on module AST node
01:10:40 — Create type definitions during parsing
01:28:44 — Store the current module’s type definitions in the interpreter state
01:45:18 — During function invocation, dereference type index if present
01:55:01 — Extract #get_parameter_names helper
01:57:42 — Add block comment support to S-expression parser
02:23:28 — Treat tabs and carriage returns as whitespace in S-expression parser
02:48:35 — Rename ASTParser#with_input to #read_list
02:54:36 — Make `read` the default argument of ASTPaser#read_list
03:04:16 — Remove #read_list argument when it’s just `read`
03:05:00 — Check that #read_list is being called with a list
03:10:10 — Get rid of misleading `begin`/`ensure`/`end` block in #read_list
03:12:13 — Check that #read_list consumes its entire list
03:20:55 — Get rid of Script AST node
03:27:55 — Extract ASTParser#repeatedly helper
03:51:02 — Call #read or #peek directly in a `case` where possible
04:07:37 — Make #read_until’s `terminated_by:` a position argument
04:10:15 — Add support for optional `until:` argument in #repeatedly
04:19:23 — Use #repeatedly in #read_until
04:30:48 — Bind local variables after reading, not peeking, in #parse_assert_return
04:31:07 — Use #concat in #parse_type to add more parameters
04:36:14 — Unconditionally read opcode in #parse_function once we know it’s special
04:40:04 — Assign `string` outside of #read_list block in #parse_memory
04:42:49 — Inline read in #parse_folded_instruction
04:49:28 — Use #repeatedly to read `br_table` indexes
04:57:39 — Move `table_index` assignment out of conditional in #parse_normal_instruction
05:01:23 — Use #read_list instead of matching list patterns
05:06:21 — Read body S-expression first in #parse_structured_instruction
05:11:24 — Move all body-parsing code inside a single #read_list block
05:17:16 — Inline `read` in #read_until
05:21:13 — Don’t discard terminator in #read_until and #repeatedly
05:30:16 — Push opcode read inside parse methods
05:41:36 — Extract #can_read_list? helper
05:47:57 — Add `starting_with:` argument to #can_read_list?
05:53:30 — Convert #read_list positional argument to `from:` keyword
05:57:57 — Add `starting_with:` to #read_list
06:04:50 — Use #tap in #read_list
06:05:59 — Read atoms one at a time in #parse_assert_return
06:15:32 — Read the whole rest of the function body when we can
06:20:11 — Only read lists from function body when we know they’re part of its signature
06:29:59 — Wrapping up
06:33:25 — Bye
Рекомендации по теме
visit shbcf.ru