To translate one language into another, you need in general
to write a compiler. This involves lexing the text to get
tokens, parsing the tokens into an intermediate language
or syntax tree, and stepping through the tree to generate
the code for your new language.
In perl, lexing is easily taken care of using regexps.
People oftern turn to Parse::RecDescent for
parsing and conversion needs. If you have used Yacc or
Bison in the C world, this module should be very easy.
A necessary ingredient for this is a
VHDL grammar . The
grammar describes the structure of the language and will
handle things like multi-line statements automatically.
It is also possible to write your own parser, creating
a top-down structure in which each nonterminal in your
grammar is represented by a subroutine, but it is more
work and more error prone than using
Parse::RecDescent.
-Mark
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.