Penrose is a compiler that transforms structured mathematical notation into optimized SVG diagrams. It uses a three-stage pipeline of separate domain, substance, and style files to define mathematical objects, relationships, and visual presentation, then solves continuous optimization problems with user-defined spatial constraints and objectives to automatically arrange diagram elements.
The system separates diagram content from visual style using distinct declarative languages, and provides a typed domain language with subtype hierarchies for mathematical objects. It supports embedding compiled diagrams in React and SolidJS applications with real-time optimization and drag-based manipulation, and offers incremental optimization stepping for interactive diagram tuning. The project installs as an NPM package with native TypeScript type definitions and integrates with modern JavaScript bundlers.
Penrose generates diagrams from plain-text notation, supports browser-based diagramming without local installation, and can package diagram source files into standalone web applications. It provides built-in literal types, arithmetic operations, color specification, and collection-based variable matching for aggregate operations across diagram elements.