1

From Esolang
Jump to navigation Jump to search
1
Official logo of 1
Paradigm(s) procedural, imperative
Designed by None1
Appeared in 2023
Memory system Stack-based
Dimensions one-dimensional
Computational class Push-down automata
Reference implementation Python
Dialects Common1, Advanced1, Pure1, Dead1
Influenced by brainfuck
File extension(s) .1, .one

1 (a.k.a one) is an esolang by User:None1, it has a stack that contains nonnegative integers of any size.

Commands

Command Meaning
* Pop a,b,c, if c mod 4 is 0, push b+a, if c mod 4 is 1, push b-a, if c mod 4 is 2, push b*a, otherwise push b mod a
, Pop a, if a mod 4 is 0, pop a number and output as character, if a mod 4 is 1, pop a number and output as decimal, if a mod 4 is 2, read a character from user input and push its ASCII, otherwise read an integer from user input and push it
_ Push a random number between 0 and 255 onto the stack
1 Push 1 onto the stack
[x] While top of stack isn't zero, do x (like the bracket in BF).
Other characters Push corresponding ASCII value onto the stack

Note: EOF returns 0, if a subtraction will result in a negative value, push 0 instead, if an empty stack is popped, return a random number between 0 and 255, modulo by 0 returns 0

Examples

Hello World

This only works in common1.

H111*,e111*,l111*,l111*,o111*, 111*,W111*,o111*,r111*,l111*,d111*,!111*,

Shorter one:

Hd,ed,ld,ld,od,1-1*d, d,Wd,od,rd,ld,dd,!d,

Cat Program

111*11*,[111*,111*11*,]

Random decimal number between 0 and 255

1,

A+B Problem

111*111*111*11*1*,111*111*11*1*,*1,

Random bit

111*111*11*1*111*11*_*1,

Dialects

1 has many dialects, the one shown above is the most common dialect known as Common1. coding in Common1 is very painful, but other dialects of 1 make it more painful!

Advanced1

Advanced1 removes literals, when it encounters other characters, it simple raises a syntax error.

Pure1

Pure1 is Advanced1, but it removes random, when an empty stack is popped, it raises a syntax error.

Dead1

Dead1 is very different from the other dialects, it minimizes Pure1 down to 4 instructions, so it is equivalent to Pure1 but almost completely unusable for programming (because programming in it will be too painful). If you try programming in Dead1, you will feel like you are dead. None of the examples programs here works in Dead1.

Execution

There are 4 commands: *, 1, [, and ], the commands except * work the same in Pure1.

The command * works like this: Pop a value x, if x mod 8 is less than 4, execute the command * in Pure1, but do not pop c, use x mod 4 instead of c. Otherwise execute , in Pure1, but do not pop a, use x mod 4 instead of a.

External resources

See also