roy

Small functional language that compiles to JavaScript.

  • Owner: puffnfresh/roy
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

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

Main metrics

Overview
Name With Ownerpuffnfresh/roy
Primary LanguageJavaScript
Program languagePython (Language Count: 4)
Platform
License:MIT License
所有者活动
Created At2011-11-24 21:56:31
Pushed At2014-03-16 20:22:09
Last Commit At2013-12-22 12:12:37
Release Count7
Last Release Namev0.2.2 (Posted on 2013-06-29 18:54:46)
First Release Namev0.1.2 (Posted on )
用户参与
Stargazers Count840
Watchers Count46
Fork Count69
Commits Count508
Has Issues Enabled
Issues Count146
Issue Open Count62
Pull Requests Count48
Pull Requests Open Count2
Pull Requests Close Count10
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private