This document serves as the primary entry point for LLMs seeking to understand ChrysaLisp. The documents are organized in a suggested reading order, moving from high-level concepts to implementation details, then to practical applications.
If you're new to ChrysaLisp, start here to understand what it is and why it exists:
-
Contributions - for hard rules about PRs and testing.
-
Summary - A comprehensive overview of the entire ChrysaLisp system, its core components, architecture, and capabilities.
-
The Philosophy - Understanding computation as sequence transformation and why the "Four Horsemen" (map, filter, reduce, some) are central to the design.
-
Genesis - The origin story: building guarantees from an unreliable sea, and how ChrysaLisp achieves absolute resilience through ephemeral identity.
-
Buda Palm Manual - A newcomer's primer explaining ChrysaLisp's core concepts and how it differs from other languages.
These documents explain the fundamental design decisions that make ChrysaLisp unique:
-
Know Thyself - The Tao of ChrysaLisp: cooperative design, iteration over recursion, and the synergy between small stacks and O(1) caching.
-
All is One - How the O(1) hmap unifies lexical scoping, class inheritance, and property inheritance into a single elegant primitive.
-
Memory Architecture - The complete memory model from low-level allocation (sys_mem) to Lisp objects, reference counting, and the boot image.
Understanding the VP is key to understanding ChrysaLisp's performance:
-
VP Translation - How the Virtual Processor architecture works and how VP instructions are translated to native code for different CPU targets.
-
VP Classes - The inheritance hierarchy of VP classes from obj to specialized types like streams, numbers, and GUI views.
-
VP Functions - The unified binary format for functions and vtables, and the "linkerless" build process.
-
VP SIMD - How vp-simd transforms multi-dimensional thinking into linear, high-performance code through atomic read-execute-write operations.
ChrysaLisp's Lisp dialect is modern, performant, and pragmatic:
-
Modern Lisp - ChrysaLisp's sequence-centric Lisp dialect: no cons cells, reference counting instead of GC, and powerful iteration primitives.
-
Lisp Forth - How ChrysaLisp bridges Forth and Lisp, offering Forth's speed with Lisp's symbolic grounding.
-
Lisp Primitives - The built-in VP Lisp primitives organized by function family.
-
Library Primitives - System and library primitives beyond the core language primitives.
Deeper understanding of how Lisp works in ChrysaLisp:
-
On Classes - The dual vtable architecture: static VP classes for the "Engine" and dynamic Lisp classes for the "Script" layer.
-
Closure or Not - Why ChrysaLisp deliberately rejects implicit closures in favor of explicit object-oriented state management.
-
Art of the Call - How ChrysaLisp achieves O(1) performance through pre-binding, str_hashslot caching, and the evaluation pipeline.
-
Import Modules - The module system using import, include, and the export pattern for encapsulation.
How ChrysaLisp handles different types of data:
-
Numerics - Numeric types (Num, Fixed, Real) and vectorized operations (nums, fixeds, reals).
-
Text Parsing - High-performance text processing using char-class and binary search primitives (bfind, bskip).
-
Streams - The stream system for I/O, including file streams, string streams, and IPC streams (in/out).
-
Pipe Commands - The distributed pipe system for building complex command-line processing pipelines across nodes.
ChrysaLisp's sophisticated graphical interface:
-
GUI Views - The View class as the foundation for all GUI widgets, with its non-recursive layout system.
-
GUI Services - GUI widgets, event system, and the UI builder macros.
-
GUI Composition - How the compositor efficiently redraws using dirty regions, opaque regions, and multi-pass rendering.
Understanding ChrysaLisp as a distributed operating system:
-
Fault Tolerant - How ChrysaLisp achieves fault tolerance through restartable task trees, job requeueing, and ephemeral mailboxes.
-
Dynamic Code - The assembler as a Lisp library: how dynamic code generation works (demonstrated with pixmap format conversion).
-
Coding Style - Guidelines for writing idiomatic ChrysaLisp: naming conventions, state management, iteration patterns, and the three-stage optimization path.
Understanding the "why" behind ChrysaLisp's design:
-
Evidence Not Faith - Benchmarks proving the sub-second rebuild claims and demonstrating performance across platforms.
-
Malleability - How ChrysaLisp delivers Lisp's dynamic malleability without sacrificing C-like performance.
-
More Haste Less Speed - The philosophy of deliberate craftsmanship: achieving performance through thoughtful design rather than raw speed.
-
The Tao of Now - It's all a dream. The system is a concensous reality.
Getting ChrysaLisp running and building applications:
-
Host Interface - The bridge between ChrysaLisp and the host OS: PII functions, GUI/audio layers, and the VP64 emulator.
-
Porting - Comprehensive guide to porting ChrysaLisp to new operating systems and CPU architectures.
-
App Configuration - The standard pattern for managing application state and user preferences.
Deep dives into specialized areas:
-
Inner Thoughts - The REPL as a JIT compiler: understanding the read-expand-bind-eval pipeline and the static-q* family.
-
Rocinante - Mastering the "Four Horsemen" primitives (each!, map!, reduce!, some!, filter!) and the ! special form.
-
Udat AI Shares - AI commentary on ChrysaLisp's architectural coherence and design philosophy.
-
Coding Domains - Know your coding domain and stick to it.
-
Sequence Indexing - Sequence indexing and slicing.
-
Application Acceleration - Adding native functions to applications..
-
The Dual VTable - A Study of ChrysaLisp's Static and Dynamic Object Models.
-
Network & IPC - ChrysaLisp Network & IPC Architecture.
-
Vector Graphics - ChrysaLisp Vector Graphics Architecture.
-
Slicing and Dicing - Deep Analysis: Vectorized Slicing and Dicing in ChrysaLisp.
-
Text Buffers - The Text Buffer and Edit Architecture.
-
The Text Stack - A Comprehensive Analysis.
-
Edit Command - The ChrysaLisp Parallel Programmable Editor.
-
VP64 Emulator - The VP64 C/C++ Emulator Implementation.
-
Task Farming - The Task farm libraries.
Depending on your goals, you might follow different reading paths:
Follow the order above from 0-48 for a complete understanding.
Focus on the language, standard libraries, and GUI framework.
Read: 1, 4, 12, 29, 38, 14, 15, 19, 20, 22, 24, 25, 26, 36, 27, 33
Focus on the Virtual Processor, memory model, and host integration.
Read: 1, 3, 5, 7, 8, 9, 10, 11, 34, 35, 18, 28, 37
Focus on the philosophical divergences from traditional Lisp and architectural unification.
Read: 2, 3, 6, 13, 16, 17, 30, 31, 32, 33, 39
Read: 1, 4, 12, 14, 29, 38, 40, 41
Running test scripts via an LLM is easy to accomplish via the -s option of the
ChrysaLisp launch bash file.
./run_tui.sh -n 1 -f -s script_name.lisp
This will launch the system on a single VP node, in the foreground, and run the
raw script_name.lisp file.
Keep any test scripts and associated files in the tests/ folder !
There is a compreshensive test suite that can be run via.
./run_tui.sh -n 1 -f -s tests/run_all.lisp
If you are not changing the base VM or any VP level system files, which most app coding should NOT be doing ! There is no need to keep making the system from scratch each time ! Running your tests via this script launcher is what you should be doing.
In order to run a cmd/ app, from a raw script, you need to wrap the
cmd/appname.lisp in a (pipe-run command_line) function, from the (import "lib/task/pipe.inc") library.
And to be robust around catching errors, should wrap your tests in a catch
block, and end the script in a call to the host shutdown code, like so.
To throw an error, use (throw "Description !" obj), if no object of interest,
use :nil. Do NOT use catch or throw in runtime ChrysaLisp code ! That
feature is compiled out in release mode and is only available for the debug
builds and testing.
;use of (pipe-run command_line)
(import "lib/task/pipe.inc")
(defun my-test ()
(defq test_string "string with new line\n")
...
(pipe-run appname)
...
)
(catch
(my-test)
(progn
;report error
(print "Test failed with error" _)
;signal to abort the catch
:t))
;clean shutdown of the VP node
((ffi "service/gui/lisp_deinit"))ChrysaLisp represents a radical rethinking of how a Lisp system can be built for maximum performance and resilience. It proves that the dichotomy between dynamic malleability and static performance is a false one, born of historical implementation choices rather than fundamental constraints.