Very cool. Maybe add malloc() and friends to missing functionality.
Show HN: Learn C and its lower levels interactively, in the browser
21–30 of 37 posts
Re: Show HN: Learn C and its lower levels interactively, in the browser
#22Re: Show HN: Learn C and its lower levels interactively, in the browser
#23First, do this:
$ cp /site/root/system/wasms/games/binjgb.wasm .
The system is built around the concept of command libraries. You are going to need to import the wasm library like this:
$ import wasm
This loads a fairly powerful command called parsewasm. To get an informational printout of the toplevel sections in that file, run the command:
$ parsewasm --toplevel binjgb.wasm
There are lots of other subcommands in parsewasm, but the coolest part is that you can list out the names of exported functions and then dump out the code bodies of whatever functions you want to inspect.
Re: Show HN: Learn C and its lower levels interactively, in the browser
#24Just a heads up: it works on Chrome but not on Safari
Re: Show HN: Learn C and its lower levels interactively, in the browser
#25Re: Show HN: Learn C and its lower levels interactively, in the browser
#26Re: Show HN: Learn C and its lower levels interactively, in the browser
#27I couldn't do a simple #define. This is pretty fundamental to typical C programming. One would also expect stringification, token pasting, and variadic macros.
I added a goto, and it won't compile. Yes, this is a valid and useful part of C, and must be learned by any C programmer. If you doubt this, count occurrences of goto in the Linux kernel.
I also couldn't do modern array initializers. I'll guess the same is true of modern struct initializers. These are important for producing maintainable code.
There seems to be no support for the restrict keyword. This keyword makes a dramatic performance difference.
Re: Show HN: Learn C and its lower levels interactively, in the browser
#28Re: Show HN: Learn C and its lower levels interactively, in the browser
#29Re: Show HN: Learn C and its lower levels interactively, in the browser
#30Nice, but some of the missing features really hurt: I couldn't do a simple #define. This is pretty fundamental to typical C programming. One would also expect stringification, token pasting, and variadic macros. I added a goto, and it won't compile. Yes, this is a valid and useful part of C, and must be learned by any C programmer. If you doubt this, count occurrences of goto in the Linux kernel. I also couldn't do m…
But more importantly, every MVP is going to lack certain features that some folks deem essential. But when we focus on missing features, or worse, miss the point of a project ("you built X but what I really want is Y"), we discourage them or others from trying/sharing future experiments.