Bitwise»Episode Guide
Parameterized Macros
?
?

Keyboard Navigation

Global Keys

[, < / ], > Jump to previous / next episode
W, K, P / S, J, N Jump to previous / next marker
t / T Toggle theatre / SUPERtheatre mode
V Revert filter to original state Y Select link (requires manual Ctrl-c)

Menu toggling

q Quotes r References f Filter y Link c Credits

In-Menu Movement

a
w
s
d
h j k l


Quotes and References Menus

Enter Jump to timecode

Quotes, References and Credits Menus

o Open URL (in new tab)

Filter Menu

x, Space Toggle category and focus next
X, ShiftSpace Toggle category and focus previous
v Invert topics / media as per focus

Filter and Link Menus

z Toggle filter / linking mode

Credits Menu

Enter Open URL (in new tab)
0:08Recap and set the stage for the day with a mention of the bug fix from last stream
🗩
0:08Recap and set the stage for the day with a mention of the bug fix from last stream
🗩
0:08Recap and set the stage for the day with a mention of the bug fix from last stream
🗩
0:52Review our current macro expansion support, including the new '$' macro identifier
🗩
0:52Review our current macro expansion support, including the new '$' macro identifier
🗩
0:52Review our current macro expansion support, including the new '$' macro identifier
🗩
4:11Review the removal of anonymous labels
🗩
4:11Review the removal of anonymous labels
🗩
4:11Review the removal of anonymous labels
🗩
5:11Parameterized macros
🗩
5:11Parameterized macros
🗩
5:11Parameterized macros
🗩
8:02The plan for parameterized macros
🗩
8:02The plan for parameterized macros
🗩
8:02The plan for parameterized macros
🗩
12:02Implement multi-line macros, introducing cmd_macro() and cmd_endmacro()
12:02Implement multi-line macros, introducing cmd_macro() and cmd_endmacro()
12:02Implement multi-line macros, introducing cmd_macro() and cmd_endmacro()
15:42Add a multi-line macro test in asm_test() and fix cmd_macro() to skip the closing token
15:42Add a multi-line macro test in asm_test() and fix cmd_macro() to skip the closing token
15:42Add a multi-line macro test in asm_test() and fix cmd_macro() to skip the closing token
16:35Run it to see that it works
🏃
16:35Run it to see that it works
🏃
16:35Run it to see that it works
🏃
17:04Setup to implement parameterized macros, similar to Ion
🗩
17:04Setup to implement parameterized macros, similar to Ion
🗩
17:04Setup to implement parameterized macros, similar to Ion
🗩
18:35Dive into parameterized macros, augmenting the Assembler with local_syms for get_sym() to use
18:35Dive into parameterized macros, augmenting the Assembler with local_syms for get_sym() to use
18:35Dive into parameterized macros, augmenting the Assembler with local_syms for get_sym() to use
21:10Run it to see that nothing broke
🏃
21:10Run it to see that nothing broke
🏃
21:10Run it to see that nothing broke
🏃
21:26Introduce push_sym() to handle our macro parameters
21:26Introduce push_sym() to handle our macro parameters
21:26Introduce push_sym() to handle our macro parameters
26:25Run it to make sure it still works
🏃
26:25Run it to make sure it still works
🏃
26:25Run it to make sure it still works
🏃
26:34Augment Assembler with a temp_tokens array, and introduce parse_macro_param() to handle our macro parameters
26:34Augment Assembler with a temp_tokens array, and introduce parse_macro_param() to handle our macro parameters
26:34Augment Assembler with a temp_tokens array, and introduce parse_macro_param() to handle our macro parameters
35:08Enable pop_token_list() to pop our temp_tokens stack
35:08Enable pop_token_list() to pop our temp_tokens stack
35:08Enable pop_token_list() to pop our temp_tokens stack
38:53Run it and crash in get_sym()
🏃
38:53Run it and crash in get_sym()
🏃
38:53Run it and crash in get_sym()
🏃
39:07Make init_assembler() reset the local_syms and temp_tokens
39:07Make init_assembler() reset the local_syms and temp_tokens
39:07Make init_assembler() reset the local_syms and temp_tokens
39:28Run it to see that it works
🏃
39:28Run it to see that it works
🏃
39:28Run it to see that it works
🏃
39:44Enable cmd_macro() to handle newlines
39:44Enable cmd_macro() to handle newlines
39:44Enable cmd_macro() to handle newlines
43:52Run it to see that we didn't break anything
🏃
43:52Run it to see that we didn't break anything
🏃
43:52Run it to see that we didn't break anything
🏃
44:24Add a parameterized macro test in asm_test()
44:24Add a parameterized macro test in asm_test()
44:24Add a parameterized macro test in asm_test()
45:08Step in to next_token() to see how it handles our parameterized macro
🏃
45:08Step in to next_token() to see how it handles our parameterized macro
🏃
45:08Step in to next_token() to see how it handles our parameterized macro
🏃
46:11Fix next_token() to skip past the '$' token
46:11Fix next_token() to skip past the '$' token
46:11Fix next_token() to skip past the '$' token
47:29Run it to see that parse_macro_param() correctly parses a parameter
🏃
47:29Run it to see that parse_macro_param() correctly parses a parameter
🏃
47:29Run it to see that parse_macro_param() correctly parses a parameter
🏃
48:14Step through to the next macro, to see how $reg gets handled
🏃
48:14Step through to the next macro, to see how $reg gets handled
🏃
48:14Step through to the next macro, to see how $reg gets handled
🏃
49:21Rename the getchar macro in asm_test() to do_getchar
49:21Rename the getchar macro in asm_test() to do_getchar
49:21Rename the getchar macro in asm_test() to do_getchar
49:41Run it to see that it seems to work
🏃
49:41Run it to see that it seems to work
🏃
49:41Run it to see that it seems to work
🏃
50:04Torture test macro parameter pre-expansion
50:04Torture test macro parameter pre-expansion
50:04Torture test macro parameter pre-expansion
50:39Run it to see that it does work
🏃
50:39Run it to see that it does work
🏃
50:39Run it to see that it does work
🏃
50:42Continue the torture test of macro parameter expansion
50:42Continue the torture test of macro parameter expansion
50:42Continue the torture test of macro parameter expansion
52:04Run it to see that it works
🏃
52:04Run it to see that it works
🏃
52:04Run it to see that it works
🏃
52:24Test macro parameter scoping
52:24Test macro parameter scoping
52:24Test macro parameter scoping
52:41Run it and do not receive the expected error
🏃
52:41Run it and do not receive the expected error
🏃
52:41Run it and do not receive the expected error
🏃
52:53Augment the TokenList with saved_local_syms for next_token() to use and prevent parameters from leaking out of macros
52:53Augment the TokenList with saved_local_syms for next_token() to use and prevent parameters from leaking out of macros
52:53Augment the TokenList with saved_local_syms for next_token() to use and prevent parameters from leaking out of macros
54:34Run it to see that our scoped parameter was properly destroyed, as evidenced by a "No macro or macro parameter named 'arg1'" error
🏃
54:34Run it to see that our scoped parameter was properly destroyed, as evidenced by a "No macro or macro parameter named 'arg1'" error
🏃
54:34Run it to see that our scoped parameter was properly destroyed, as evidenced by a "No macro or macro parameter named 'arg1'" error
🏃
54:43Comment out our error-causing macro
54:43Comment out our error-causing macro
54:43Comment out our error-causing macro
54:48Run it to see that it works
🏃
54:48Run it to see that it works
🏃
54:48Run it to see that it works
🏃
54:56Test macro recursion
54:56Test macro recursion
54:56Test macro recursion
55:11Run it and hit a "Temp tokens stack overflow" error
🏃
55:11Run it and hit a "Temp tokens stack overflow" error
🏃
55:11Run it and hit a "Temp tokens stack overflow" error
🏃
55:44A few words on the utility of this infinite macro recursion
🗩
55:44A few words on the utility of this infinite macro recursion
🗩
55:44A few words on the utility of this infinite macro recursion
🗩
56:29Test macro argument shadowing
56:29Test macro argument shadowing
56:29Test macro argument shadowing
57:18Run it to see that the arguments were not outputted in the reverse order
🏃
57:18Run it to see that the arguments were not outputted in the reverse order
🏃
57:18Run it to see that the arguments were not outputted in the reverse order
🏃
59:10Step in to next_token() to see what it does with our shadowed arguments
🏃
59:10Step in to next_token() to see what it does with our shadowed arguments
🏃
59:10Step in to next_token() to see what it does with our shadowed arguments
🏃
1:05:12Fix next_token() to call parse_macro_param() and evaluate the macro parameters before establishing the binding
1:05:12Fix next_token() to call parse_macro_param() and evaluate the macro parameters before establishing the binding
1:05:12Fix next_token() to call parse_macro_param() and evaluate the macro parameters before establishing the binding
1:13:16Run it to see that it does the right thing
🏃
1:13:16Run it to see that it does the right thing
🏃
1:13:16Run it to see that it does the right thing
🏃
1:13:46Read back through next_token()
📖
1:13:46Read back through next_token()
📖
1:13:46Read back through next_token()
📖
1:14:26Make next_token() set saved_local_syms after all the parse_macro_arg() calls
1:14:26Make next_token() set saved_local_syms after all the parse_macro_arg() calls
1:14:26Make next_token() set saved_local_syms after all the parse_macro_arg() calls
1:15:13Run it to see that it's okay
🏃
1:15:13Run it to see that it's okay
🏃
1:15:13Run it to see that it's okay
🏃
1:15:39Q&A
🗩
1:15:39Q&A
🗩
1:15:39Q&A
🗩
1:16:09Consider the potential similarity of our assembler to lisp interpreters for symbolic languages
🗩
1:16:09Consider the potential similarity of our assembler to lisp interpreters for symbolic languages
🗩
1:16:09Consider the potential similarity of our assembler to lisp interpreters for symbolic languages
🗩
1:17:13That's pretty much it for parameterized macros, with a glimpse into the future of doing expression evaluation
🗩
1:17:13That's pretty much it for parameterized macros, with a glimpse into the future of doing expression evaluation
🗩
1:17:13That's pretty much it for parameterized macros, with a glimpse into the future of doing expression evaluation
🗩