Prakhar1989 JSJS Save

A strongly typed language for the web!

Project README

img

A strongly typed language for the web.

Syntax
val gcd = /\(a, b) => {
  if a == b then a
  else {
    if a > b
    then gcd((a - b), b)
    else gcd((b - a), a);
  };
};

print_num(gcd(12, 8));

// support for optional types
val pow = /\(base, exp) => {
  val aux = /\(accum, e): num => {
    if (e == 1) then accum
    else aux (accum * base, e - 1);
  };
  aux(base, exp);
};

val chess_squares = pow(8, 2);

print_string("Total number of squares on a chessboard: ");
print_num(chess_squares);

Install

  1. Install ocaml
  • For mac, using homebrew: brew install ocaml ocamlbuild opam
  1. Configure opam enviroment: opam init
  2. Install dependencies: opam install ocamlfind core menhir

Build

$ make clean
$ make

Compile

$ ./jsjs.out examples/list.jsjs
$ node out.js

Test

$ make test
$ make run-test
Open Source Agenda is not affiliated with "Prakhar1989 JSJS" Project. README Source: prakhar1989/JSJS
Stars
41
Open Issues
18
Last Commit
7 years ago
Repository
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating