Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

deanveloper/alchemist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alchemist

Alchemist is a non-deterministic programming language based on chemical reaction networks. More information here. This implementation is written in Go, the original implementation can be found here. I would suggest reading the original implementation's README to learn about how this particular language works.

This particular implementation has an API, so it can be executed from other Go code. The documentation can be found here.

Feature List

  • Working API
  • CLI app to run Alchemy files
  • Write tests

CLI Installation

Make sure you have Go installed, and run the following commands:

go get github.com/deanveloper/alchemist/cmd
mv ~/go/bin/cmd ~/go/bin/alchemist

And make sure you have ~/go/bin added to your PATH.

CLI Usage

Usage: ./alchemist [flags]
Flags:
  -i string
        input file to read rules from
  -r string
        rules to execute with, overrides -i
  -u string
        universe of atoms to start with
Examples of rule sets:

Hello world

_->Out_"Hello, World!"

Hello world (using ! to determine input universe)

x->Out_"Hello, World!"!x

Countdown

_->5x
x->Out_x
0x->Out_"Liftoff"

Adder

_ -> a+reqX+Out_"Input 1:"+In_x+Out_"Input 2:"+In_y
x -> z
y -> z
a+0x+0y -> Out_z

Fibonacci

_ -> Out_"Enter how many numbers you wanna see:"+In_loop+b+setNext+Out_""+Out_"Fibonacci:"+Out_a+Out_b

loop+a+setNext -> loop+next+setNext
loop+b+setNext -> loop+next+setNext+saveB
loop+0a+0b+setNext -> Out_next+setA

loop+setA+saveB -> loop+setA+a
loop+setA+0saveB -> loop+setB

loop+setB+next -> loop+setB+b
loop+setB+0next -> loop+setNext