Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Speaking as someone who has written a compiler before. Let me point you in the direction that you need to be going.

1. You are not going to do this in PERL, you will rot your brain and go through WAYYY more frustration than is necessary trying to do so. There is already a REALLY nice suite of tools for writing compilers in C. PERL isn't written in PERL ;-)
2. The first tool you will want to learn about is LEX. Lex generates lexical analyzers.
3. The second tool that you will want to learn to use is YACC (or Bison). Bison will allow you to form the proper grammars for your language, to write the semantic analyzer, and to allow you to generate intermediate code. Intermediate code will be one of the key factors in making your compiler cross platform. You might even consider bootstrapping whatever you write to GCC, so as to to make this system cross platform that way, it will save you a lot of headaches, as you will not have to re-release for every platform.
4. These 2 tools are generally used with C. They generate sources that can be linked to each other and to your own source.
5. If you don't know anything about grammars and automata, you can forget about writing a compiler. Read up on them.
6. A textbook that you might use to get yourself started is Compilers: Principals, Techniques, and Tools by Aho, Sethi, and Ullman.


Just Another Perl Backpacker

In reply to Re: The Perl Compiler (turning perl scripts into binary executables) by Nitsuj
in thread The Perl Compiler (turning perl scripts into binary executables) by crazyinsomniac

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (11)
    As of 2014-10-01 14:38 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      What is your favourite meta-syntactic variable name?














      Results (26 votes), past polls