https://github.com/prakhar1989/jsjs
A strongly typed language for the web!
https://github.com/prakhar1989/jsjs
compilers ocaml programming-language typed-language
Last synced: 5 months ago
JSON representation
A strongly typed language for the web!
- Host: GitHub
- URL: https://github.com/prakhar1989/jsjs
- Owner: prakhar1989
- License: mit
- Created: 2016-01-23T04:11:42.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-05-17T00:30:50.000Z (over 9 years ago)
- Last Synced: 2025-06-21T16:08:51.107Z (7 months ago)
- Topics: compilers, ocaml, programming-language, typed-language
- Language: OCaml
- Homepage: http://jsjs-lang.org
- Size: 3.55 MB
- Stars: 40
- Watchers: 7
- Forks: 5
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 
> A strongly typed language for the web.
##### Syntax
```scala
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`
2. Configure opam enviroment: `opam init`
3. Install dependencies: `opam install ocamlfind core menhir`
#### Build
```shell
$ make clean
$ make
```
#### Compile
```shell
$ ./jsjs.out examples/list.jsjs
$ node out.js
```
#### Test
```shell
$ make test
$ make run-test
```