Skip to content

p-nand-q/sorted

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sorted! - The 2000 Esoteric Language Contest Winner

Sorted! is a groundbreaking programming language that won the esoteric language contest for the year 2000. Every Sorted! program consists of exactly fourteen statements, no more, no less. The language is bilingual (English/German), singable, and faithful to the Roman Catholic Church by using cardinals only once.

Design Criteria

  1. You should be able to sing a good programming language. Try singing PHP, and you'll know what I mean. Sorted! in stark contrast lends itself ideally to singing. You are encouraged to do your own recordings of Sorted! programs and post them at MP3.COM.

  2. The excessive use of cardinals is sinful. Thou shalt not have the same cardinal more than once, because cardinals are Roman Catholic ministers and, as such, holy.

  3. Each program should contain exactly fourteen statements.

Features

  • Each Sorted! program contains exactly 14 statements. At one point in the development cycle I thought about using sixteen statements instead, but I remembered my design criteria and did not bloat the language unnecessarily.
  • Error checking in Sorted! is very simple: just count the number of statements
  • Sorted! is bilingual (English and German)
  • Each Sorted! program is, in fact, sorted, albeit randomly. Hence the name!
  • Each Sorted! program can be sung
  • Sorted! now uses OPP for enhanced programming power
  • Each Sorted! is faithful to the Roman Catholic Church

The Sorted! Manual

Every Sorted! program consists of fourteen declarations. Every declaration has a type and a series of objects of that type. For every declaration, there are three possible alternatives:

  • You can either declare no objects
  • A single object
  • Or a series of objects

Statement Order

  1. Cardinals - Declaration of numbers
  2. Going somewhere - Jumps and control flow
  3. Output - What to write
  4. Input - What to read
  5. Sums - Addition operations
  6. Conditions - Comparisons (equal, less than)
  7. Labels - Jump targets
  8. Ordered Differences - Subtraction operations
  9. Assignments - Variable assignments
  10. Products - Multiplication operations
  11. Implementation - Main program logic
  12. Ratios - Division operations
  13. Logical Operations - NAND only
  14. Coolness - Essential declaration

1. Cardinals

You must use either ordinary English cardinals or ordinary German cardinals:

This code does not use any numbers.
This code uses the number fivemilliontwentytwothousandeightynine.
This code uses the numbers Eins, Zwei, and Drei.

You cannot use a single cardinal more than once. They get fed up easily.

2. Going Somewhere

Declare your jumps (conditional or unconditional):

This code does never go anywhere.
This code always goes to the second label.
This code sometimes goes to the second label if the twentyfourth condition is true.

3. Output

Valid output formats include:

  • "a character"
  • "an english cardinal"
  • "an english ordinal"
  • "a german cardinal"
  • "a german ordinal"
  • "a series of sanscrit numbers"
  • "a series of basque numbers"
  • "a series of Tagalog numbers"
  • "a series of Classical Nahuatl numbers"
  • "a series of Kwakiutl numbers"
  • "a series of random numbers"
  • "the german word APFELSTRUDEL."
  • "an insult"

Example:

This code cannot write.
This code writes the first cell as a decimal integer.

4. Input

Currently only supports character input:

This code cannot read.
This code reads the first number as a character.

5. Sums

Declare addition operations:

This code does not use any sums.
This code uses the sum of the first number and the second number.

6. Conditions

Two elements can be equal, or one can be less than the other:

This code uses the condition that the first number is equal to the eight number.

7. Labels

Declare jump targets:

This code does not use any labels.
This code uses two labels.

8. Ordered Differences

Declare subtraction operations:

This code uses the ordered difference between the second number and the fifth number.

9. Assignments

Declare variable assignments:

This code assigns the first number to the first cell.

10. Products

Declare multiplication operations:

This code uses the products of the second number and the fifth number.

11. Implementation

The main program logic as a series of implemented statements:

This code implements the first assignment, the second assignment, the first label, the first jump.

12. Ratios

Declare division operations:

This code uses the ratios of the second number to the fifth number.

13. Logical Operations

Sorted! supports only NAND:

This code uses the logical operation of not the second number and not the fifth number.

14. Coolness

The most important statement:

This code is cool.

or simply:

Cool.

Everything after the declaration of coolness is ignored and can be used for documentation.

Ordinals

When referring to objects in Sorted!, you must use ordinal numbers:

  • The first number
  • The twentyfifth logical operation
  • The twohundredandfirst condition

Go Implementation

This is a Go implementation of the Sorted! interpreter.

Installation

go install github.com/p-nand-q/sorted@latest

Or build from source:

git clone https://github.com/p-nand-q/sorted
cd sorted
go build -o sorted cmd/sorted/main.go

Usage

sorted program.sorted

With OPP preprocessing:

sorted -opp program.opp.sorted
sorted -D DEBUG program.sorted

Example: Hello World

This code uses the numbers Seventytwo, Onehundredandone, Onehundredandeight, Onehundredandeleven, Thirtytwo, Eightyseven, Onehundredandfourteen, and Ten.
This code does never go anywhere.
This code writes the first cell as a character, the second cell as a character, the third cell as a character, the third cell as a character, the fourth cell as a character, the fifth cell as a character, the sixth cell as a character, the fourth cell as a character, the seventh cell as a character, the third cell as a character, the third cell as a character, and the eighth cell as a character.
This code cannot read.
This code does not use any sums.
This code does not use any conditions.
This code does not use any labels.
This code does not use any ordered differences.
This code assigns the first number to the first cell, the second number to the second cell, the third number to the third cell, the fourth number to the fourth cell, the fifth number to the fifth cell, the sixth number to the sixth cell, the seventh number to the seventh cell, and the eighth number to the eighth cell.
This code does not use any products.
This code implements the first assignment, the second assignment, the third assignment, the fourth assignment, the fifth assignment, the sixth assignment, the seventh assignment, the eighth assignment, and the first output.
This code does not use any ratios.
This code does not use any logical operations.
Cool.

Philosophical Note

Remember: The excessive use of cardinals is sinful. Use them wisely and only once.

About

Sorted! - The winner of the Esoteric Language Awards of the year 2000

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •