By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,851 Members | 2,104 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,851 IT Pros & Developers. It's quick & easy.

Intermediate to Elite: Making the jump

P: n/a
TTA
I'm an intermediate C++ programmer. My skills are good but they need
to be fine-tuned and my software methodologies in theory are good but
I need more practical experience . I am still in university pursuing
my bachelors in Comp Sci.

My old (and favorite) prof used to tell us the best way to learn a
language is to write a compiler. I know it's a big project, but the
guy did have a point. If you write a C++ compiler, you will have
awesome insight into the language.
The more and more I learn C++, the more I realize that greater
knowledge of what the compiler is trying to do must be obtained. This
will lead (IMO) to better programming.
All the books I can find on compilers usually too theoretical or the
opposite something like "Let's build a compiler". I am not interested
in a toolkit. Is there a good book or resource that tells me exactly
what's happening "behind the scenes"? I am interested in C++ solely.

The only thing that comes close to this is "Effective C++" by Meyers.
It's an excellent book but limits itself to 50 specific topics. Does
such a resource even exist or do I just need experience? I'd
appreciate some guidance.

Thanks
TTA
Jul 22 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a

"TTA" <ta*******@msn.com> wrote in message
news:b5**************************@posting.google.c om...
I'm an intermediate C++ programmer. My skills are good but they need
to be fine-tuned and my software methodologies in theory are good but
I need more practical experience . I am still in university pursuing
my bachelors in Comp Sci.

My old (and favorite) prof used to tell us the best way to learn a
language is to write a compiler. I know it's a big project, but the
guy did have a point. If you write a C++ compiler, you will have
awesome insight into the language.
Its good advice, but you don't have to write a C++ compiler, in fact that
seems a near impossible task for one programmer who by his own admission is
at intermediate level. Try a simpler language instead (maybe even one which
would be useful to you, rather than
The more and more I learn C++, the more I realize that greater
knowledge of what the compiler is trying to do must be obtained. This
will lead (IMO) to better programming.
Possibly.
All the books I can find on compilers usually too theoretical or the
opposite something like "Let's build a compiler". I am not interested
in a toolkit. Is there a good book or resource that tells me exactly
what's happening "behind the scenes"? I am interested in C++ solely.
Stanley Lippman's Inside the C++ Object Model. It's a bit dated but still
apparently useful, (I haven't read it, but it always seems to be recommended
when this sort of question comes up).

The only thing that comes close to this is "Effective C++" by Meyers.
It's an excellent book but limits itself to 50 specific topics. Does
such a resource even exist or do I just need experience? I'd
appreciate some guidance.


Well you could do worse than More Effective C++ by Scott Meyers, which is
quite a bit more advanced than the one you have read. I don't see what
either has specifically to do with writing a compiler however.

For a thorough treatment templates (including how compilers have to deal
with them) I would also recommend C++ Templates by Vandevoorde and Josuttis.
If nothing else this book will show you what an ambitious task you've set
yourself in writing a C++ compiler.

John
Jul 22 '05 #2

P: n/a
"TTA" <ta*******@msn.com> wrote
I'm an intermediate C++ programmer. My skills are good but they need
to be fine-tuned and my software methodologies in theory are good but
I need more practical experience . I am still in university pursuing
my bachelors in Comp Sci.

My old (and favorite) prof used to tell us the best way to learn a
language is to write a compiler. I know it's a big project, but the
guy did have a point. If you write a C++ compiler, you will have
awesome insight into the language.
The more and more I learn C++, the more I realize that greater
knowledge of what the compiler is trying to do must be obtained. This
will lead (IMO) to better programming.
All the books I can find on compilers usually too theoretical or the
opposite something like "Let's build a compiler". I am not interested
in a toolkit. Is there a good book or resource that tells me exactly
what's happening "behind the scenes"? I am interested in C++ solely.

The only thing that comes close to this is "Effective C++" by Meyers.
It's an excellent book but limits itself to 50 specific topics. Does
such a resource even exist or do I just need experience? I'd
appreciate some guidance.


I'm assuming that you already have Stroustrup's "The C++ Programming Language":
http://search.barnesandnoble.com/tex...sbn=0201700735

The following books aren't all recent, but they should give you plenty to work
with:

"The C++ Standard" is the place to start:
http://search.barnesandnoble.com/boo...sbn=0470846747. If
you're not implementing Standard C++, you're just implementing something else.

"The Annotated C++ Reference Manual" by Stroustrup and Ellis will give you
insights and rationales on the language that, to this day, you won't find
elsewhere:
http://search.barnesandnoble.com/tex...sbn=0201514591

Stroustrup's "The Design and Evolution of C++" will give you still more insights
into why things are as they are:
http://search.barnesandnoble.com/tex...sbn=0201543303

Lippman's "Inside the C++ Object Model" will give you some ideas of how to
implement various aspects of the language:
http://search.barnesandnoble.com/tex...sbn=0201834545

For compiler texts, if you're not making the bridge between theory and practice
from the canons like the Aho and Ullman books, you can dive into practical
compiler writing with these books:

"Compiler Design in C" by Allen Holub:
http://search.barnesandnoble.com/tex...sbn=0131550454

"A Retargetable C Compiler: Design and Implementation" by the Hans*n bunch:
http://search.barnesandnoble.com/tex...sbn=0805316701

The advantage of the latter is that the compiler described is available and
supported at http://www.cs.princeton.edu/software/lcc/.

Both of these implement C compilers, but the goal is to allow you to see how the
theory is applied (if all you wanted was to see an existing C++ compiler, you'd
just download the G++ or OpenWatcom source). You should be able to extrapolate
that into what's needed to write a C++ compiler, especially since a subset of the
language is already represented.

And just in passing, you might want to use the term "advanced" instead of
"elite". Aside from the term having pompous connotations (I'm sure that's not how
you meant it), it's now also sullied by the teeny-bopper-wannabe-hacker use of
"leet". There are few programmers in the world who could call themselves "elite"
without drawing gales of laughter from everyone in the vicinity. :-)

