Skip to content

Implementation of the FRACTRAN programming language in Go.

License

Notifications You must be signed in to change notification settings

jgalilee/fractran

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FRACTRAN

GoDoc

Implementation of John Conway's esoteric FRACTRAN programming language in Go.

Installation

# go get github.com/jgalilee/fractran
# go install github.com/jgalilee/fractran

Example

Source file primes.ft. The grammar currently disallows white space or new lines.

17/91,78/85,19/51,23/38,29/33,77/29,95/23,77/19,1/17,11/13,13/11,15/14,15/2,55/1

Usage depends on whether there is a piped file. There is either one or two args depending. The last argument is the initial value of n.

The following two commands are equivalent.

# cat eg/primes.ft | fractran 2
# fractran eg/primes.ft 2

Use in Go programs

The internal package github.com/jgalilee/fractran/lang exposes two types the Program type and the Parser type. The Parser type only accepts the highly simplistic grammar as shown in the example.

Licence

The MIT License (MIT)

Copyright (c) 2015 Jack Galilee

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

About

Implementation of the FRACTRAN programming language in Go.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages