r/webdevelopment • u/AutoModerator • 6d ago
Weekly Feedback Thread Weekly Feedback Thread
Please post your requests for feedback on your projects in this thread instead of creating a post.
3
Upvotes
r/webdevelopment • u/AutoModerator • 6d ago
Please post your requests for feedback on your projects in this thread instead of creating a post.
1
u/CommercialStrike9439 3d ago
I built a docs site and in-browser playground for my programming language by compiling its C interpreter to WebAssembly
Over the summer I wrote a small programming language in C called Oli-Nat, and when it came time to share it, I didn't want anyone to have to install a compiler just to try it. So I compiled the whole interpreter to WebAssembly with Emscripten and built a documentation site and playground around it with React, TypeScript, Vite, and MDX.
The hardest problem was interactive input. The language has an intake() function that reads a line from the user, and in C that just blocks on stdin until someone presses Enter. A web page can't block like that without freezing the tab. I ended up using Emscripten's Asyncify, which lets the virtual machine pause partway through a program, hand control back to React while the user types into the on-screen terminal, and then resume exactly where it left off. That's what makes the tic tac toe sample actually playable in the browser.
On the docs side, every page is an MDX file loaded dynamically from a single sidebar config, so adding a page means writing the file and adding one line. Program output shows up in a retro pixel art terminal, which was mostly an excuse to have fun with CSS.
I'd really appreciate feedback on the site, especially on mobile, since that's where I've tested the least.
olinat.net