AGG
A program is a strand of DNA. Each codon means what the one-letter code of its amino acid spells.
mmph, 2023 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
mmph made AGG in 2023, pronounced "AAUUGHH!!!!". A program is a list of codons, three letters each from A, C, T and G. What the codon does in a cell means nothing; only the abbreviation counts. ATG codes for methionine, M, so it multiplies. TGT and TGC code for cysteine, C, so they print. The three stop codons close a loop.
Read the story
A push takes the next codon as a number in base 4, with A, C, T and G as 0, 1, 2 and 3. So TCG is 213, which is 39.
The machine
| Letter | Codons | Does |
|---|---|---|
| C | TGT TGC | Pop and print as a character |
| I | ATT ATC ATA | Push the codes of a line of input |
| P | CCT CCC CCA CCG | Push the next codon as a number |
| A S M D H | GCT TCT ATG GAT CAT and more | Add, subtract, multiply, divide, modulo |
| V | GTT GTC GTA GTG | Duplicate the top |
| T | ACT ACC ACA ACG | Reverse the stack |
| F R | TTT TTC, and CGT AGA and more | Move the top to a memory stack, and back |
| L | CTT TTA and more | Skip past the matching stop when the top is 0 |
| Stop | TAA TAG TGA | Go back to the matching L when the top is not 0 |
The seven amino acids that are no command, such as lysine in AAA, do nothing. A word that is not a codon is ignored, and right after a push it counts as 0. Arithmetic takes the top and the one below it and leaves the one below minus, divided by or modulo the top.
Example
The Hello World builds every letter from small numbers.
The Hello World builds every letter from small numbers. CCT TCA pushes 36, CCC AAT pushes 2, ATG multiplies them into 72 and TGT prints H.
The cat reads a line, puts a 0 under it by pushing and reversing, and prints until it reaches the 0.
The truth machine takes 48 from the digit it reads. On 0 the loop is skipped, and adding 48 again makes the 0 it prints. On 1 the loop prints 1 forever.
Patterns it teaches
- Camouflage: code that reads as a gene.
- Stack machines: one stack, with a second one for memory.
Further
See also
Stack-based
Write your own in Run Convert a program from AGG
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: agg.
Command line
shib run agg -e 'ATA CCT AAA ACC CTT TGT TAA' --input 'cat'shib manual aggSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/agg.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org