← writing

six grammars in under nine hundred lines

summary: an audit of every peg grammar shipped under std/. the small line count is evidence for grammars-as-values.

ThePlatform ThePlatform: proving the shared runtime in production work: 2019-2024 technical note

Core idea: small parser implementations were evidence that first-class grammars removed the usual boundary between DSL syntax and host-language execution.

Six PEG grammars under std/, eight hundred and eighty-two lines:

filelinesrules
xml.o1613
markdown.o4936
lit.o8516
urllib.o14011
prolog.o14212
sql.o45043

That count is the receipt for the grammars-as-values design. The reason it fits is not that O is concise; it is concise, but not by that factor. The reason is that there is no boundary between the grammar, the reaction that fires on its output, and the kernel that runs the result. The grammar's action body and the surrounding application code are the same lambda surface; the runtime cost is the same kernel everyone else uses.

If we add a seventh grammar and the average line count holds, that is the strongest argument for the design I have.