MENU

Fun & Interesting

Writing a CAD Language in Rust (with Adam Chalmers)

Developer Voices 6,591 6 months ago
Video Not Working? Fix It Now

Given how many languages have been written in C over the years, it’s not surprising to see new languages being written in Rust. What is surprising about this week’s guest is the domain he’s writing for: Computer Aided Design (CAD). Could Rust be sneaking its way into the CAD world too? Joining me to discuss the design and implementation of a CAD programming language is Adam Chalmers. He works at Zoo, developing KCL - a language that looks like JavaScript, runs on Rust, and offers users a seamless hybrid experience of both coding and point-and-click modelling. So, how does that all fit together? In this episode we look at the design and implementation of a programming language in Rust; how KittyCAD creates that hybrid environment for text-based programming and point-and-click modelling; and how we can learn to write our own Rust-interpreted languages. – Adam’s Blog: https://adamchalmers.com/ Adam’s Guide To Writing Parsers: https://www.youtube.com/watch?v=QF3kMyzMC40 Zoo’s Modelling App: https://zoo.dev/modeling-app Mechanical CAD: https://zoo.dev/blog/mechanical-cad-yesterday-today-and-tomorrow A Lego brick in KCL: https://zoo.dev/docs/kcl-samples/lego Winnow: https://docs.rs/winnow/latest/winnow/ Nom: https://docs.rs/nom/latest/nom/ Factorio: https://www.factorio.com/ Satisfactory: https://store.steampowered.com/app/526870/Satisfactory/ Crafting Interpreters: https://craftinginterpreters.com/ Coding in Antarctica: https://brr.fyi/ Prior art: https://en.wikipedia.org/wiki/AutoLISP (Thanks to Kristoffer Björk for the link.) Support Developer Voices on Patreon: https://patreon.com/DeveloperVoices Support Developer Voices on YouTube: https://www.youtube.com/@DeveloperVoices/join Adam on Mastodon: https://mastodon.social/@[email protected] Kris on Mastodon: http://mastodon.social/@krisajenkins Kris on LinkedIn: https://www.linkedin.com/in/krisjenkins/ Kris on Twitter: https://twitter.com/krisajenkins – 0:00 Intro 2:19 Adam's Day Job At Zoo 6:18 What Does A CAD-Specific Programming Language Look Like? 11:13 A Cloud-Centric Rendering Architecture 16:24 Digging Into The AST Design 26:35 Zoo's History With Rust 31:02 How Would I Write My Own Language? 38:23 Performance Tuning 46:30 Rust As A Reference Work 51:15 Running as WASM 56:32 Thin Client Performance Concerns 1:04:41 Rendering Over The Network With WebRTC 1:09:22 What Are Your Compile-Time Ambitions for KittyCAD? 1:18:28 Where To Learn More… 1:21:25 Outro

Comment