Google Answers Logo
View Question
 
Q: C- Compiler using Object-Oriented Design Paterns ( No Answer,   3 Comments )
Question  
Subject: C- Compiler using Object-Oriented Design Paterns
Category: Computers > Programming
Asked by: neskimite-ga
List Price: $20.00
Posted: 15 Jan 2006 20:54 PST
Expires: 14 Feb 2006 20:54 PST
Question ID: 433839
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.)
Answer  
There is no answer at this time.

Comments  
Subject: Re: C- Compiler using Object-Oriented Design Paterns
From: larkas-ga on 16 Jan 2006 19:27 PST
 
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).
Subject: Re: C- Compiler using Object-Oriented Design Paterns
From: vadul-ga on 16 Jan 2006 21:41 PST
 
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 -
Subject: Re: C- Compiler using Object-Oriented Design Paterns
From: neskimite-ga on 17 Jan 2006 05:28 PST
 
Yes, it has to be written from scratch :)

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy