ELSEIF
Your brief EB
368 stories from 111 feeds 418 clusters Refreshed 6 minutes ago next pull 18:52

LANGUAGES Signal 390

Compiler-building opinions advocate prototyping languages with transpilers and relational type checking

A veteran consultant argues that modern compiler development should prioritise rapid prototyping and transpilation over traditional toolchains

WHY IT MATTERS

The post challenges 20th-century compiler orthodoxy with concrete tool recommendations. Engineers designing new languages can reduce up-front effort by deferring optimisation and reusing existing runtimes. The advice is thin on production-scale caveats but offers a low-risk path to minimum viable implementations

Written by elseif from the cluster below · every claim links back to a source

The three things worth knowing

01

Use OhmJS and PEG grammars to prototype parsers quickly before committing to a final implementation

02

Transpile to an existing language (Python, JavaScript, Go) for a minimum viable implementation instead of building a full compiler

03

Express type checking relationally with Prolog or triples before optimising for performance

THE READ

What the cluster adds up to.

ORIGINAL ANALYSIS

The author separates language design from compiler construction and recommends avoiding full compilers in favour of transpilers. By targeting an existing runtime (Python, JavaScript, Go), engineers can validate a language without building a code generator, register allocator, or linker. This approach trades immediate performance for faster iteration and lower initial effort.

Prototyping tools are central to the workflow. OhmJS and its editor provide a REPL-like environment for grammar development, reducing the feedback loop for syntax changes. The author suggests writing the parser twice, once in OhmJS for experimentation, then porting to a production parser (Pratt, recursive descent) only after the grammar stabilises. Type checking is similarly prototyped relationally in Prolog before being re-implemented in a more performant language.

Code emission is split into two phases: dumb generation followed by peephole optimisation. The author cites Fraser/Davidson and Cordy’s OCG as models, arguing that LLVM is overkill for initial implementations. Intermediate representations like JavaScript or Lisp are preferred for their simplicity, with Python’s indentation handled via a pre-processing step that converts brace-delimited code to properly indented output.

The post frames compiler development as a pipeline of specialised stages, each using the most suitable tool, OhmJS for parsing, Prolog for type checking, Cordy’s MISTs for portability. This modularity allows engineers to defer optimisation until profiling identifies bottlenecks. The advice is explicitly aimed at minimum viable implementations, leaving production engineering (blazing-fast code, efficient memory use) as a later concern.

Written by elseif from the cluster below · checked for specifics the sources never contained

THE CLUSTER

Same story, 1 feed.

ORDERED BY FIRST SEEN
substack.com via Lobsters Opinions About Compiler Building Open ↗