All Projects → malgo-lang → malgo

malgo-lang / malgo

Licence: BSD-3-Clause license
A statically typed functional programming language.

Programming Languages

haskell
3896 projects
shell
77523 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to malgo

Compiler-written-in-Haskell
A Turing complete language 😉
Stars: ✭ 31 (-16.22%)
Mutual labels:  llvm
LLVM-Metadata-Visualizer
LLVM Metadata Visualizer
Stars: ✭ 20 (-45.95%)
Mutual labels:  llvm
lsif-clang
Language Server Indexing Format (LSIF) generator for C, C++ and Objective C
Stars: ✭ 28 (-24.32%)
Mutual labels:  llvm
heyoka
C++ library for ODE integration via Taylor's method and LLVM
Stars: ✭ 151 (+308.11%)
Mutual labels:  llvm
jingle
🔔 Jingle is a dynamically-typed, multi-paradigm programming language designed for humans and machines.
Stars: ✭ 34 (-8.11%)
Mutual labels:  llvm
curly-lang-legacy
Curly programming language
Stars: ✭ 16 (-56.76%)
Mutual labels:  functional-language
yantra
JavaScript Engine for .NET Standard
Stars: ✭ 32 (-13.51%)
Mutual labels:  functional-language
wasm-toolchain
WebAssembly toolchain
Stars: ✭ 34 (-8.11%)
Mutual labels:  llvm
TinyCompiler
c compiler based on flex(lex), bison(yacc) and LLVM, supports LLVM IR and obj code generation. 基于flex,bison以及LLVM,使用c++11实现的类C语法编译器, 支持生成中间代码及可执行文件.
Stars: ✭ 162 (+337.84%)
Mutual labels:  llvm
stack-guard
A toy implementation of 'Stack Guard' on top of the LLVM compiler toolchain
Stars: ✭ 21 (-43.24%)
Mutual labels:  llvm
opencilk-project
Monorepo for the OpenCilk compiler, forked from llvm/llvm-project. See the OpenCilk/infrastructure repository for build and installation instructions.
Stars: ✭ 42 (+13.51%)
Mutual labels:  llvm
m2lang
The LLVM-based Modula-2 compiler
Stars: ✭ 29 (-21.62%)
Mutual labels:  llvm
clam
Static Analyzer for LLVM bitcode based on Abstract Interpretation
Stars: ✭ 180 (+386.49%)
Mutual labels:  llvm
aWsm
WebAssembly ahead-of-time compiler and runtime. Focuses on generating fast code, simplicity, and portability.
Stars: ✭ 177 (+378.38%)
Mutual labels:  llvm
dmjit
.dmJIT is a Rust-based JIT compiler using modified auxtools, dmasm and Inkwell LLVM wrapper for boosting Byond DM performance without any hassle! (formerly known as dm-jitaux)
Stars: ✭ 18 (-51.35%)
Mutual labels:  llvm
dr checker 4 linux
Port of "DR.CHECKER : A Soundy Vulnerability Detection Tool for Linux Kernel Drivers" to Clang/LLVM 10 and Linux Kernel
Stars: ✭ 34 (-8.11%)
Mutual labels:  llvm
chimera
🐍 A CLI tool for generating Boost.Python/pybind11 bindings from C/C++
Stars: ✭ 12 (-67.57%)
Mutual labels:  llvm
ugo-compiler-book
📚 µGo语言实现(从头开发一个迷你Go语言编译器)[Go版本+Rust版本]
Stars: ✭ 996 (+2591.89%)
Mutual labels:  llvm
glottie
OpenGL/WebGL based Lottie animation player
Stars: ✭ 60 (+62.16%)
Mutual labels:  llvm
jitmap
LLVM-jitted bitmaps
Stars: ✭ 25 (-32.43%)
Mutual labels:  llvm

malgo

Malgo CI

A statically typed functional programming language.

Requirement

Installation

Installing LLVM

Homebrew

$ brew install llvm-hs/llvm/llvm-12

Debian/Ubuntu

$ apt-get install llvm-9-dev

Installing Malgo

$ git clone https://github.com/malgo-lang/malgo
$ cd malgo
$ stack install
$ ./scripts/install_malgo_internal.sh

Usage

$ ./scripts/compile.sh examples/malgo/Hello.mlg
$ ./Hello
Hello, world

Examples

Hello, world

module Hello = {
  module {..} = import Builtin;
  module {..} = import Prelude;

  main = {
    putStrLn "Hello, world!"
  };
}

Fibonacci number

module Fib = {
  module {..} = import Builtin;
  module {..} = import Prelude;

  infix 4 (<=);
  (<=) = { x y -> leInt32 x y };

  infixl 6 (+);
  (+) = { x y -> addInt32 x y };

  infixl 6 (-);
  (-) = { x y -> subInt32 x y };

  fib = { n ->
    if (n <= 1)
      { 1 }
      { fib (n - 1) + fib (n - 2) }
  };

  main = {
    fib 5 |> toStringInt32 |> putStrLn
  };
}

List operations

module List = {
  module {..} = import Builtin;
  module {..} = import Prelude;

  infix 4 (<=);
  (<=) : Int32 -> Int32 -> Bool;
  (<=) = {x y -> leInt32 x y};

  infixl 6 (+);
  (+) : Int32 -> Int32 -> Int32;
  (+) = {x y -> addInt32 x y};

  infixl 6 (-);
  (-) : Int32 -> Int32 -> Int32;
  (-) = {x y -> subInt32 x y};

  map : (a -> b) -> List a -> List b;
  map = { _ Nil -> Nil
        | f (Cons x xs) -> Cons (f x) (map f xs)
        };

  sum : List Int32 -> Int32;
  sum = { Nil -> 0
        | Cons x xs -> x + sum xs
        };

  -- [0 .. n]
  below : Int32 -> List Int32;
  below = { n ->
    if (n <= 0)
       { [0] }
       { Cons n (below (n - 1)) }
  };

  main = {
      sum (map (addInt32 1) (below 10))
        |> toStringInt32
        |> putStrLn
  };
}

Lisp interpreter

https://github.com/malgo-lang/minilisp

TODO

Malgo タスクリスト - 星にゃーんのScrapbox

Compilation issue on macOS

In my case, stack build says:

llvm-hs> error: dyld[89679]: Library not loaded: @rpath/libc++abi.1.dylib
llvm-hs>   Referenced from: /usr/local/Cellar/llvm-12/12_2/lib/llvm-12/lib/libc++.1.0.dylib
llvm-hs>   Reason: tried: '/usr/local/lib/libc++abi.1.dylib' (no such file), '/usr/lib/libc++abi.1.dylib' (no such file)

I don't know exactly what caused this. However, I was able to solve it with ln -s /usr/local/lib/libc++abi.1.dylib /usr/local/Cellar/llvm-12/12/12_2/lib/llvm-12/lib/lib/libc++.1.0.dylib.

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