Wireshark-dev: Re: [Wireshark-dev] RFD: New language to write dissectors
From: Jakub Zawadzki <darkjames-ws@xxxxxxxxxxxx>
Date: Sun, 15 Jul 2012 11:20:45 +0200
On Sun, Jul 15, 2012 at 10:28:23AM +0100, Tyson Key wrote:
> What about implementing a compiler that generates C dissector source code,
> from NPLt m, or WSGD dissector code? 

Yes, I plan to have one:

> > But anyway we need compiler to C. For prototype (does it work?) and later
> > as fallback for people who don't have LLVM.

> Or would that be overkill for what we're trying to do?

It depends what we're trying to do ;-)

For me compiler to C is must-have, and even if we write only it.
It'll help to fix some bugs, like yours bug #6520.
Translating 4K lines of NPL code to C looks stupid to me, and it'll be great to have
automatic translator.
(of course if we base grammar on NPL).

Later we could support interpreting (or JIT) NPL, which would make
easier (and much faster) developing new dissectors.

In next step we could generate dependency graph (field foo.B exists only
when field foo.A = 5, etc...) and field to offset (field foo.A @ 10B, field foo.B @ 20B)
or other informations which would speedup filtering.

(Or generate completely new code like Guy suggested).

and here we can start rewriting existsing old dissectors to new language.

Anyway, Lot of possible work, which some might be seen as overkill ;-)