[video member=pervognsen stream_platform=twitch project=bitwise title="Compiler Hacking" vod_platform=youtube id=N4lPlDWHkRI annotator=Miblo]
[0:07][Recap and set the stage for the day cleaning our palate with compiler features][:speech]
[1:00][Determine to implement "using"-style namespacing for packages][:language :parsing :speech]
[5:09][Introduce a SYM_PACKAGE SymKind and enable process_package_imports() to create a binding between a package and its symbols][:language :parsing]
[15:55][Enable parse_decl_import() to support package renaming][:language :parsing]
[20:15][Test out our package renaming, with success][:language :parsing :run]
[20:58][Make new_decl_import() take an additional rename_name to complete our package renaming support][:language :parsing]
[22:29][Introduce try_resolve_package() to enable resolve_expr_field() to handle our package_name.symbol syntax in an expression context][:language :parsing]
[33:00][Test out our package symbol evaluation, without success][:language :parsing :run]
[33:41][Fix gen_decl() and gen_expr() to handle our namespaced packages][:language :parsing]
[36:41][:Run it to see that it works, and take a look at our generated code][:language :parsing]
[37:29][Test nested references, without success][:language :parsing :run]
[39:36][Step through try_resolve_package() to see what it does with our test][:language :parsing :run]
[41:33][Fix process_package_imports() to correctly associate the symbol with its imported package][:language :parsing]
[41:51][:Run it to find that it compiles][:language :parsing]
[42:13][Stress test our package renaming][:language :parsing]
[43:39][Enable sym_global_put() to handle idempotent imports][:language :parsing]
[44:19][:Run it to find that it works][:language :parsing]
[44:40][Q&A][:speech]
[45:00][Consider the alternative implementation of package symbol association][:language :parsing :speech]
[47:51][Explain our "using"-style package namespacing][:language :parsing :speech]
[49:33][Unnamed structs and unions][:language :parsing :speech]
[54:41][Dive into unnamed structs and unions, starting with parse_decl_aggregate_item()][:language :parsing]
[59:14][Introduce parse_aggregate() and new_aggregate()][:language :memory :parsing]
[1:05:53][Step in to gen_aggregate() to see that it all looks pretty busted][:language :memory :parsing :run]
[1:07:53][Make parse_decl_aggregate_item() initialise AggregateItem members explicitly][:language :parsing]
[1:09:01][Step in to gen_aggregate() to see that the line is right, but not the name][:language :parsing :run]
[1:14:37][Fix new_aggregate() to allocate the correct size][:memory]
[1:14:56][:Run it to find that everything is as before][:language :memory :parsing]
[1:15:17][Introduce complete_aggregate() to complete our support for unnamed structs and unions][:language :parsing]
[1:19:14][Test an unnamed union][:language :parsing]
[1:20:55][Introduce gen_aggregate_items() to emit the C code for our unnamed structs and unions][:"code generation" :language :parsing]
[1:25:26][:Run it and take a look at our generated code, to see that it's all great][:"code generation" :language :parsing]
[1:25:48][Consider how to enable the type resolver to handle unnamed structs and unions][:language :parsing :research]
[1:32:16][Stop here, with thoughts on our new package renaming, symbol association and unnamed structs and unions, and a glimpse into the next stream][:language :parsing :speech]
[/video]
