I made a programming language with M&Ms

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

MNM Lang is a toy programming language where source code is written as sequences of six color letters (B G R Y O N), compiled into PNG images of candy sprites, and executable. The language encodes opcodes by color family and operand values by token length. It includes a CLI, browser playground with AST and execution trace views, a photo decoder that can recover programs from real candy photos, and example programs like hello world, factorial, and fizzbuzz. Strings are stored in a sidecar JSON file since images handle text poorly. Candy sprites were generated via AI image generation and normalized with a Python script. The code was mostly written using Codex (GPT), with tests covering parser validation, runtime semantics, round-trips, and photo decoding robustness.

13m read timeFrom mufeedvh.com
Post cover image
Table of contents
The core problemImages are bad at textRun hello_world hereA language made of six colorsThe only correct compiler target was an imageI generated the candy sprites with an image modelI almost talked myself into training a modelReal example programs are where the joke becomes a languageThe browser playground made it feel like a real toyRun factorial inlineWe need testsThe best part of the project is the tradeoff it forcesIf you want to try it

Sort: