package minicaml

  1. Overview
  2. Docs
A simple, didactical, purely functional programming language

Install

Dune Dependency

Authors

Maintainers

Sources

minicaml-0.1.tbz
sha256=3bc47caea3757af7ec52cbc7ff99640328e580baa1a8721b0d034348f0e447ea
sha512=a6bca691f708a7399a5ae752eb491f1969f6ab3a10250c7711cdab65a66797a1d2832a2c52422e7621b7ac9b091f5111d059407b5069deeff9cac0b036bed26a

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

Published: 04 Dec 2019

README

minicaml

Leggi qui in italiano

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 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

  • Only boolean and integer types

  • Pretty color REPL showing every step made in evaluating a program

  • Only local declaration statements

  • 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
# compile
make
# 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. The REPL shows the AST equivalentof each submitted expression, and each reduction step in the evaluation is shown. It also signals syntactical and semantical errors.

Dev Dependencies

None

Used by

None

Conflicts

None

OCaml

Innovation. Community. Security.