RSSAmplifier

Blog

BranchTaken

Champion of the Hemlock programming language

branchtaken.comRSS feed ↗10 posts

Latest posts

APLR is Quite Adequate

Early this year the Hardly Original Compiler Compiler ( Hocc ) started seeing some serious use, but unfortunately IELR (inadequacy elimination LR) proved frustratingly slow enough to warrant another round of optimization. IELR is ~2X faster now, but this was a 10X performance problem, so I reluctantly ordered a new computer to gain a further ~3X (netting ~6X). But during the couple weeks it took…

All Aboard the Bootstrap Transpiler Express

The Hardly Original Compiler Compiler ( hocc ) is now fully functional! Jump aboard for some compelling late-stage developments, and stick around to read what comes next for Hemlock development. hocc developments hocc development started in early 2022, and it turned out to be a much more challenging project than intended due to inclusion of the IELR(1) algorithm. See these previous blog posts for…

Now Back to Our Regularly Scheduled Programming Language

Work on the hocc parser generator began in early 2022. Here we are over two years later and hocc is only now nearing completion. This is mostly due to an inadvertent nerd snipe , credit due to Laurence Tratt [ 1 ]. I took a long detour to the land of IELR(1) [ 2 ] and back, and hocc eventually gained a practical IELR(1) implementation. What started several months ago as a cautionary document about…

Resolution Convolution

The hocc parser generator is incrementally converging on a working IELR(1) [ 1 ] implementation, but it is a convoluted process, putting things mildly. I’m pretty sure this showed up on my screen late one night: YOU ARE IN A MAZE OF TWISTY LITTLE STATES, ALL ALIKE. [ 2 ] Read on for the latest battle report. May the human win in the end! Dependencies, schmependencies The promise of IELR(1) is to…

Art of the State

The in-development hocc parser generator recently reached the significant milestone of being capable of generating state tables using any of the LR(1), PGM(1), or LALR(1) algorithms. All of these algorithms date back to the 1960s and 1970s, but there’s a newcomer, IELR(1), which was published this century. This seemed like a good time to tie off a loose end and write a detailed critique of IELR(1)…

Why Hemlock

Hemlock is (aspirationally) a general-purpose programming language , a category already abundantly populated with options sufficient for almost any task. How can an upstart language project out-general the generals? And can the attempt even be justified? I’m here to argue that these existential questions have good answers. Read on for some history and an elevator pitch perhaps best suited to…

Stitches in Time Save RAM

The hocc parser generator implementation can now compute the canonical collection of LR(1) items (𝐶𝐶 for short), as briefly introduced in a previous post regarding follow sets . All seems well with 𝐶𝐶 generation, but some of the larger stress tests tripped on an inefficiency in Hemlock’s naïve string formatting implementation. The initial solution struck me as elegant, if overly clever, but…

Recognizing Follow Sets

The hocc parser generator implementation continues to progress, and very nearly all the pieces are in place for computing what the literature commonly calls the “canonical collection of LR(1) items” or 𝐶𝐶 for short [ 1 ]. 𝐶𝐶 is more accurately described as a set closure of LR(1) item set closures, but there are sets in the sets in the sets, so 𝐶𝐶 seems a reasonable compromise between…

State of the hocc Grammar

The hocc parser generator implementation is coming along nicely. The parser is stable, the first pass of semantic analysis is implemented, and no known hocc grammar issues remain. This is a good time to draw attention to a minor syntax refinement that was prompted by unnecessarily awkward code comments in the previously posted hocc grammar . Note the comments trailing each token statement, e.g.…

Constructive Precedence Relationships

Hemlock’s parser implementation relies on the hocc parser generator , which spiritually descends from the Parsing parser generator . In most respects both hocc and Parsing merely synthesize best practices for LR(1) parsing , with the important exception that they provide an unusually precise conflict resolution mechanism. Parsing validated the approach, but viewed through the lens of, “If it’s…