Skip to content
This repository was archived by the owner on Nov 23, 2017. It is now read-only.

puffnfresh/roy

Folders and files

NameName
Last commit message
Last commit date
Jun 29, 2013
May 20, 2013
Oct 2, 2012
Apr 28, 2013
Jul 28, 2013
Dec 22, 2013
Sep 2, 2013
Jun 29, 2013
Apr 28, 2013
Jun 29, 2013
May 7, 2013
Aug 3, 2013
Jun 30, 2013
Nov 25, 2011
Jun 30, 2013
Jul 28, 2013
Aug 3, 2013
Oct 13, 2013
Jun 30, 2013

Repository files navigation

Roy Build Status

Roy is a small functional language that compiles to JavaScript. It has a few main features:

  • Damas-Hindley-Milner type inference
  • Whitespace significant syntax
  • Simple tagged unions
  • Pattern matching
  • Structural typing
  • Monad syntax
  • Not-horrible JS output

Usage

To compile:

make deps
make

To enter a REPL:

./roy

To compile and run a .roy file:

./roy -r examples/helloworld.roy

To compile a .roy file to .js:

./roy examples/helloworld.roy
cat examples/helloworld.js

Example

Input (test.roy):

let addTwo n =
    n + 2

console.log (addTwo 40)

Output (test.js):

var addTwo = function(n) {
    return n + 2;
}
console.log(addTwo(40))

Calling addTwo "test" will result in a compile-time error (addTwo can only take a Number).

See the examples directory for more.

License

MIT

Editor Support

Resources