Giter Club home page Giter Club logo

hacking_erlang's Introduction

Hacking Erlang through preprocessing presentation for EUC 2009

The preprocessing step in Erlang code compilation is largely undocumented, but very powerful. The language can be extended to include custom guards, syntax and constructs. Included in the talk are the following:

  • Dynamic compilation with the erl_scan, erl_parse, epp and compile modules
  • Reverse engineering compiled BEAM code into forms
  • Preprocessing vs macros
  • The parse_transform compile directive and example usages like:
    • adding helper functions into modules that take advantage of record definitions that aren't available at runtime
    • performing data integrity checks by expanding custom guards into additional function clauses
  • Example usages of the custom_guards, dynamic_compile and excavator projects in production environments at EA

Breakdown of Erlang compilation steps

  • scan source file into tokens (erl_scan)
  • parse tokens into forms (erl_parse)
  • compile forms into byte code (compile)

The Abstract Format

parse_transform and custom_guards

example of manual compilation process and dynamic_compile module

  • dynamic logging in excavator and ejabberd
  • module level logging with log_roller

reverse engineering byte code

  • code:get_object_code/1, erl_pp
  • erlang_protobuffs

Meta programming

Making custom parsers with Yecc

  • LFE
  • Django Template Language

abstract code manipulation

  • recless
  • excavator

hacking_erlang's People

Watchers

James Cloos 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.