C Code Generation
?
?

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
🗩
0:08Recap and set the stage for the day
🗩
0:08Recap and set the stage for the day
🗩
1:30C Code Generation
🗩
1:30C Code Generation
🗩
1:30C Code Generation
🗩
6:59Valid types in Ion
🗩
6:59Valid types in Ion
🗩
6:59Valid types in Ion
🗩
10:02Translating Ion to C, with a few words on the principle of "declaration follows use" and the quirks of C function declaration syntax1
🗩
10:02Translating Ion to C, with a few words on the principle of "declaration follows use" and the quirks of C function declaration syntax1
🗩
10:02Translating Ion to C, with a few words on the principle of "declaration follows use" and the quirks of C function declaration syntax1
🗩
16:04Translating Ion's (ptr int) and (ptr (ptr int))
🗩
16:04Translating Ion's (ptr int) and (ptr (ptr int))
🗩
16:04Translating Ion's (ptr int) and (ptr (ptr int))
🗩
19:58Translating Ion's (array 10 (ptr int))
🗩
19:58Translating Ion's (array 10 (ptr int))
🗩
19:58Translating Ion's (array 10 (ptr int))
🗩
21:21Translating Ion's (func int (int))
🗩
21:21Translating Ion's (func int (int))
🗩
21:21Translating Ion's (func int (int))
🗩
24:09Q&A
🗩
24:09Q&A
🗩
24:09Q&A
🗩
24:39Setup to translate Ion's type declarations to C
24:39Setup to translate Ion's type declarations to C
24:39Setup to translate Ion's type declarations to C
25:57Introduce gen_test() and type_to_cdecl() - handling void, char, int and float - and a strf()
25:57Introduce gen_test() and type_to_cdecl() - handling void, char, int and float - and a strf()
25:57Introduce gen_test() and type_to_cdecl() - handling void, char, int and float - and a strf()
31:55Run it to see that strf() works as expected
🏃
31:55Run it to see that strf() works as expected
🏃
31:55Run it to see that strf() works as expected
🏃
32:38Add tests for strf() in common_test()
32:38Add tests for strf() in common_test()
32:38Add tests for strf() in common_test()
33:41Run it to see that we pass all the tests
🏃
33:41Run it to see that we pass all the tests
🏃
33:41Run it to see that we pass all the tests
🏃
33:45Implement the TYPE_PTR and TYPE_ARRAY cases in type_to_cdecl()
33:45Implement the TYPE_PTR and TYPE_ARRAY cases in type_to_cdecl()
33:45Implement the TYPE_PTR and TYPE_ARRAY cases in type_to_cdecl()
35:39Create and run tests for type_to_cdelc() in gen_test()
🏃
🖮
35:39Create and run tests for type_to_cdelc() in gen_test()
🏃
🖮
35:39Create and run tests for type_to_cdelc() in gen_test()
🏃
🖮
38:59Implement the TYPE_FUNC case in type_to_cdelc()
38:59Implement the TYPE_FUNC case in type_to_cdelc()
38:59Implement the TYPE_FUNC case in type_to_cdelc()
43:09Add a test of the function code generation of type_to_cdelc() in gen_test()
43:09Add a test of the function code generation of type_to_cdelc() in gen_test()
43:09Add a test of the function code generation of type_to_cdelc() in gen_test()
43:43Step through gen_test() to see what it produces
🏃
43:43Step through gen_test() to see what it produces
🏃
43:43Step through gen_test() to see what it produces
🏃
44:15Remove parentheses from the void, char, int and float types in type_to_cdelc()
44:15Remove parentheses from the void, char, int and float types in type_to_cdelc()
44:15Remove parentheses from the void, char, int and float types in type_to_cdelc()
44:42Run it to see that it looks reasonable, but for the extra space
🏃
44:42Run it to see that it looks reasonable, but for the extra space
🏃
44:42Run it to see that it looks reasonable, but for the extra space
🏃
45:08Stress test the function code generation of type_to_cdelc() in gen_test()
45:08Stress test the function code generation of type_to_cdelc() in gen_test()
45:08Stress test the function code generation of type_to_cdelc() in gen_test()
45:56Run it to see that it looks vaguely right, and consider how we'll get rid of the extra parentheses
🏃
45:56Run it to see that it looks vaguely right, and consider how we'll get rid of the extra parentheses
🏃
45:56Run it to see that it looks vaguely right, and consider how we'll get rid of the extra parentheses
🏃
46:30Add function pointer tests in gen_test()
46:30Add function pointer tests in gen_test()
46:30Add function pointer tests in gen_test()
47:21Run it to see that we're generating illegal C
🏃
47:21Run it to see that we're generating illegal C
🏃
47:21Run it to see that we're generating illegal C
🏃
48:18Fix the TYPE_PTR case in type_to_cdelc()
48:18Fix the TYPE_PTR case in type_to_cdelc()
48:18Fix the TYPE_PTR case in type_to_cdelc()
48:36Run it to see that it looks right
🏃
48:36Run it to see that it looks right
🏃
48:36Run it to see that it looks right
🏃
49:12Add an array test in get_test()
49:12Add an array test in get_test()
49:12Add an array test in get_test()
49:42Run it to see extra parentheses again
🏃
49:42Run it to see extra parentheses again
🏃
49:42Run it to see extra parentheses again
🏃
50:22Introduce opt_paren() to handle parenthesis generation for type_to_cdelc() to call
50:22Introduce opt_paren() to handle parenthesis generation for type_to_cdelc() to call
50:22Introduce opt_paren() to handle parenthesis generation for type_to_cdelc() to call
54:50Run it to see that it looks right
🏃
54:50Run it to see that it looks right
🏃
54:50Run it to see that it looks right
🏃
55:35pmttavara Can't you just pass in some dummy name to workaround the missing name? Like (__arg[10])
🗪
55:35pmttavara Can't you just pass in some dummy name to workaround the missing name? Like (__arg[10])
🗪
55:35pmttavara Can't you just pass in some dummy name to workaround the missing name? Like (__arg[10])
🗪
56:22twitchplaysp0ng Does Ion support named function pointer parameters
🗪
56:22twitchplaysp0ng Does Ion support named function pointer parameters
🗪
56:22twitchplaysp0ng Does Ion support named function pointer parameters
🗪
57:02Rename opt_paren() to cdecl_paren() and clean up the space-generation in type_to_cdelc()
57:02Rename opt_paren() to cdecl_paren() and clean up the space-generation in type_to_cdelc()
57:02Rename opt_paren() to cdecl_paren() and clean up the space-generation in type_to_cdelc()
58:00Run it to see that it's starting to look correct
🏃
58:00Run it to see that it's starting to look correct
🏃
58:00Run it to see that it's starting to look correct
🏃
58:19“I think this is the only part that's nontrivial.”α
58:19“I think this is the only part that's nontrivial.”α
58:19“I think this is the only part that's nontrivial.”α
58:49Further thoughts on dummy names, noting that we'll be using this same code for casts
🗩
58:49Further thoughts on dummy names, noting that we'll be using this same code for casts
🗩
58:49Further thoughts on dummy names, noting that we'll be using this same code for casts
🗩
1:00:07elavid PMTTavara's idea works for me at least in GCC. We're specifically talking about the function pointer arguments. Example cast: (int (*)(int dummyname))0
🗪
1:00:07elavid PMTTavara's idea works for me at least in GCC. We're specifically talking about the function pointer arguments. Example cast: (int (*)(int dummyname))0
🗪
1:00:07elavid PMTTavara's idea works for me at least in GCC. We're specifically talking about the function pointer arguments. Example cast: (int (*)(int dummyname))0
🗪
1:01:220b0000000000000 Function that returns array of function pointers with pointer argumentsβ
🗪
1:01:220b0000000000000 Function that returns array of function pointers with pointer argumentsβ
🗪
1:01:220b0000000000000 Function that returns array of function pointers with pointer argumentsβ
🗪
1:01:29Add a test of a function that returns (unfortunately unintentionally) a function in gen_test()
1:01:29Add a test of a function that returns (unfortunately unintentionally) a function in gen_test()
1:01:29Add a test of a function that returns (unfortunately unintentionally) a function in gen_test()
1:02:38Run it to see that it looks wrong
🏃
1:02:38Run it to see that it looks wrong
🏃
1:02:38Run it to see that it looks wrong
🏃
1:04:29rygorous You can't return functions directly
🗪
1:04:29rygorous You can't return functions directly
🗪
1:04:29rygorous You can't return functions directly
🗪
1:04:48Construct a C-valid function declaration that returns an array of function pointers
1:04:48Construct a C-valid function declaration that returns an array of function pointers
1:04:48Construct a C-valid function declaration that returns an array of function pointers
1:08:58twitchplaysp0ng pervognsen Change line 21
🗪
1:08:58twitchplaysp0ng pervognsen Change line 21
🗪
1:08:58twitchplaysp0ng pervognsen Change line 21
🗪
1:09:10Work through the handling of our torture test in the TYPE_FUNC case in type_to_cdelc()
1:09:10Work through the handling of our torture test in the TYPE_FUNC case in type_to_cdelc()
1:09:10Work through the handling of our torture test in the TYPE_FUNC case in type_to_cdelc()
1:12:27Run it to find that it does work
🏃
1:12:27Run it to find that it does work
🏃
1:12:27Run it to find that it does work
🏃
1:12:580b0000000000000 You could also typedef any function pointer types to make it easier?
🗪
1:12:580b0000000000000 You could also typedef any function pointer types to make it easier?
🗪
1:12:580b0000000000000 You could also typedef any function pointer types to make it easier?
🗪
1:13:19Add our intended torture test of a function that returns an array of function pointers in gen_test()
1:13:19Add our intended torture test of a function that returns an array of function pointers in gen_test()
1:13:19Add our intended torture test of a function that returns an array of function pointers in gen_test()
1:14:23Run it to see that we correctly generate our torture test case
🏃
1:14:23Run it to see that we correctly generate our torture test case
🏃
1:14:23Run it to see that we correctly generate our torture test case
🏃
1:15:28A few words on constructing C declarations in the knowledge of its inside-to-out parsing
🗩
1:15:28A few words on constructing C declarations in the knowledge of its inside-to-out parsing
🗩
1:15:28A few words on constructing C declarations in the knowledge of its inside-to-out parsing
🗩
1:17:03rygorous No, that array is an argument. Or, wait, is it? I don't actually know what the args to type_func are
🗪
1:17:03rygorous No, that array is an argument. Or, wait, is it? I don't actually know what the args to type_func are
🗪
1:17:03rygorous No, that array is an argument. Or, wait, is it? I don't actually know what the args to type_func are
🗪
1:17:17Rename gen_test() to cdecl_test()
1:17:17Rename gen_test() to cdecl_test()
1:17:17Rename gen_test() to cdecl_test()
1:17:46rygorous No, MSVC says that a function returning an array is illegal
🗪
1:17:46rygorous No, MSVC says that a function returning an array is illegal
🗪
1:17:46rygorous No, MSVC says that a function returning an array is illegal
🗪
1:18:07Determine to enable type_to_cdecl() to handle structs and unions, introducing cdecl_name() to produce the type strings for our types
1:18:07Determine to enable type_to_cdecl() to handle structs and unions, introducing cdecl_name() to produce the type strings for our types
1:18:07Determine to enable type_to_cdecl() to handle structs and unions, introducing cdecl_name() to produce the type strings for our types
1:21:19Introduce gen_decl() and genf(), and determine to enable the resolver code to pass the resolve type through to the generator
1:21:19Introduce gen_decl() and genf(), and determine to enable the resolver code to pass the resolve type through to the generator
1:21:19Introduce gen_decl() and genf(), and determine to enable the resolver code to pass the resolve type through to the generator
1:24:07Mini rant on MSVC's "Go to All" feature's regex-style interpretation of "."
💢
1:24:07Mini rant on MSVC's "Go to All" feature's regex-style interpretation of "."
💢
1:24:07Mini rant on MSVC's "Go to All" feature's regex-style interpretation of "."
💢
1:24:32Add a Type *type to the Expr struct for resolve_expected_expr() to fill out, and change the Decl struct to contain a Sym *sym rather than a Type *type for sym_global_decl() to set
1:24:32Add a Type *type to the Expr struct for resolve_expected_expr() to fill out, and change the Decl struct to contain a Sym *sym rather than a Type *type for sym_global_decl() to set
1:24:32Add a Type *type to the Expr struct for resolve_expected_expr() to fill out, and change the Decl struct to contain a Sym *sym rather than a Type *type for sym_global_decl() to set
1:29:24Q&A
🗩
1:29:24Q&A
🗩
1:29:24Q&A
🗩
1:29:44elavid Oh, are we gonna have a K&R moment? You should add "void" if the num_params is 0
🗪
1:29:44elavid Oh, are we gonna have a K&R moment? You should add "void" if the num_params is 0
🗪
1:29:44elavid Oh, are we gonna have a K&R moment? You should add "void" if the num_params is 0
🗪
1:30:06Make type_to_cdecl() add "void" for functions that take no arguments
1:30:06Make type_to_cdecl() add "void" for functions that take no arguments
1:30:06Make type_to_cdecl() add "void" for functions that take no arguments
1:30:42Run it to see that it correctly adds "void"
🏃
1:30:42Run it to see that it correctly adds "void"
🏃
1:30:42Run it to see that it correctly adds "void"
🏃
1:31:230b0000000000000 pervognsen You need break statements on those cases
🗪
1:31:230b0000000000000 pervognsen You need break statements on those cases
🗪
1:31:230b0000000000000 pervognsen You need break statements on those cases
🗪
1:31:370b0000000000000 pervognsen You broke the switch statement that had returns
🗪
1:31:370b0000000000000 pervognsen You broke the switch statement that had returns
🗪
1:31:370b0000000000000 pervognsen You broke the switch statement that had returns
🗪
1:31:51Fix resolve_expected_expr() to break out of the cases in its switch statement
1:31:51Fix resolve_expected_expr() to break out of the cases in its switch statement
1:31:51Fix resolve_expected_expr() to break out of the cases in its switch statement
1:32:47Stop the recording
🗩
1:32:47Stop the recording
🗩
1:32:47Stop the recording
🗩