ADDI

From Esolang
Jump to: navigation, search
I'm tired of all these motherfucking operators in all these motherfucking fixities!

Real Introduction

Sorry about that above, I just couldn't resist.

ADDI is a language that consists entirely of operator expressions to form its program. It is, really, just a series of semicolon-separated expressions that somehow form a program, maybe even a TC language. It was designed to be a different, but believable, language; one that could've arisen and come into common use in some other world.

Grammar

Note that whitespace is entirely ignored.

digit     ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;
bool      ::= "True" | "False" ;
num       ::= digit {digit} ["." digit {digit}] ;
str       ::= '"' ?escaped-string? '"';
name      ::= /[a-zA-Z_][a-zA-Z0-9_]*/ ;
op        ::= {!name & !num} ;

parenexp  ::= "(" exp ")" ;

tuple     ::= "(" [exp {exp ","}] ")" ;
list      ::= "[" [exp {exp ","}] "]" ;
set       ::= "{" [exp {exp ","}] "}" ;

container ::= tuple | list | set ;

exp       ::= parenexp | container | exp op exp | op exp | exp op | bool | num | name | {op} ;

line      ::= exp ";";

program   ::= {line}

English

An ADDI program consists of a number of lines separated by semicolons. Each line is an expression, with operators going left-to-right with no order of operations, except that parenthesized things go first. Operators can be prefix, postfix, infix, or nofix (nofix operators can be side-by-side, but must be enclosed in parentheses (even if alone)), with operators potentially having different meanings in different fixities. Expression operands are either variable names or (decimal) numbers, or they can be tuples, lists, or sets of the same.

Data Model

Because I like this data model so much, ADDI uses an infinite registry of Deques with an optional reader head for location and a single scalar accumulator. Deques can be of infinite length. Deques and the accumulator can hold various types of data: strings, integers, floats, arrays, other deques, or objects.

Operators

There are a lot of operators. Like, Unicode levels of operator. If there aren't as many operators as I'm leading you to believe, then I just haven't added them all yet. To cope with the sheer levels of operator, the operators are listed in a separate document over here: https://docs.google.com/document/d/1D1cuErbtcwEcvkjNi3_3yX3fXG2aiTs-kKxSLrJBxT8/edit#heading=h.vg1mj4co9znd

Special Variables

Some names are special. They have unique meanings that other variables do not have. These are:

  • out: A list that has all new items printed from it at the end of each cycle

Example Programs

Hello World

out < "Hello, World!";

Cat

True @ ((?)+(out<($)));