Live data from Hacker News

Hammer: Parser Combinators for C

github.com

1–10 of 21 posts

Re: Hammer: Parser Combinators for C

#2
Hammer is a nifty parser combinator library from the people behind Language-Theoretic Security [1].

Their goal is to promote the use of context-free formats and protocols, to avoid falling into the trap of trying to parse recursively-enumerable languages, a problem that reduces to the halting problem. The idea is that by sticking to context-free grammars, protocols will be easier to parse, and the bulk of memory corruption errors can eliminated.

Meredith Patterson and Sergey Bratus gave an excellent talk on the subject at 28c3 [2], and they've put together a video series on using Hammer to build a secure parser for JSON RPC [3].

[1] http://langsec.org/

[2] https://www.youtube.com/watch?v=3kEfedtQVOY

[3] https://github.com/sergeybratus/HammerPrimer

Re: Hammer: Parser Combinators for C

#3

Hammer is a nifty parser combinator library from the people behind Language-Theoretic Security [1]. Their goal is to promote the use of context-free formats and protocols, to avoid falling into the trap of trying to parse recursively-enumerable languages, a problem that reduces to the halting problem. The idea is that by sticking to context-free grammars, protocols will be easier to parse, and the bulk of memory corr…

Their 28c3 talk is truly exceptional, and it's nearly enough to give one nightmares, or at the very least, it will give you the kind of haunting enduring doubts that most would rather not have. The part about HTML5+CSS3 being unintentionally turning complete still bothers me.

Re: Hammer: Parser Combinators for C

#4
post #3

Hammer is a nifty parser combinator library from the people behind Language-Theoretic Security [1]. Their goal is to promote the use of context-free formats and protocols, to avoid falling into the trap of trying to parse recursively-enumerable languages, a problem that reduces to the halting problem. The idea is that by sticking to context-free grammars, protocols will be easier to parse, and the bulk of memory corr…

Their 28c3 talk is truly exceptional, and it's nearly enough to give one nightmares, or at the very least, it will give you the kind of haunting enduring doubts that most would rather not have. The part about HTML5+CSS3 being unintentionally turning complete still bothers me.

Is there a video available of said talk?

Re: Hammer: Parser Combinators for C

#5
post #3

Earlier quoted context omitted.

Their 28c3 talk is truly exceptional, and it's nearly enough to give one nightmares, or at the very least, it will give you the kind of haunting enduring doubts that most would rather not have. The part about HTML5+CSS3 being unintentionally turning complete still bothers me.

Is there a video available of said talk?

Have a look at http://media.ccc.de/browse/congress/2011/

Re: Hammer: Parser Combinators for C

#6

Hammer is a nifty parser combinator library from the people behind Language-Theoretic Security [1]. Their goal is to promote the use of context-free formats and protocols, to avoid falling into the trap of trying to parse recursively-enumerable languages, a problem that reduces to the halting problem. The idea is that by sticking to context-free grammars, protocols will be easier to parse, and the bulk of memory corr…

What do you lose by sticking to context-free grammars?

Re: Hammer: Parser Combinators for C

#8

Hammer is a nifty parser combinator library from the people behind Language-Theoretic Security [1]. Their goal is to promote the use of context-free formats and protocols, to avoid falling into the trap of trying to parse recursively-enumerable languages, a problem that reduces to the halting problem. The idea is that by sticking to context-free grammars, protocols will be easier to parse, and the bulk of memory corr…

What do you lose by sticking to context-free grammars?

Ability to prefix fields by size. Which in turn means you can't preallocate buffers because you don't know the sizes in advance.

Re: Hammer: Parser Combinators for C

#9

Hammer is a nifty parser combinator library from the people behind Language-Theoretic Security [1]. Their goal is to promote the use of context-free formats and protocols, to avoid falling into the trap of trying to parse recursively-enumerable languages, a problem that reduces to the halting problem. The idea is that by sticking to context-free grammars, protocols will be easier to parse, and the bulk of memory corr…

What do you lose by sticking to context-free grammars?

As the name suggests you lose context, you can't "remember" anything you've seen in the token stream. So you can't really parse languages that use indentation. Although you can circumvent that by processing indentation in the lexer or inbetween lexer and parser.
Post reply on HN