Claudio Puviani
Jul 22 '05 #3

P: n/a
I agree, building a compiler is a multi-man year project, there are
surely more efficient ways to improve your C++ programming and software
skills. Besides, the code I've seen in some compilers has been pretty
awful!

I'd recommend some of the Addison Wesley books in the same series,
Herb Sutter's books on Exceptional C++, Modern C++ Design - although
I could never get the examples to even compile on VC++, there are some
interesting ideas in there. There's another one, Applied C++, I didn't
think
it was up to the same level as the others, but if you want to see how things
are done in the real world, they have a some good coverage. Not language
specific but very useful in OOP, is Object Design Heuristics, lots of C++
snippets. Of course if you really want to make it as a C++ "elite", gotta
know Design Patterns by Gamma Et all.

Good luck.

dave
"TTA" <ta*******@msn.com> wrote in message
news:b5**************************@posting.google.c om...
I'm an intermediate C++ programmer. My skills are good but they need
to be fine-tuned and my software methodologies in theory are good but
I need more practical experience . I am still in university pursuing
my bachelors in Comp Sci.

My old (and favorite) prof used to tell us the best way to learn a
language is to write a compiler. I know it's a big project, but the
guy did have a point. If you write a C++ compiler, you will have
awesome insight into the language.
The more and more I learn C++, the more I realize that greater
knowledge of what the compiler is trying to do must be obtained. This
will lead (IMO) to better programming.
All the books I can find on compilers usually too theoretical or the
opposite something like "Let's build a compiler". I am not interested
in a toolkit. Is there a good book or resource that tells me exactly
what's happening "behind the scenes"? I am interested in C++ solely.

The only thing that comes close to this is "Effective C++" by Meyers.
It's an excellent book but limits itself to 50 specific topics. Does
such a resource even exist or do I just need experience? I'd
appreciate some guidance.

Thanks
TTA

Jul 22 '05 #4

P: n/a
TTA wrote:
I'm an intermediate C++ programmer. My skills are good but they need
to be fine-tuned and my software methodologies in theory are good but
I need more practical experience . I am still in university pursuing
my bachelors in Comp Sci.

My old (and favorite) prof used to tell us the best way to learn a
language is to write a compiler. I know it's a big project, but the
guy did have a point. If you write a C++ compiler, you will have
awesome insight into the language.
The more and more I learn C++, the more I realize that greater
knowledge of what the compiler is trying to do must be obtained. This
will lead (IMO) to better programming.
All the books I can find on compilers usually too theoretical or the
opposite something like "Let's build a compiler". I am not interested
in a toolkit. Is there a good book or resource that tells me exactly
what's happening "behind the scenes"? I am interested in C++ solely.

The only thing that comes close to this is "Effective C++" by Meyers.
It's an excellent book but limits itself to 50 specific topics. Does
such a resource even exist or do I just need experience? I'd
appreciate some guidance.


