An interpreted, two dimensional programming language.
Go to file
opfez 1ca487da77 license 2021-06-11 23:04:20 +02:00
examples add exitpoints 2021-05-29 00:13:50 +02:00
.gitignore add conditionals 2021-05-28 13:44:02 +02:00
Dirty.hs spitOut is promoted out of Dirty.hs! Congrats spitOut! 2021-05-31 19:41:51 +02:00
Element.hs add exitpoints 2021-05-29 00:13:50 +02:00
Main.hs spitOut is promoted out of Dirty.hs! Congrats spitOut! 2021-05-31 19:41:51 +02:00
Types.hs add exitpoints 2021-05-29 00:13:50 +02:00
UNLICENSE license 2021-06-11 23:04:20 +02:00
readme add documentation for X 2021-05-30 15:38:01 +02:00

readme

Factory is an interpreted programming language based on a two-dimensional grid.

# Building
ghc --make Main.hs -o factory

If you're on Arch Linux, you may get an error. In that case, try:
ghc -dynamic --make Main.hs -o factory

# Running
./factory [ file ]

# Symbol overview
 - E: The entrypoint. This is where the first element is spawned.
 - X: The exitpoint. If an element reaches a tile like this, the program will
      exit with the value of the element as the exit value.
 - >: Track going east.
 - v: Track going south.
 - <: Track going west.
 - ^: Track going north.
 - +: Increments the incoming element and spits it out (east).
 - -: Decrements the incoming element and spits it out (east).
 - D: Duplicates the incoming element and spits one copy out to the first track
      found starting east and going clockwise, and spits the other copy out to
      the second.
 - ?: If the incoming element's value is 0, spit the incoming element out to the
      first track found starting east and going clockwise. Otherwise, it is sput
      out to the second track found.

An example program looks like this:

E>?>+
^ v v
^<- v
 ^<<<

This example program can be found at examples/looping.fac

The element will spawn with a value of zero at E and be sput out to the first
track it finds, starting from east and going clockwise. It will hit the
conditional check, and continue going eastwards because the value of the element
is 0. It will hit the incrementing modifier, which will spit it out below. The
element will then follow the track until it comes back to the beginning.
However, this time it will go downwards at the conditional check and be
decremented for the next iteration. This turns into an infinite loop of
incrementing and decrementing the value of the element.