With all of the threads about little languages, parsing and similar such, I was just thinking about a kind of parser generator. The idea features a pet theme of mine, use code to write code. It would work something more or less like the following.
- Create a quick and dirty spec to begin with.
- Write a herd of regexs to parse same.
- Test until reasonable satisfied.
- Wave magic wand, i.e. use magicstuff.pm or whatever to generate 'C' version of decompiled regexes.
- Create loadable modue from same
- Weave back into target language, repeat as needed.
Oddly enough, I think I've already written the decompiler part—odd becuase I wrote to generate automatic inline documentation for code that uses regexes enough to need explanation. It occured to me that if I can generate documentation, then I should also be able to generate code. There aren't that many templates needed and with a little tweaking, I could make it pretty much automagicall. Write the
XS,
Makefile.pl and the rest all based on a list of definitions.
So, what think you all?
–hsm
Come to think of it, it wouldn't have to be 'C', could be any language where the result could be linked back to Perl, could be optimized assembler—heh, heh!
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.