This seems somewhat like trying to become a better driver by building a
car. I'm not convinced it will work, and the time investment will be
enormous, especially if you're not interested in starting from a kit.
Jul 22 '05 #5

P: n/a
John Harrison wrote:

Well you could do worse than More Effective C++ by Scott Meyers, which is
quite a bit more advanced than the one you have read. I don't see what
either has specifically to do with writing a compiler however.


True... anything by shildt immediately comes to mind. Stroustrup is also
a good reference.

Joe
--
#----------------------------------------------------------#
# "Don't fear the penguin!" #
#----------------------------------------------------------#
# Registered Linux user: #309247 http://counter.li.org #
#----------------------------------------------------------#
Jul 22 '05 #6

P: n/a
TTA
Jeff Schwab <je******@comcast.net> wrote in message news:<LJ********************@comcast.com>...
This seems somewhat like trying to become a better driver by building a
car. I'm not convinced it will work, and the time investment will be
enormous, especially if you're not interested in starting from a kit.


Thank you all for the great response. A couple of you pointed out that
this is not a "one-man" project. If the project becomes serious, then
I will definitely have a team. But the whole point is to hone *my*
skills. I've participated in many group programming assignments
throughout college and while I realize that a group is pretty much
required to produce anything non-trivial (some might disagree), I will
see how far I can go.
The analogy of becoming a better driver while building a car to
building a compiler to learn the language does not hold very well.
You're writing a compiler FOR the language IN the language. I'm
confused...how does that not teach you better C++? You may still need
to learn some software methodologies for different types of projects,
but you'd know the language inside-out. But I do understand your
point.
Jul 22 '05 #7

P: n/a
ta*******@msn.com (TTA) wrote in message news:<b5**************************@posting.google. com>...

[ ... ]
The analogy of becoming a better driver while building a car to
building a compiler to learn the language does not hold very well.
You're writing a compiler FOR the language IN the language. I'm
confused...how does that not teach you better C++?
Almost any major project (and a C++ compiler certainly qualifies) will
be educational, but learning C++ by writing a C++ compiler is a bit
like trying to read books under a microscope -- you miss the forest
for the trees.
You may still need to learn some software methodologies for different
types of projects, but you'd know the language inside-out. But I do
understand your point.


The relationship is not nearly as close as you seem to think -- I've
written compilers (and interpreters) for languages without ever
knowing those languages particularly well. I've also learned some
languages quite well without ever writing a compiler for them.

At least in my experience, your first two translators are more or less
throwaways. In the first, you're so caught up in learning the basics:
parsing, code-generation, etc., that those are really about all you
can learn at that stage. Intentionally or not, the second is largely
a rewrite of the first, using techniques you learned too late in the
first to apply them where you wanted to, and so on -- even when
they're really inappropriate to the project at hand.

The third translator is the first one in which you can start to step
back and look at things more systematically. Chances are that by
then, however, you'll have started to look at most languages as
variations on a couple of themes, and instead of really wanting to
know every detail of a particular language, you start to wish they
(the languages) were more consistent and had fewer of those ugly
details to deal with.

That usually leads to designing and implementing a few languages of
your own. Chances are they'll have some improvements over their
direct predecessors, but also that they'll never be used by anybody
but you and perhaps a few of your close friends.

After that, if you're a programmer who designed a few languages,
you'll do other programming, and occassionally when you look at a
language spec, you'll cringe and think "I'm sure glad I don't have to
write a compiler for that!".

OTOH, if you're really a language designer who happens to porgram,
you'll apparently continue trying to invent a better programming
language. If you're good (and a bit lucky) you might become the next
Dennis Ritchie, Bjarne Stroustrup, Niklaus Wirth, etc. (I can only
speak about this from observation though -- I'm clearly in the
category of a programmer who's designed a few languages).

Of course, there are other choices at each stage: just for example,
there are a few people who really do just write compilers and never
seem to have designed their own languages. For a long time, Walter
Bright seemed to be in that category, but now he's designed a language
of his own too (and it's better than most, I might add).

In the end, I'd say this: a particular language is nothing more than a
particular notation for expressing solutions to problems. Learning a
particular language in exceptional detail only helps you (possibly) do
a (slightly) better job of expressing the solution -- the real task is
in programming is the solution itself. Problem solving transcends
language.
--
Later,
Jerry.

The universe is a figment of its own imagination.
Jul 22 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.