Besides the aging and encrusted regex syntax, the pack/unpack syntax is also in need of updating. It needs to be extensible to our own types, in particular.
Well, anyone who's written a R-D parser by hand would recognise that the patterns feature described for Perl6 will not only replace the regex, but will do unpacking just fine, too! All we need are primitive rules for the items to read, that are binary rather than text. Then we have all the features of patterns and grammar, and can do things like put predicates between the items to grab, make choices, etc. It's exactly the same as a grammar eating string input. It's just a grammar eating groups of concecutive bytes, already possible to express using the stated primitives (e.g. read 4 u0 characters, take their ord's, and produce an int as the return value).
So, are we going to run with it, or come up with a new/different improved unpack() as well?
—John
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.