package minicaml

All checked builds pass
  1. Overview
  2. Docs
A simple, didactical, purely functional programming language

Install

dune-project
 Dependency

Authors

Maintainers

Sources

minicaml-0.3.1.tbz
sha256=eeceeb87713fef842ddb1b0d3c234d22a5d0b6edcd36b1fd12f5e57a27924a4d
sha512=c3942b7520062f1000e1d005b6c720d91b9eabb65952aaa04066297b04b5a3105f3547f0eeef51f1f90e9436be159918a110c7a292467bfba249df14b847b121

Description

A simple, didactical, purely functional programming language written for the programming 2 course at the University of Pisa, extended with a simple parser made with Menhir and ocamllex

Added to opam-repository:

README

https://travis-ci.org/0x0f0f0f/minicaml.svg?branch=master

minicaml

minicaml is a small, purely functional interpreted programming language with a didactical purpose. I wrote minicaml for the Programming 2 course at the University of Pisa, taught by Professors Gianluigi Ferrari and Francesca Levi. It is based on the teachers' minicaml, an evaluation example to show how interpreters work. It is an interpreted subset of Caml, with eager/lazy evaluation and only local (let-in) declaration statements. I have added a simple parser and lexer made with menhir and ocamllex (learn more). I have also added a simple REPL that show each reduction step that is done in evaluating an expression. I'd like to implement a simple compiler and abstract machine for this project.

minicaml only implements basic data types (integers and booleans) and will never be a full programming language intended for real world usage. minicaml's only purpose is to help students get a grasp of how interpreters and programming languages work.

Features

  • Show the AST of each expression
  • Easily choose between eager or lazy evaluation in your local definitions and functions by specifying lazyness using the let lazy statement.
  • A simple AST optimizer
  • Only boolean, list, unit and integer types (by now)
  • Pretty color REPL showing every step made in evaluating a program
  • Only local (optionally multiple) declaration statements
let x = 11 and y = 3 in x + y
  • Recursive functions and closures
  • ocamllex and menhir lexer and parser
  • Extendable with ease

Installation

I will release a binary file (no need to compile) in the near future. To install, you need to have opam (OCaml's package manager) and a recent OCaml distribution installed on your system. rlwrap is suggested for a readline-like (bash-like) keyboard interface.

# clone the repository
git clone https://github.com/0x0f0f0f/minicaml
# cd into it
cd minicaml
# install dependencies
opam install dune menhir ANSITerminal cmdliner alcotest bisect_ppx
# compile
make
# test
make test
# run
make run
# rlwrap is suggested
rlwrap make run
# you can install minicaml with
make install
# run again
rlwrap minicaml

Usage

Run make run to run a REPL. If the minicaml executable is ran with the flag -v, the REPL will show the AST equivalent of each submitted expression, and each reduction step in the evaluation will be shown. It also signals syntactical and semantical errors.

Dependencies (6)

  1. cmdliner < "2.0.0"
  2. ppx_deriving
  3. menhir
  4. ANSITerminal
  5. ocaml >= "4.05.0"
  6. dune >= "2.0"

Dev Dependencies (2)

  1. bisect_ppx with-test & >= "1.5.0"
  2. alcotest with-test & >= "0.8.5"

Optional Dependencies

None

Used by

None

Conflicts

None

Build status

Results of building minicaml with each compiler on check.ci.ocaml.org, run of against opam-repository 7cdc698. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
0.4 good n/a n/a n/a n/a
0.3.1 (this version) good good good good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure