Cellang

The system consists of a compiler for the Cellang cellular automata programming language, along with the corresponding documentation, viewer, and various tools. Cellang has been undergoing refinement for the last several years, with corresponding upgrades to the compiler...

The most important distinguishing features of Cellang, include support for:

  • named constants...
  • any number of dimensions
  • compile time specification of each dimension's size
  • cell neighborhoods of any size (though bounded at compile time) and shape
  • positional and time dependent neighborhoods
...

Well, I did ask for a DSL for cellular automata. Here's one...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Exercise

The exercise is to take this language and implement it using your language of choice (you can play around with the syntax, if you want).

The idea is that we eliminate the language design phase, to see which language is best suited for implementing a small DSL.

I put my money on Scheme (macros) or Haskell (combinators).

CA Embedded DSL in Haskell

Here's my take of a simplified EDSL for cellular automata simulations in Haskell. Compare the Cellang version of Life...

sum := [0, 1] + [1, 1] + [1, 0] + [-1, 1] + [-1, 0] + 
       [-1, -1] + [0, -1] + [1, -1]

cell := 1 when (sum = 2 & cell = 1) | sum = 3
      := 0 otherwise

...with...

lsum = at (-1, 1) + at (0, 1) + at (1, 1) +
       at (-1, 0) +             at (1, 0) +
       at (-1,-1) + at (0,-1) + at (1,-1)

life = if_ (lsum .== 2 .&& at (0,0) .== 1 .|| lsum .== 3) 1 0

Nice!

Nice!

working archive found

The site referenced in the article has long expired. A working link was relayed to me.


http://zooland.alife.org/download/packages/cellang/

Thanks. I need this

Thanks. I need this link...

I notice nobody posted solutions to my challenge. That's a shame.

Invalid file?

I tried downloading the file a couple of times and I seem to always get an error...

$ gzip -d cellular.tar.gz 

gzip: cellular.tar.gz: invalid compressed data--crc error

gzip: cellular.tar.gz: invalid compressed data--length error

Another found...

After some digging I found another copy of the archive. It wasn't really in a spot I expect to be around forever so I went ahead and gave it a home. You can find it now at...


http://zhar.net/howto/homeless/cellular/