cinera_handmade.network/pervognsen/bitwise/bitwise/bitwise004_1.hmml

81 lines
6.0 KiB
Plaintext

[video member=pervognsen stream_platform=twitch project=bitwise title="Ion Grammar & AST" vod_platform=youtube id=bM_JOa-dadY annotator=Miblo]
[0:09][Recap and set the stage for the day with some :admin stuff[ref
site=Bitwise
page=Forums
url=https://bitwise.handmade.network/forums][ref
site=Bitwise
page="Bitwise videos on Resilio Sync"
url=https://bitwise.handmade.network/forums/t/2999-bitwise_videos_on_resilio_sync] including a tease of the annotated episode guide]
[2:44][Summarise off-stream work][:memory :research]
[4:33][Safe overflow checking][:memory :speech]
[6:41][Continue to summarise off-stream work, including the addition of buf_end()][:memory :research]
[10:11][Plan for the day, doing the Ion lexer :parsing][:speech]
[12:13][Remove all the parse_expr() functions][:parsing]
[13:13][Create syntax.txt and spec out Ion's syntax][:language :parsing]
[23:31][Note the need to handle two-character tokens][:language :parsing :speech]
[25:06][Enable next_token() to check for integer literal overflows, and introduce syntax_error()][:parsing]
[28:02][Step through lex_test() to see that it worked][:parsing :run]
[28:11][Add an integer literal overflow test in lex_test()][:parsing]
[28:22][Successfully hit our integer literal overflow][:parsing :run]
[28:44][Change val to int_val of type uint64_t in the Token struct and change lex_test() to test overflowing this][:parsing]
[32:00][Successfully overflow our integer][:parsing :run]
[32:10][Introduce scan_int() to do the integer-based work from next_token(), and enable it to handle hexadecimal numbers][:parsing]
[39:21][Step through lex_test() and see what scan_int() produces][:parsing :run]
[39:54][Enable scan_int() to iterate through the character stream to the null terminator][:parsing]
[41:26][Step through scan_int() to see that it works][:parsing :run]
[42:16][Enable lex_test() to check for UINT64_MAX in hex, and next_token() to handle whitespace][:parsing]
[45:01][Step through lex_test to see that it works][:parsing :run]
[45:09][Add a hex overflow test in lex_test()][:parsing]
[45:55][Step through lex_test() and successfully hit our overflow error][:parsing :run]
[46:37][Enable scan_int() to handle octal numbers, and next_token() to correctly start a new token after skipping whitespace][:parsing]
[50:55][Step in to next_token() to see that octal works][:parsing :run]
[51:14][Enable scan_int() to handle binary numbers][:parsing]
[52:30][Step through lex_test() to see that all our integer parsing works][:parsing :run]
[53:05][Spec out Ion's float syntax based on that of C[ref
site=cppreference.com
page="strtof, strtod, strtold"
url=http://en.cppreference.com/w/c/string/byte/strtof]][:parsing]
[56:43][Enable next_token() to establish the number prefix to pass to scan_int(), in preparation for :parsing floats]
[1:01:56][Introduce scan_float()][:parsing]
[1:06:22][Step in to next_token() to see what it does][:parsing :run]
[1:07:01][Fix next_token() to position the stream at token.start rather than bookmark][:parsing]
[1:07:12][Step through scan_int()][:parsing :run]
[1:07:36][Make next_token() break][:parsing]
[1:07:42][Step through lex_test() to see that it works][:parsing :run]
[1:07:49][Introduce float literal tests in lex_test(), including assert_token_float()][:parsing]
[1:08:33][Step through lex_test to see that float literal testing works][:parsing :run]
[1:08:40][Introduce more float tests in lex_test()][:parsing]
[1:09:15][:Run it to see that it works][:parsing]
[1:09:18][Add an exponent test in lex_test() and enable next_token() and scan_float() to handle the 'e' character[ref
site=cppreference.com
page="strtof, strtod, strtold"
url=http://en.cppreference.com/w/c/string/byte/strtof]][:parsing]
[1:11:28][See that it works, and consider this number :parsing complete enough for now][:run]
[1:12:11][Enable next_token() to handle '\\' and '"' and introduce a TokenMod enum for next_token(), scan_int() and scan_float() to use][:parsing]
[1:16:39][Step through lex_test() to see that we pass][:parsing :run]
[1:17:04][Implement scan_char() and add char literal tests in lex_test()][:parsing]
[1:22:08][Find that these tests work][:parsing :run]
[1:22:15][Add a '\\n' test in lex_test()][:parsing]
[1:22:26][Find that this doesn't work and investigate why][:parsing :run]
[1:22:55][Escape the \\ in lex_test()][:parsing]
[1:23:03][Try again to see that it works][:parsing :run]
[1:23:07][Add a test for '\\x' in lex_test()][:parsing]
[1:23:11][Correctly hit our error about \\x not being supported][:parsing :run]
[1:23:31][Implement scan_str(), adding a *str_val to the Token struct and string literal tests in lex_test(), and introducing assert_token_str()][:parsing]
[1:32:05][Find that that works][:parsing :run]
[1:32:09][Add tests for \\-escapes in lex_test()][:parsing]
[1:32:42][Find that that all works][:parsing :run]
[1:32:59][Q&A][:speech]
[1:33:52][@miotatsu][@pervognsen Are you going to handle a standalone 0 as a decimal integer literal?][:parsing]
[1:34:19][@garretttypes][The funny thing about recursive descent (especially with bookmarks like Per is using) is that it's not actually LL(1)][:parsing]
[1:35:27][@enemymouse][Did he fix the hex table uppercase 'E'?]
[1:35:33][Fix typo in char_to_digit][:parsing]
[1:35:41][@pmttavara][Yeah yeah, technically 0 is an octal literal, we get it]
[1:35:45][@davechat][@pervognsen Do you think Ion will support multiline strings or would that be too much a deviation from C?][:language]
[1:37:05][@oaeui][He mentioned before that some things wouldn't actually be LL(1), but he definitely wants to avoid unbounded lookahead][:parsing]
[1:37:39][@orcnz29][@pervognsen For the second compiler pass, how will you resolve the declarations in an order-independent way? Will you register them on the first pass or is there another technique to achieve this?][:parsing]
[1:39:24][@c__jm][@pervognsen It's quite a bit simpler than I thought as well. I think people blow systems-level problems up to be much scarier than they are]
[1:41:11][Integer vs float scan-ahead][:parsing :speech]
[1:42:33][Stop the stream for now][:speech]
[/video]