Any compiler (ADA, C, PASCAL) written in Java

Hello,
I am looking for any compiler's source-code (ADA, C, PASCAL, etc.) that was written in Java.
Can you help me?
Thank you

Comments

  • I don't think any commercially available compilers are written in Java. Since Java is quite new and most compiler paradigms quite old... Since Java is platform-independent and compilers are (very) platform-dependent...
    But I once thought of using Java as a language for a compiler since it takes care of the most boring parts (I/O, the whole tokenizer part, Hash tables, etc.
  • : I don't think any commercially available compilers are written in Java. Since Java is quite new and most compiler paradigms quite old... Since Java is platform-independent and compilers are (very) platform-dependent...
    : But I once thought of using Java as a language for a compiler since it takes care of the most boring parts (I/O, the whole tokenizer part, Hash tables, etc.
    :
    Looking into JavaCC might help. Check out these links:

    http://www.webgain.com/products/java_cc/

    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-cooltools.html

    I used this a couple times to generate compilers. The source code is so-so but it seems to work pretty well.
  • : : I don't think any commercially available compilers are written in Java. Since Java is quite new and most compiler paradigms quite old... Since Java is platform-independent and compilers are (very) platform-dependent...
    : : But I once thought of using Java as a language for a compiler since it takes care of the most boring parts (I/O, the whole tokenizer part, Hash tables, etc.
    : :
    : Looking into JavaCC might help. Check out these links:
    :
    : http://www.webgain.com/products/java_cc/
    :
    : http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-cooltools.html
    :
    : I used this a couple times to generate compilers. The source code is so-so but it seems to work pretty well.
    :

    As well, just so everybody knows, "ADA" (Ada) as it pertains to the Ada programming language, is not an acronym ;-)

    Good luck
  • Didn't know about that; as I mentioned I once thought of it. It's a great idea to build a compiler using Java, but what would be the target CPU, OS, etc? E.g. if you write a Windows compiler, would Linux users get a message ?
  • : Didn't know about that; as I mentioned I once thought of it. It's a great idea to build a compiler using Java, but what would be the target CPU, OS, etc? E.g. if you write a Windows compiler, would Linux users get a message ?
    :

    You would probably design it in such a way that the actual generated instructions would be produced by plug in modules which could be dynamically changed. Then the user would just select the target platform to compile for. Something like
    that ;-) Naturally that would be the most difficult part...
  • Thank you Illco and Icey502 for your replies. It's really hard to write a compiler in Java...:) At the moment I try to program a compiler for "Oberon" in Java. It's not easy for me...
    If any of you have a sample source-code or other resources...can I have it please? Thank you very much...
  • : Thank you Illco and Icey502 for your replies. It's really hard to write a compiler in Java...:) At the moment I try to program a compiler for "Oberon" in Java. It's not easy for me...
    : If any of you have a sample source-code or other resources...can I have it please? Thank you very much...
    :
    Designing a compiler is not an easy task at all; using Java just makes it a little nicer since you have certain data-structures at your disposal.
    I don't know if you have a book on compiler design, but if you did you'd probably notice that it's full of theoretical mathematical gibberish. Well, it's not gibberish, it's the theoretical foundation which you will probably need to understand. Most books explain how to write compiler too, by the way. If you want to know more about the different stages of a compiler, please let me know. I can't tell you much detail (unless I bring the book up here), since I failed the Compiler Design course...
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories