Snek: A Python-Inspired Language for Tiny Embedded Computers
summary
A Python subset called Snek compiles to a small bytecode VM that runs in 32kB ROM and 2kB of RAM, targets ATmega328 boards and the classroom workflow, and passes a test suite to ensure Snek answers match CPython except for board I/O. Implementation highlights include NaN tagging to pack pointers and 32-bit floats into 32-bit values, an in-place compacting incremental GC that avoids double heaps, and a tiny parser generator lola that is about 1/10 the size of bison. LEGO robot demos and a Mu/SnekDE IDE show the system working for middle-school lessons.
AI-written summary · about
chapters (23)
- 0:00Intro
- 1:30Lego Robotics Class
- 3:37My First Lego Computer
- 5:29Logo Code
- 9:31Arduino Code
- 11:59Fireworks
- 12:50Project Goals
- 18:44Snek Line Bug
- 22:56Snek Example
- 23:13Circuit Python Example
- 27:55Editing Snek with Mu
- 28:33Editing Snek with Snekde
- 29:33Language Implementations
- 31:37Snek Implementation
- 32:18Snek Values
- 35:11Snek Compiler
- 36:49Lola
- 37:35Snek VM
- 38:20Snek Bytecode
- 38:39Snek Memory Manager
- 39:33Memory Management
- 40:09Tricky Python Bits
- 41:47SnekBoard
related talks
56mScripting the Internet of Things
15mA Small Scheme VM, Compiler and REPL in 4K
09mProgrammer Productivity and Performance on Embedded RISC-V CPUs
32mUsing MicroPython in the wild
27mMicroPython: Embedded programming for everyone
51mMicroPython: a journey from Kickstarter to Space
30mRuby on NES - how to make the smallest ruby ever
41mJerryScript: An Ultra-lightweight JavaScript Engine for the Internet of Things
