C- Compiler using Object-Oriented Design Paterns

March 13th, 2010
  • I'm in a Computer Science class that is constructing a "C-" compiler, which is a small subset of the C language that does not have structs, pointers, etc. It's pretty simple, with a grammar of 30 rules or so. I'm looking for resources that will help me implement Design Patterns and Object-Oriented concepts for this. (I'm writing the compiler in Java, although C# is also acceptable, I believe) The textbook I'm using has numerous examples in C, so it's a bit antiquated in some ways, because I prefer an OO approach to programming. I'm pretty much on my own besides that, the class teaches functionality, not implementation. I have the "Design Patterns" book by the "Gang of Four", and it's a good start, but things like the "Interpreter" pattern don't seem to scale well to large grammars. I could be wrong, however. So I'd like ideas on what books to buy or websites to visit that would help me implement my compiler in a OO way w/ Design Patterns. I'll tip pleasantly for good efforts :) (note: if you feel the price for this research is too low, let me know and I'll increase it.)


  • If it is a C- syntax, is it a requirement for you to write this from scratch? Flex and Yacc tools on unix and windows have been there for a long time and can do the work effortlessly. All you would need is a shell over this in C# to handle the input and outputs -You can keep that object oriented while the core work is done in C - Tell me if you are intrested in this idea -


  • Yes, it has to be written from scratch :)


  • I would suggest the following books (listed in no particular order) if you haven't already: Writing Compilers and Interpreters by Ronald Mak Modern Compiler Implementation in Java by Andrew W. Appel Programming Language Processors in Java: Compilers and Interpreters by David A. Watt and Deryck Brown Building Parsers With Java by Steven John Metsker Also take a look at the source code for JavaCC (https://javacc.dev.java.net/) and SableCC (http://sablecc.org/index.html).







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about C- Compiler using Object-Oriented Design Paterns , Please add it free.