Skip to content
This repository has been archived by the owner. It is now read-only.
Small functional language that compiles to JavaScript.
Branch: master
Clone or download
puffnfresh Merge pull request #203 from jameshfisher/empty-file-treated-as-missing
Empty file should not be treated as missing
Latest commit fa63f3b Dec 22, 2013
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs/guide
examples Remove macros - not a good implementation May 20, 2013
lib
misc Closes #150. Apr 28, 2013
site
src Empty file should not be treated as missing Dec 22, 2013
test Add some basic type parser tests Sep 2, 2013
.gitignore Update package.json for Jison now being a Grunt task Jun 29, 2013
.gitmodules
.npmignore Update package.json for Jison now being a Grunt task Jun 29, 2013
.travis.yml
AUTHORS Added rtfeldman to AUTHORS file. Aug 3, 2013
CHANGELOG.md Added CHANGELOG. Jun 30, 2013
LICENSE Update README with links and LICENSE Nov 25, 2011
Makefile Remove rigger and use commonjs-everywhere for browser bundling Jun 30, 2013
README.md Updated readme and site with editor info. Closes #2. Jul 28, 2013
grunt.js Enable jshint. Fixes #190 Aug 3, 2013
package.json Update underscore to 1.5.2, change test after _.max to -Infinity. Oct 13, 2013
roy Remove rigger and use commonjs-everywhere for browser bundling Jun 30, 2013

README.md

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

You can’t perform that action at this time.