Deadfish i

From Esolang
Jump to: navigation, search

The Deadfish i language is an object-oriented version of Deadfish with a BF-like syntax, created by Abraham Karplus. A Deadfish i file (extension .dfi) is a sequence of object declarations. Note that this improved version does not restrict unsquared values to one byte.

Naming

A lot of child languages take the name of their parent and add "++". However, the Deadfish family uses the "i" command to increment. Hence, "Deadfish i".

Alphabet

The Deadfish i alphabet is much like the BF one, with a few differences:

  • No , command: Deadfish i does not support input.
  • The # character start a comment that goes to the end of the line.
  • Unknown character are errors, not ignored.

Object declaration

An object is declared with the syntax

name<method

where name is a positive integer or 0 and method is a sequence of Deadfish i commands.

Commands

Command Name Pseudocode
+ Increment self.val += 1
- Decrement self.val -= 1
> Square self.val **= 2
[x Call (static) x.method()
] Call (dynamic) self.val.method()
. Output print(self.val)

Calling

A static call [ is followed by a positive integer. The method of the object with that number is called.

A dynamic call is a plain ]. It calls the method of the object n, where n is the value of the object using the dynamic call command. The value must be positive.

Beginning

The program is begun by an implicit call to

0.method()

Examples

Prints "1":

0<+.

Infinite loop (requires two objects since 0 cannot be re-called):

0<[1
1<+.[1

External resources

  • Perl and Röda implementations based on one interpretation of language semantics. They can evaluate the example programs. I (implementor of the interpreters) have listed some thoughts about the semantics on the Goldfish page.