[video member=pervognsen stream_platform=twitch project=bitwise medium=research title="Ion Parser/AST Code Review" vod_platform=youtube id=YvoyKQYNy20 annotator=Miblo] [0:08][Recap and set the stage for the day][:speech] [3:17][Review the work done in Day 4 Extra[ref site=Bitwise page="Ion Grammar & AST (Extra)" url=https://bitwise.handmade.network/episode/bitwise/bitwise004_2/] with an explanation of tagged and discriminated unions][:"data structure"] [16:06][Review the AST printing][:"data structure"] [20:02][:Run the program to see our AST printout][:"data structure"] [23:14][Review the work on the EBNF grammar][:language :parsing] [34:06][Note that parse_expr_base() parses function calls and arrays similarly to a left-associativity binary operator][:parsing] [38:12][Note how Ion distinguishes between expressions and type-specifiers][:language :parsing] [42:25][Describe types in Ion][:language :parsing] [46:08][Review statement :parsing, with a description of the linear :memory arena usage] [54:49][Review changes to the existing code, including the introduction of is_keyword_str()][:parsing] [57:31][Review changes to the string interning][:parsing] [58:34][Describe the :memory arenas and alignment macros in detail] [1:05:39][Q&A][:speech] [1:06:37][@nothings2][Arenas also make frees fast because it doesn't have to free each individual allocation (which also means you don't have to keep track of them and worry about leaks)][:memory] [1:06:58][A few words on doing small-scale allocations with malloc(), structuring your code such that later replacement of the :memory allocator will be easy][:speech] [1:10:22][@jakejscott][@pervognsen What is ast_dup?][:"data structure" :memory] [1:10:59][@nothings2][@pervognsen Does your parser / grammar actually handle the sizeof(\:type) case? If I'm not mistaken you're requiring compound literal "{ ... }" after seeing (\:type)][:parsing] [1:11:12][Implement support for sizeof][:parsing :programming] [1:17:10][:Run it to see that that worked][:parsing] [1:17:16][Add another sizeof test in parse_test()][:parsing] [1:17:44][:Run it to see that that works too][:parsing] [1:18:04][@croepha][@pervognsen For the trick that you are using to tell if the string is a keyword by range-testing the pointer value, are you relying on them being in the same arena block? If you were doing something a bit bigger would there be danger of the other block not having a greater pointer value?][:memory] [1:20:00][Commit "Code from stream day 5"][:admin] [1:20:52][@iain][There's an occasional audio glitch that you can fix by updating OBS to 21.1] [1:21:02][@captainkraft][@pervognsen Did you learn this from books and experimenting on your own?] [1:24:20][@captainkraft][@pervognsen Is there something that you feel you've become exceptional at in the realm of programming?] [1:25:32][@zjbxiii][Have you ever developed an operating system?] [1:27:23][@cr88192][I think I saw designated initializers used; so MSVC / VS supports them now?][:language] [1:28:29][@twicetimes][Only thing it's lacking now from C99 is VLAs, I think][:language] [1:29:14][@captainkraft][Does Clang have any issues with C99?][:language] [1:30:26][@faranwath_][@pervognsen I think the value of MUL_ASSIGN is the same as ADD_ASSIGN in the array you showed before][:parsing] [1:30:37][Fix the TOKEN_MUL_ASSIGN in token_kind_names\[\]][:parsing :programming] [1:30:49][@captainkraft][Thanks Per. This project has been a blast so far] [1:32:00][Stop streaming][:speech] [/video]