GithubHelp home page GithubHelp logo

rgrinberg / malfunction Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stedolan/malfunction

0.0 2.0 0.0 157 KB

Malfunctional Programming

License: Other

Shell 0.03% OCaml 99.48% Perl 6 0.49%

malfunction's Introduction

Malfunction is a high-performance, low-level untyped program representation, designed as a target for compilers of functional programming languages.

Malfunction is a revolting hack, exposing bits of the OCaml compiler's guts that were never meant to see the light of day.

"Hello, World" looks like this:

(module
  (_ (apply (global $Stdlib $print_string) "Hello, world!\n"))
  (export))

Malfunction requires OCaml (at least version 4.04.0, and you may see better performance with flambda enabled), which you should install using OPAM. Then, install malfunction using:

opam pin add malfunction git://github.com/stedolan/malfunction.git

You can then compile and run the above example with:

malfunction compile docs/helloworld.mlf -o hello
./hello

The syntax is based on s-expressions, and is designed to be easy to correctly generate, rather than to be particularly beautiful. For instance, there are no reserved words: all user-defined identifiers must be prefixed with $.

Files are compiled as OCaml modules, and may import values from OCaml (e.g. Pervasives.print_string in the example above) and export values to OCaml (using the export form). Modules written in malfunction may be combined with an mli file written in OCaml.

Malfunction makes no effort to check types. Typical programs do go wrong. Compilers targeting Malfunction need to convince themselves that their output won't go wrong, but don't need to explain their reasoning.

For more, read the spec, or the abstract submitted to the ML Workshop, or some examples

There's also an experimental backend for the dependently typed language Idris.

malfunction's People

Contributors

stedolan avatar xekoukou avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.