All Projects → kofigumbs → Codec Beam

kofigumbs / Codec Beam

Licence: other
Generate Erlang VM byte code from Haskell

Programming Languages

haskell
3896 projects
elixir
2628 projects
erlang
1774 projects
assembly
5116 projects

Projects that are alternatives of or similar to Codec Beam

Cranelift
Cranelift code generator
Stars: ✭ 2,485 (+1534.87%)
Mutual labels:  compiler, codegen
Lumen
An alternative BEAM implementation, designed for WebAssembly
Stars: ✭ 2,742 (+1703.95%)
Mutual labels:  compiler, beam
Redacted Compiler Plugin
A Kotlin compiler plugin that generates redacted toString() implementations.
Stars: ✭ 168 (+10.53%)
Mutual labels:  compiler, codegen
Lightbeam
Lightbeam has moved and now lives in the Wasmtime repository!
Stars: ✭ 253 (+66.45%)
Mutual labels:  compiler, codegen
Slang
SystemVerilog compiler and language services
Stars: ✭ 145 (-4.61%)
Mutual labels:  compiler
Glsl
GLSL parser for Rust
Stars: ✭ 145 (-4.61%)
Mutual labels:  compiler
Beef
Beef Programming Language
Stars: ✭ 1,877 (+1134.87%)
Mutual labels:  compiler
Gatsby Plugin Typegen
High-performance TypeScript/Flow code generation for GatsbyJS queries.
Stars: ✭ 144 (-5.26%)
Mutual labels:  codegen
Ebooks
A repository for ebooks, including C, C plus plus, Linux Kernel, Compiler, OS, Algorithm, Security, Database, Network, ML and DL
Stars: ✭ 151 (-0.66%)
Mutual labels:  compiler
Crust
C compiler toolchain in Rust. [WIP, early development stage]
Stars: ✭ 150 (-1.32%)
Mutual labels:  compiler
Glslang
Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.
Stars: ✭ 2,034 (+1238.16%)
Mutual labels:  compiler
Ispc
Intel SPMD Program Compiler
Stars: ✭ 1,924 (+1165.79%)
Mutual labels:  compiler
Typelang
🌳 A tiny language interpreter implemented purely in TypeScript's type-system
Stars: ✭ 149 (-1.97%)
Mutual labels:  compiler
Tasmocompiler
Web GUI for custom Tasmota compilation
Stars: ✭ 143 (-5.92%)
Mutual labels:  compiler
Xcassetpacker
A command line tool for converting a folder of images into an .xcasset package for Xcode
Stars: ✭ 150 (-1.32%)
Mutual labels:  codegen
Shaderc Rs
Rust bindings for the shaderc library.
Stars: ✭ 143 (-5.92%)
Mutual labels:  compiler
Swagger Vue
Swagger to JS & Vue & Axios Codegen
Stars: ✭ 146 (-3.95%)
Mutual labels:  codegen
Prom ex
An Elixir Prometheus metrics collection library built on top of Telemetry with accompanying Grafana dashboards
Stars: ✭ 149 (-1.97%)
Mutual labels:  beam
Finkel
Haskell in S-expression
Stars: ✭ 146 (-3.95%)
Mutual labels:  compiler
Assemblyscript
A TypeScript-like language for WebAssembly.
Stars: ✭ 13,152 (+8552.63%)
Mutual labels:  compiler

Build Status Erlant/OTP Release

NOTE: Participation is encouraged! Make issues, ask questions, submit pull requests (even if it’s your first time contributing to open-source — you’ll get lots of help), and give feedback!

Erlang VM byte code assembler for implementing compile-to-beam languages. The goal is to a provide delightful API for generating BEAM instructions from pure Haskell.

Usage

This example writes a simple module to a file:

{-# LANGUAGE OverloadedStrings #-}
module Main where
import qualified Data.ByteString.Lazy as LBS

import Codec.Beam.Instructions (func_info, label, move, return')
import qualified Codec.Beam as Beam

main :: IO ()
main =
  LBS.writeFile "test_module.beam" $
    Beam.encode "test_module"
      [ Beam.export "tuple_of_one" 0
      ]
      [ label (Beam.Label 1)
      , func_info "tuple_of_one" 0
      , label (Beam.Label 2)
      , move (Beam.Tuple [Beam.Integer 1]) (Beam.X 0)
      , return'
      ]

After you run that program, you can load the resulting module from the Erlang shell!

$ erl
1> l(test_module).
2> test_module:tuple_of_one().
{1}

You can find a small example on GitHub and a larger one in my elm-beam project.

Build

Use Stack:

stack build --test

Acknowledgements

Thanks to the following projects, which helped me understand the BEAM file format:

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