|Compiler vs. Translator email@example.com (Paul Robinson) (2004-05-16)|
|Re: Compiler vs. Translator firstname.lastname@example.org (2004-05-24)|
|Re: Compiler vs. Translator email@example.com (glen herrmannsfeldt) (2004-05-24)|
|Re: Compiler vs. Translator firstname.lastname@example.org (Richard F. Man) (2004-05-24)|
|Re: Compiler vs. Translator Martin.Ward@durham.ac.uk (Martin Ward) (2004-05-30)|
|Re: Compiler vs. Translator email@example.com (glen herrmannsfeldt) (2004-05-30)|
|Re: Compiler vs. Translator firstname.lastname@example.org (2004-06-06)|
|[1 later articles]|
|From:||Paul Robinson <email@example.com>|
|Date:||16 May 2004 23:39:20 -0400|
|Posted-Date:||16 May 2004 23:39:20 EDT|
I wanted to start by mentioning something I hadn't thought about until
the issue "dropped in my lap" so to speak and that's when it showed up
on my radar screen, and became an issue I had to deal with. I had not
considered the difference between a translator and a compiler.
What brought this on was that I happened to bid on a programming job
on rentacoder.com to write a program (in Visual Basic, of course)
which would translate programs written in FORTRAN into Visual Basic.
Well, since I've written programs for years using both languages I
decided to tackle this particular assignment.
I think someone once said that every programmer has three things they
will want to tackle in their life: to write an operating system, to
build their own computer and to write a compiler. Well, I've done the
first two, and now I'm discovering the difference between a translator
and a compiler and I realize just how many things you have to think
about when you're compiling a source program, and how you have much
more leniency when it's "just" a translator. But let me offer my
suggestions on (some of) the differences between the two. Other
people might have more ideas or might have a better statement about
1. A translator presumes the code is correctly formatted and would
compile if passed to a compiler. Compilers syntactically scan code to
find syntax errors and in some cases correct them.
2. A translator produces only output for another compiler, a compiler
(usually) generates object files and/or executables. (Some actual
compilers generate source for another language or assembly.)
3. A translator makes certain assumptions about the code being
presented to it, that it is a complete or reasonably complete piece of
code. A compiler will check and (usually) complain if you hand it a
fragment of a program.
I wrote programs in FORTRAN for over five years and I've learned more
about the language in the last two weeks - and probably more than I ever
wanted to know - than I learned in the entire time I spent writing
dozens of applications using the language. So I will say this: if you
think you're weak in a particular programming language, consider writing
a compiler or translator for it and you will realize things you had
I have been a programmer for over 24 years. I did not realize the
complexity of the task which I had in front of me (or I might have
either asked for more money or not bid on it) but given what has
happened, I have learned so much about how text processing of source
languages is done that I am amazed at what I have accomplished. I also
have to admit I've never had as much fun doing a program as I have on
this one. Once this is finished (and doing the project has given me so
many more ideas that I know it will be finished) - somewhat faster than
I originally feared when I realized how big a piece I had bit into - I
will be able to proudly look back on what I've done as some of the best
work I've accomplished.
"I did not expect it to be as great as this - or as hard." - Dr. Hugh
Akston in Ayn Rand's "Atlas Shrugged"
Paul Robinson "Above all else... We shall go on..."
[I wouldn't expect it to be much easier to translate Fortran into VB
than to translate Fortran into assembler or machine code. The
gratuitous but inevitable semantic differences among various
Fortran-like languages practically force you to compile into something
very low level, then pattern match to get the code in the target
language. You might want to look at f2c which is the old f77 compiler
with a new back end to generate C rather than assembler. -John]
Return to the
Search the comp.compilers archives again.