by Breck Yunits
May 31, 2024 โ Yesterday, on a plane, I found an equation I sought for a decade.
PTCRI describes the potential of a programming syntax.
PTCRI says the number of possible programs P is equal to the number of tokens T raised by the number of columns C, raised by the number of rows R (aka lines), raised by the number of indentation levels I.
If you view the source code of this post, you will see T, C, R, and I in action.
PTCRI explains the simplicity and power of Particles[1]. Four concepts, three syntax rules support a vast universe of concise programs. Another syntax(es) might be found with superior metrics, but I have yet to see it.
PTCRI also explains why nearly flat structures work so well: a little nesting goes a long way. If you set T and C and R to 3, changing I from 1 to 2 increases the amount of possible programs from 7,625,597,484,987 to 58,149,737,003,040,060,000,000,000.
59 days ago I announced the decade long Particles research endeavor over with a negative result.
It looks like I was wrong again. There was something special about Particles, and PTCRI explains what that is.
It shouldn't be possible to represent all programs in all programming language with such a minimal set of rules! Particles doesn't even have parentheses!
And yet, the experimental evidence kept piling up.
The evidence hinted at some important natural formula, and now we have a name for it: PTCRI.
[1] Particles was originally named Tree Notation.
Thank you to Marc Forward and Inconstant_Moo for feedback and helping me add the T.
It may help to explain from another angle. Imagine your boss comes up to you and says "We are giving you a special assignment. We want you to come up with the best possible syntax for all programming languages." What do you come up with?
You can present them with Particles, and explain how it supports a vast universe of programs, P = {T^{C^R}}^I, with just three syntax rules: