esolang

Gaia

A golfing language that takes its stack from CJam and its operators and metas from Jelly.

Turing complete: unknown · ●●○ moderate

Tested with 6 known programs · Hello World on Try It Online: identical except the line end · Test method

Run it

Expected: Hello, World!

The idea

Gaia's README names its sources, mostly CJam and Jelly with a little of Ohm and SOGL. Programs are a stack language, as in CJam, but written in its own code page full of accented letters and arrows, as in Jelly. Each line of a program is a function, and the last line is the one that runs.

Read the story

Input is implicit. An operator that finds too few values on the stack reads the next line of input, and once the input is spent it reads the last value again. At the end only the top of the stack is printed.

The machine

One stack of big integers, floats, strings and lists. Each operator does something different for each mix of types; × multiplies two numbers, repeats a string, and joins a list with a string.

OpDoes
12 3.5 - “text” 'cLiterals; - alone is -1
[ ... ]Gather what was pushed in between into a list
+ ⁻ × ÷ %Arithmetic and their string and list forms
: ;Duplicate the top; copy the second over it
… f Σ ΠRange from 0, factorial, sum, product
p qPrint, without and with a newline
@Read a line of input
₂ after an operatorRun it twice; any subscript number works

Example

The third program has only +.
Expected: [0 1 2 3 4]
Expected: 7
Expected: ababab

The third program has only +. The stack is empty, so + reads both of its values from the input.

This implementation is a subset. It has the literals and about thirty operators and stops with a reason on blocks, metas, calls between lines and the rest, rather than guess.

Patterns it teaches

Try this

  1. Print the numbers 0 to 9 as a list.
  2. Read a word and print it three times.
  3. Hard: print the sum of the digits of the factorial of 10.

Further

Also in Golfing

Write your own in Run Convert a program from Gaia

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: gaia.

Command line

shib run gaia -e '+' --input '3
4
'
shib manual gaia

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/gaia.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language