Hello hbarca,
Thanks for the question. I've been a happy Pascal user since the
early 80's and have used a number of compilers.
Many Pascal compilers are themselves written in Pascal; its fairly
common for compilers to be able to bootstrap their own source as
proof of their power. Most of the C/C++ Pascal compiler
implementations are either closed-source commercial products, or
student projects and of varying quality. Ive searched the web and
found several resources that appear to match what youre looking for.
One possible Pascal compiler that might interest you is the one
developed by Zoly Farkas and posted on codeguru.com. It was written
in Visual C++.
http://www.codeguru.com/cpp_mfc/pascal.shtml
Steven Pemberton of CWI (National Research Institute for Mathematics
and Computer Science in the Netherlands) was the co-author of a text
titled Pascal Implementations: the P4 Compiler and Interpreter. The
source code from his text is available on the web. While the compiler
was written in Pascal, theres a C translation of the compiler
available too:
http://www.cwi.nl/~steven/pascal/
You might also be interested in this report by Wang Wenjie (in Adobe
Acrobat form) which discusses the process of writing a mini-pascal
compiler for a compiler theory course:
http://www.eecs.umich.edu/~wenjiew/Doc/ccDoc.PDF
A better resource is Ronald Maks book, "Writing Compilers and
Interpreters". The entire book is devoted to writing a Pascal
compiler in C and C++. You can find more about his books on his web
page:
http://www.apropos-logic.com/books.html
The first edition used C, the second C++. If you follow Ronalds
links to Amazon.com, youll find a few pages of the text available
online. (Click on the book cover image once you get to Amazon for the
Look Inside feature.)
Search Strategy
To find these resources, I used Google with several search phrases and
terms including:
implementing a pascal compiler
design of a pascal compiler
pascal compiler c c++
Printed References:
Writing Compilers and Interpreters: an Applied Approach by Ronald Mak.
John Wiley & Sons; ASIN: 047150968X; (April 1991)
Writing Compilers and Interpreters by Ronald Mak. John Wiley & Sons;
ISBN: 0471113530; 2nd edition (July 1996)
Pascal Implementation: Book I: The P4 Compiler by Steven Pemberton,
Martin Daniels. Ellis Horwood Ltd; ASIN: 0470273860; (August 1983)
I hope you find these resources helpful and that this answers your
question satisfactorily. If any of the above is unclear, please dont
hesitate to request a clarification before rating this answer.
Regards,
Duncan2-ga |