All Projects → grin-compiler → Grin

grin-compiler / Grin

GRIN is a compiler back-end for lazy and strict functional languages with whole program optimization support.

Programming Languages

haskell
3896 projects

Projects that are alternatives of or similar to Grin

Faust
Functional programming language for signal processing and sound synthesis
Stars: ✭ 1,360 (+63.07%)
Mutual labels:  compiler, llvm, functional-programming
Cfl
a Compileable statically typed Functional programming Language
Stars: ✭ 7 (-99.16%)
Mutual labels:  compiler, llvm, functional-programming
Scala Native
Your favorite language gets closer to bare metal.
Stars: ✭ 4,053 (+385.97%)
Mutual labels:  compiler, llvm
Enzyme
High-performance automatic differentiation of LLVM.
Stars: ✭ 418 (-49.88%)
Mutual labels:  compiler, llvm
Felix
The Felix Programming Language
Stars: ✭ 609 (-26.98%)
Mutual labels:  compiler, functional-programming
Sericum
(Toy) Compiler Infrastructure influenced by LLVM written in Rust
Stars: ✭ 366 (-56.12%)
Mutual labels:  compiler, llvm
Nlvm
LLVM-based compiler for the Nim language
Stars: ✭ 380 (-54.44%)
Mutual labels:  compiler, llvm
Langcraft
Compiler from LLVM IR to Minecraft datapacks.
Stars: ✭ 495 (-40.65%)
Mutual labels:  compiler, llvm
Speedy.js
Accelerate JavaScript Applications by Compiling to WebAssembly
Stars: ✭ 300 (-64.03%)
Mutual labels:  compiler, llvm
Llvmswift
A Swift wrapper for the LLVM C API (version 9.0.1)
Stars: ✭ 641 (-23.14%)
Mutual labels:  compiler, llvm
Clio
Clio is a functional, parallel, distributed programming language.
Stars: ✭ 555 (-33.45%)
Mutual labels:  compiler, functional-programming
Gocaml
🐫 Practical statically typed functional programming language implementation with Go and LLVM
Stars: ✭ 653 (-21.7%)
Mutual labels:  compiler, llvm
Bfc
An industrial-grade brainfuck compiler
Stars: ✭ 340 (-59.23%)
Mutual labels:  compiler, llvm
Staticscript
🎉🎉🎉 A new statically typed programming language, syntactically like TypeScript.
Stars: ✭ 337 (-59.59%)
Mutual labels:  compiler, llvm
Bytecoder
Rich Domain Model for JVM Bytecode and Framework to interpret and transpile it.
Stars: ✭ 401 (-51.92%)
Mutual labels:  compiler, llvm
Soll
SOLL is a new compiler for generate Ewasm from solidity and yul. See a demo here: https://asciinema.org/a/ezJqNLicn5fya02zwu4VXIo8a
Stars: ✭ 329 (-60.55%)
Mutual labels:  compiler, llvm
Groovy
Apache Groovy: A powerful multi-faceted programming language for the JVM platform
Stars: ✭ 4,359 (+422.66%)
Mutual labels:  compiler, functional-programming
Ring
Innovative and practical general-purpose multi-paradigm language
Stars: ✭ 716 (-14.15%)
Mutual labels:  compiler, functional-programming
Deepc
vendor independent deep learning library, compiler and inference framework microcomputers and micro-controllers
Stars: ✭ 260 (-68.82%)
Mutual labels:  compiler, llvm
Write You A Haskell
Building a modern functional compiler from first principles. (http://dev.stephendiehl.com/fun/)
Stars: ✭ 3,064 (+267.39%)
Mutual labels:  compiler, functional-programming

GRIN

Build Status Coverage Status Gitter chat

The name GRIN is short for Graph Reduction Intermediate Notation, and it is an intermediate language for graph reduction. GRIN is the optimizer and code generator component of the GRIN Compiler project which includes language frontends for Haskell, Idris and Agda. To get the big picture of the project check the project website. For an overview of the optimizer read The GRIN Project paper. To grasp the details take your time and read Urban Boquist's PhD thesis on Code Optimisation Techniques for Lazy Functional Languages .

We presented the core ideas of GRIN at Haskell Exchange 2018. slides video
The Next-gen Haskell Compilation Techniques (2021) presentation gives a high-level overview of the project motivation. slides video

Read our paper A modern look at GRIN, an optimizing functional language back end (2019) to get an overview of GRIN related projects and other whole program compilers i.e. Boquist GRIN, UHC, JHC, LHC, HRC, MLton

Also check the GRIN transformation example from Boquist PhD and an example from our implementation.

Support

The project is supported by these awesome backers. Special thanks to our gold sponsors:

Sam Griffin

Holmusk logo

If you'd like to join them, please consider become a backer or sponsor on Patreon.

GRIN IR

Showcase

Setup

Installing LLVM

Homebrew

Example using Homebrew on macOS:

$ brew install llvm-hs/llvm/llvm-7

Debian/Ubuntu

For Debian/Ubuntu based Linux distributions, the LLVM.org website provides binary distribution packages. Check apt.llvm.org for instructions for adding the correct package database for your OS version, and then:

$ apt-get install llvm-7-dev

Nix

To get a nix shell with all the required dependencies do the following in the top level folder.

nix-shell

To run the example do the following from the top level folder.

(cd grin; cabal run grin -- grin/opt-stages-high-level/stage-00.grin)

To run a local Hoogle server with Haskell documentation do the following.

hoogle server --port 8087 1>/dev/null 2>/dev/null&

Build GRIN

stack setup
stack build

Usage

stack exec -- grin grin/grin/opt-stages-high-level/stage-00.grin

How to Contribute

See: Issues / Tasks for new contributors Keep it simple: We follow the fundamentals laid down in HaskellerZ - Feb 2018 - Getting things done in Haskell

Example Front-End

Read about how to generate GRIN code from a frontend language.

Also check the corresponding source code.

i.e.

Simplifying Transformations

Transformation Schema
vectorisation

source code:
Vectorisation2.hs
case simplification

source code:
CaseSimplification.hs
split fetch operation

source code:
SplitFetch.hs
right hoist fetch operation

source code:
RightHoistFetch2.hs
register introduction

source code:
RegisterIntroduction.hs

Optimising Transformations

Transformation Schema
evaluated case elimination

source code:
EvaluatedCaseElimination.hs

test:
EvaluatedCaseEliminationSpec.hs
trivial case elimination

source code:
TrivialCaseElimination.hs

test:
TrivialCaseEliminationSpec.hs
sparse case optimisation

source code:
SparseCaseOptimisation.hs

test:
SparseCaseOptimisationSpec.hs
update elimination

source code:
UpdateElimination.hs

test:
UpdateEliminationSpec.hs
copy propagation

source code:
CopyPropagation.hs

test:
CopyPropagationSpec.hs
late inlining

source code:
Inlining.hs

test:
InliningSpec.hs
generalised unboxing

source code:
GeneralizedUnboxing.hs

test:
GeneralizedUnboxingSpec.hs
arity raising

source code:
ArityRaising.hs

test:
ArityRaisingSpec.hs
case copy propagation

source code:
CaseCopyPropagation.hs

test:
CaseCopyPropagationSpec.hs
case hoisting

source code:
CaseHoisting.hs

test:
CaseHoistingSpec.hs
whnf update elimination

source code:
TODO

test:
TODO
common sub-expression elimination

source code:
CSE.hs

test:
CSESpec.hs
constant propagation

source code:
ConstantPropagation.hs

test:
ConstantPropagationSpec.hs
dead function elimination

source code:
SimpleDeadFunctionElimination.hs

test:
SimpleDeadFunctionEliminationSpec.hs
dead variable elimination

source code:
SimpleDeadVariableElimination.hs

test:
SimpleDeadVariableEliminationSpec.hs
dead parameter elimination

source code:
SimpleDeadParameterElimination.hs

test:
SimpleDeadParameterEliminationSpec.hs
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].