Recto – A Truly 2D Language
12 days ago
- #visual-syntax
- #spatial-computing
- #programming-languages
- Recto is a 2D programming language using nested rectangles as core syntax, encoding structure and recursion spatially.
- Human languages are traditionally one-dimensional, but Recto explores non-linear, spatial representations for code and natural language.
- Early symbolic systems like star charts and medieval diagrams used spatial representations for organizing meaning, showing a history of thinking in space.
- Recto's design is inspired by non-1D languages like sign languages and esoteric programming languages (e.g., Befunge, Fish, Piet).
- The language uses rectangles (rects) as core syntactic units, allowing natural representation of data structures like lists, matrices, and tensors.
- Recto supports nested rects, typed rects (dictionaries, sets, matrices), and spatial parsing with row-major order.
- Control flow structures (if, for) and function definitions are visually intuitive, leveraging 2D layout for scope and grouping.
- Challenges include tooling (editors, version control) and AI-based coding tools, as most are built for 1D code.
- Recto Pad, a web tool, was created to facilitate writing Recto code, resembling design tools more than traditional text editors.
- Recto's spatial paradigm could enhance collaboration, debugging, and parallel editing, moving beyond linear constraints.
- The language's principles extend to natural language, offering spatial representations for flexible word-order languages like Japanese.
- Recto is licensed under Creative Commons Attribution 4.0 (CC BY 4.0), encouraging sharing and adaptation.