in reply to C compiler ... in Perl

It's certainly possible. But I don't think anyone tried. It seems like a lot of work without a very useful result.

Abigail

Replies are listed 'Best First'.
Re: Re: C compiler ... in Perl
by Anonymous Monk on Jan 06, 2004 at 00:40 UTC

    The knowledge that comes with writing a compiler seems to be a very useful result. Having a compiler written in a very high level language that allows more people to understand how compilers work seems like a very useful result. Starting a possibly successful large-scale project in Perl seems like a very useful result.

    Discouraging someone from doing something useful doesn't seem like a very useful result. So what's the point of your comment?

      So why not write a Java compiler? Or a brainfuck compiler? There are easier ways to learn about writing compilers. Writing yet another C compiler doesn't seem that useful even if you learn something about writing compilers. You want to see a compiler written in a high level language take a look at D.
      I agree completely. I've been toying off and on (lately on) with my own language that has a syntax between Perl and Lisp. It has scalars, lists and hashes.

      Writing the parser has been quite challenging. Figuring out how to create the parse tree, optimize it (constant folding, etc) has been good for keeping my skills sharp and looking at problems in a different light.

      Sure I could have started with a book on compilers and read up on lex and yacc, but solving it from the ground up, in my mind, has taught me a lot more than just following some book. Not to say there is anything wrong with that. When I get it to a more stable state, I'll probably do exactly that. Go back and see what was done right and what things I didn' figure out.

      -Lee

      "To be civilized is to deny one's nature."
Re: Re: C compiler ... in Perl
by rje (Deacon) on Apr 06, 2004 at 21:04 UTC
    A potential benefit could be that a C-compiler isn't necessary to compile Perl's C modules (kind of Escherlike, eh?). But of course there are freely available C compilers for most platforms (I had temporarily forgotten about the beauty of Cygwin), so oh well...