4 ms·
There are a few people who've written up their approaches for writing what amounts to pseudocode-to-FRACTRAN compilers. The Collatz-generating program given in
by braythwayt 6y ago
There are a few people who've written up their approaches for writing what amounts to pseudocode-to-FRACTRAN compilers.
The Collatz-generating program given in TheFrumiousArticle was generated by writing a Magnificent Minsky Machine first, and then using the example Minsky->FRACTRAN compiler.
Thank you for reminding me about the code golf examples, I saw them early in my writing research, and meant to include a note about them.
I'll do that now!
- kmill 6y agoI'd call the reaction notation pseudocode inasmuch as I'd call assembly language pseudocode or prime factorizations pseudocode -- they're equivalent in completely mechanical way. (Caveat: there needs to be a prime<->species assignment block, too.) A way I'd been experimenting with FRACTRAN is with a slightly different notation, Python: B = 2 A = 3 M2 = 5 Div = 7 M1 = 11 Count = 13 prog = [ (M1 * A, M2 * B**10), (M1, M2 * A), (M2 * A * Div, M1 * B), (M2 * B**4 * Div, M1 * A), (M2, Count), (B, A), (A**2, Div), (Div, M1) ] It uses multiplicative rather than additive notation. All that's left is to take the RHS and divide it by the LHS. --- On HN a while back, someone posted something about how Petri nets are the same as rewrite rules in a commutative monoid, and seeing as FRACTRAN is sort of a system of rewrite rules, I thought to see whether anyone had made the connection before, and sure enough there's a paper. Cook, Soloveichik, Winfree, and Bruck, "Programmability of chemical reaction networks." http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.155.945&rep=rep1&type=pdf http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.155...
- braythwayt 6y agoYou're right! I propose that there is an informal difference between pseudocode, and a specification for a machine: Typically, pseudocode doesn't have a mechanical compiler. It may not have a mechanical compiler for some technical reason (such as inconsistent syntax or impossible semantics), or it might just be too much bother to write a real compiler and sort out how to make all possible program work. But yes, going by this, the moment one writes a pseudocode-to-FRACTRAN compiler, it ceases to be pseudocode and becomes a domain-specific language for writing FRACTRAN programs. +1!
- kmill 6y agoI agree, but I'm saying something stronger here. The reaction notation is equivalent to a FRACTRAN program. Given a prime<->species correspondence, it survives a round trip to and from fractional notation, so to speak ("assembly" and "disassembly"). It's just another way of writing prime decompositions. Perfectly logical agents who can see the entirety of logical consequence would think "eh, what's the big deal? it's equivalent!" But, for whatever reason, the notation finally made me "get" FRACTRAN.
- braythwayt 6y agoOh yes, I embrace the distinction you're drawing, I tried to make the same point about "magnificent" Minsky Machines and FRACTRAN programs. They aren't just "computationally equivalent," they're equivalent "all the way down."