No description
Find a file
2013-02-17 15:47:18 +01:00
docs Slides from the Berlinsides/SkyTalks Hammer talk 2012-08-28 13:29:24 -04:00
examples fix linking of base64 example 2013-02-17 15:47:18 +01:00
lib Fixed a bug in hush 2012-05-26 13:13:56 +02:00
src Merge branch 'glue' into base64-example 2013-02-17 15:26:15 +01:00
.gitignore Merge branch 'master' of https://github.com/abiggerhammer/hammer 2012-10-08 18:20:34 +02:00
common.mk Refactored tests; make just builds library, make test builds/runs tests 2012-11-13 22:29:25 -05:00
config.mk Refactored tests; make just builds library, make test builds/runs tests 2012-11-13 22:29:25 -05:00
Doxyfile Tweaked docs 2012-11-13 22:42:25 -05:00
HACKING Tweaked docs 2012-11-13 22:42:25 -05:00
LICENSE Licensing under GPL v2. 2012-04-23 00:02:42 +01:00
Makefile Now builds without glib 2012-10-10 16:45:10 +02:00
NOTES Added benchmark skeleton, and at least stubs for all of the necessary functions 2012-11-02 17:16:53 -04:00
README.md doc isn't actually a target yet 2012-11-13 22:54:10 -05:00
TODO Added benchmark skeleton, and at least stubs for all of the necessary functions 2012-11-02 17:16:53 -04:00

Hammer is a parsing library. Like many modern parsing libraries, it provides a parser combinator interface for writing grammars as inline domain-specific languages, but Hammer also provides a variety of parsing backends. It's also bit-oriented rather than character-oriented, making it ideal for parsing binary data such as images, network packets, audio, and executables.

Hammer is written in C, but will provide bindings for other languages. If you don't see a language you're interested in on the list, just ask.

Hammer currently builds under Linux. (Windows and OSX are coming.)

Features

  • Bit-oriented -- grammars can include single-bit flags or multi-bit constructs that span character boundaries, with no hassle
  • Thread-safe, reentrant
  • Benchmarking for parsing backends -- determine empirically which backend will be most time-efficient for your grammar
  • Parsing backends:
    • Packrat parsing
    • LL(k) (not yet implemented)
    • GLR (not yet implemented)
    • LALR(8) (not yet implemented)
    • Regular expressions (not yet implemented)
  • Language bindings: (not yet implemented)
    • C++
    • Java
    • Python
    • Ruby
    • Perl
    • Go
    • PHP
    • .NET

Installing

Prerequisites

  • make

Optional Dependencies

  • pkg-config (for make test)
  • glib-2.0 (>= 2.29) (for make test)
  • glib-2.0-dev (for make test)

To install, type make. To run the built-in test suite, type make test.

There is not currently a make install target; to make Hammer available system-wide, copy libhammer.a to /usr/lib/ (or /usr/local/lib/, or wherever ld will find it) and hammer.h to /usr/include/.

Usage

Just #include <hammer.h> and link with -lhammer.

Examples

The examples/ directory contains some simple examples, currently including:

  • base64
  • DNS