All Projects → kellino → microML

kellino / microML

Licence: other
a simple functional language for learners

Programming Languages

haskell
3896 projects
Vim Script
2826 projects
shell
77523 projects

microML

UPDATE

At the moment I simply have no time to work on this, or to fix the many, many, many problems and dreadful code scattered throughout the project. This was my first attempt at writing anything real in Haskell, and I'm sad to say it's pretty obvious. Please regard this as an interesting curiosity only! Do not attempt to use!!!

for UCL MSc Computer Science.

microML is a simple functional programming language designed for the BBC micro:bit microcomputer. It is essentially a lisp, with a bit of ml style sugar on the syntax.

This is still under active development so please don't try to use it yet! However, if you really really want, there is a repl you can use for a quick feel of the language.

Work in progress

Here's a quick overview of the syntax:

Declarations (simple and recursive) are introduced with a let

microML ⊦ let x = 5
microML ⊦ 5 : Number
microML ⊦ let incBy1 x = x + 1
microML ⊦ :type inc
microML ⊦ inc : Number -> Number

or

microML ⊦ let incBy1 = \x -> x + 1
microML ⊦ incBy1 2
microML ⊦ 3 : Number

More complex things can be entered at the repl as well (at the moment everything must be on one line)

microML ⊦ let compose x y = \z -> x (y z)
microML ⊦ compose inc inc 2
microML ⊦ 4 : Number

microML ⊦ let fact n = if n == 0 then 1 else n * (fact (n-1))
microML ⊦ fact 5
microML ⊦ 120 : Number

TODO

My first attempt at writing anything more than an individual function in Haskell... and it shows it. Lots of good stuff here, but also a lot that needs to be rewritten when there's the time now that I understand a bit more about how to do things.

  • Working on type inference at the moment...
  • Compiler to C++ (for the micro:bit)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].