codec-beam: Erlang VM byte code assembler

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain]

Erlang VM byte code assembler.


[Skip to ReadMe]

Properties

Versions0.1.0, 0.1.0, 0.1.1
Change logNone available
Dependenciesbase (>=4.8 && <5), bytestring (>=0.10.6), containers (>=0.5.6.2), text (>=1.2.2), zlib (>=0.6.1.1) [details]
LicenseBSD-3-Clause
Maintainerh.kofigumbs@gmail.com
CategoryLanguage, Codec
Home pagehttps://github.com/hkgumbs/codec-beam#readme
Bug trackerhttps://github.com/hkgumbs/codec-beam/issues
Source repositoryhead: git clone git://github.com/hkgumbs/codec-beam.git
UploadedFri Mar 16 08:45:39 UTC 2018 by hkgumbs

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees


Readme for codec-beam-0.1.0

[back to package description]

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:

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 1
      , func_info "tuple_of_one" 0
      , 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> test_module:tuple_of_one().
{1}

You can find an example project on GitHub.

Build

Use Stack:

stack build --test

Acknowledgements

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