GITHUB ↗

YELLOW CAKE was made by Jake Wood

YELLOW CAKE

a baby stack language
GRAMMAR
WORD    := { A-Z | 0-9 | "_" } ["'" | 0-9]
COMMENT := a-z | "(" | ")"
INT     := { 0-9 }
PARAM   := WORD
OP_NAME := WORD
OP_BODY := { INT | OP_NAME | "+" | "*" | "-" | "[" | "]" }
OP_FUNC := { PARAM } OP_NAME "=" OP_BODY EOL
MAIN    := "MAIN =" OP_BODY
PROGRAM := INT "FUEL" EOL { OP_FUNC } MAIN
      
BUILT INS
A B +     = _     addition
A B *     = _     multiplication
A B -     = _     subtraction
A B DIV   = _ _   int division and remainder
A B GT    = _     greater than
A B LT    = _     less than
A B EQ    = _     equals
A B NAND  = _     not and
P   READ  = _     push value at P index in memory to stack
P X WRITE =       writes X value to P index in memory
A   [     =       if A ≠ 0 continue, otherwise jump to matching ]
A   ]     =       if A ≠ 0 continue, otherwise jump to matching [
A   PRINT =       print A to terminal or console
      
STD LIB
A   DROP  =
A   DUP   = A A
A B SWAP  = B A
A B AND   = (A B NAND) (A B NAND) NAND
A B OR    = (A A NAND) (B B NAND) NAND
A   NOT   = A A NAND