Skip to content

hexaredecimal/Llaml

 
 

Repository files navigation

Llaml

Why

I forked the "Roy" project because the original dev gave up and I would like to use it as a hands on learning tool for learning type inference and structural typing. I also would like to use it to learn how does a language like ocaml combine imperative concepts (Such as loops and references) while still being a functional language.

Features

  • No do block/Monads
  • Function currying (Default lazy evaluation)
  • Structural typing
  • Cli Improvements
  • Modules (Not as code blocks but as Files, like in ecmascript6+)
  • Proper error messages
  • Formatter/Pretty printer (WIP)
  • Include files
  • Pattern matching
  • Typed external functions
  • Annotations
  • Operator overloading
  • Mutability (Using References)
  • Custom stdlib
  • Build binaries (Using QuickJS as the runtime)
  • Let in expression

Example

open Std.Printf
open Std.List ((:), map, filter)
open Std.Pipe ((|>))

let main () = 
  1:2:3:4:5:[]
      |> map (\x -> x * 2)
      |> filter (\x -> x > 2)
      |> Printf.println

Building

Build Requirements

In the project to compile and run without issues please make sure the following are installed and available on your path.

  • NodeJS
  • QuickJS

Build Steps

Run the following steps in sequence

$ git clone https://github.com/hexaredecimal/Llaml.git
$ cd Llaml
$ npm install
$ make || make clean && make dist
$ ./llml help

Contributions

Contributions are welcome and be mindful that this is a fork of project that is greater than 12 years. The JS standard is so 2013 (using var, instead of let and const).

References and study material

Archived Roy - This repository was archived by the owner on Nov 23, 2017. It is now read-only.

Imperative to Functional Programming Succinctly

Functional Programming in OCaml

Learning F# by Designing Your Own Language by Oleksii Holub | JetBrains

Ask DeepWiki

Reference Projects

Reason ML

Ocaml

Sml

F#

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 96.5%
  • Vim Script 1.7%
  • Shell 1.2%
  • CSS 0.2%
  • Makefile 0.2%
  • Lua 0.1%
  • HTML 0.1%