I'm trying to make a little (well, now it grows big) hexeditor with perl, i'd like to add a function to edit some offsets of a file and i want this to be done by parsing a text file.

This is not interactive, it parse a file, or the command line, and can do two things: 1) Output a text file from a binary file 2) From the text file, it can patch an existing binary file/create a new file.

Although it is really easy to parse one line of the definition file, i'd like to use complex structures in them. I've read Jeffrey Goff's Parse::RecDescent Tutorial and few other ressources. I was wondering if someone already used that, and if he/she can give me a (example|link|whatever_to_start_with) on how it works, it looks a little weird for me...

It is generaly loaded with:[perl]use frhexedit; load($filename, \%file);[/perl] This code is too easy, for example, gif files can hold several images and i'd like to be able to express this with rules... I dont ask for someone to do my work, i just ask for a good starting point on parsing...

Btw, i just found this nothing to do with the stuff here, but it's funny...

I'm not really sure if this will help you, but I'm currently writing a Perl module that allows to parse C data structures and use them with Perl. In most cases, you'll find C implementations for most file formats (such as GIF, for example), and generally, C structures are a bit more expressive (at least in my opinion) than Perl pack strings. If you have some experience with C, I can give you a pre-alpha version of the module so you can have a look if it might be of any use for you.

If you're interested and want more information, just tell me!

-- mhx At last with an effort he spoke, and wondered to hear his own words, as if some other will was using his small voice. "I will take the Ring," he said, "though I do not know the way."

Well, for sure i would be interested , i cant promise i can do something on your project, but are you using parse::recdescent, or another pre-written parser, i dont feel i'm able to write a really complex parsing program in perl

Well, for sure i would be interested , i cant promise i can do something on your project,

If you don't mind, I'd like to send you the package to the email you've given in your profile (BTW, is the double f in the address correct?). I really don't want to attach it, because the .tar.gz is over 700k in size. If this is ok for you, I'll assemble a package today.

And by testing and using the package and giving me feedback you can surely help me to improve it!

Cheers,

-- mhx

PS: I've attached the manpage if you're curious... At last with an effort he spoke, and wondered to hear his own words, as if some other will was using his small voice. "I will take the Ring," he said, "though I do not know the way."

and generally, C structures are a bit more expressive (at least in my opinion) than Perl pack strings

That's right. Pretty cool actually.

Since I can't speak C that much, I don't know if this is already possible (or not). In VB, there is a pretty cool way of saving/getting a struct from a file. Is this also possible in C? I'm really missing that feature in Perl here!

Now i'm bad on this one, imagine, i had to write a script parser in vbscript... yarglahou! When a hash could do, i had to use if/else thingies coz nobody understood hashes... sometimes, i could kill myself, for sure!

I don't use VB that much anymore (just for simple GUI apps only) I've written a parser for HTML-color highlighting in Perl code. This parser is written in perl indeed.. I use that for my website online listings. Almost everything is colored correctly.

Can't imagine that would ever be working in VB or Java. Without regexps, code pointers and hashes? No Way!