To parse Verilog, you can use
Hardware::Verilog::Parser.
I used this parser on a large Verilog library.
It worked, but it was a bit slow for my purposes.
Maybe someone else knows of a C or C++ parser
that is similar. Parsers are not generic
because they depend on the grammar of the
language being parsed.
If you store the code in a hash and want to
re-assemble it, you'll need some
way to get the code to come out in order,
since an ordinary perl hash doesn't preserve order.
Instead of an ordinary hash, use one of perl's object-oriented data structure modules.
The best module to choose for your task depends on
a lot of details, so please describe your problem
in more detail to get better advice on this.
It should work perfectly the first time! - toma
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.