GammaGames / Fif

A simple esolnag that allows near creative freedom in code contents

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fif

/fīf/

0101
five
deify plums
They play the war drum out of time

Fif is a stack based esoteric programming language that uses line lengths to perform operations, allowing two programs that read completely differently to execute the exact same process. The above snippet is just one of many you could write to read two numbers from input, add them, and print the result.

The length of each line is modulo divided with 32, meaning a line of length 2 and 34 will produce the same output. Every value is stored as an integer and characters are printed according to their unicode value.

While Fif is based on stacks, you can swap the stack type between FiFo and FiLo. You also have multiple stacks to work with and the power to move values between. New stacks are created with labels,

FiF currently supports only a subset of planned features

Commands:

I/O (helpers to read lines)

  • Length 1: print character - printed using ord(pop())
  • Length 2: print integer
  • Length 3: ?
  • Length 4: read line as integer
  • Length 5: read line as string

Flow (no call stack)

  • Length 6: label
  • Length 7: jump to label
  • Length 8: jump to label if zero
  • Length 9: jump to label if neg
  • Length 10: exit

Arithmetic (everything is int)

  • Length 11: add
  • Length 12: sub
  • Length 13: mul
  • Length 14: div
  • Length 15: mod

Container (Can have 2, Stack or Queue)

  • Length 16: push
  • Length 17: dup
  • Length 18: swap top 2
  • Length 19: pop
  • Length 20: change current to stack
  • Length 21: change current to queue
  • Length 22: change to stack with label
  • Length 23: ?
  • Length 24: dup from current, push to label
  • Length 25: pop from current, push to label

Examples:

A simple program that adds two numbers from input and prints it could look like so:

read
read
add them up
then output numbers in the console

You can find more examples in the tests folder.

Inspired by the great project Enjamb

About

A simple esolnag that allows near creative freedom in code contents

License:MIT License


Languages

Language:Python 100.0%