Re: Compiler vs. Translator (Jan Burgy)
15 Jun 2004 01:02:58 -0400

          From comp.compilers

Related articles
Compiler vs. Translator (Paul Robinson) (2004-05-16)
Re: Compiler vs. Translator (2004-05-24)
Re: Compiler vs. Translator (glen herrmannsfeldt) (2004-05-24)
Re: Compiler vs. Translator (Richard F. Man) (2004-05-24)
Re: Compiler vs. Translator (Martin Ward) (2004-05-30)
Re: Compiler vs. Translator (glen herrmannsfeldt) (2004-05-30)
Re: Compiler vs. Translator (2004-06-06)
Re: Compiler vs. Translator (2004-06-15)
| List of all articles for this month |

From: (Jan Burgy)
Newsgroups: comp.compilers
Date: 15 Jun 2004 01:02:58 -0400
References: 04-05-051 04-05-058
Keywords: translator
Posted-Date: 15 Jun 2004 01:02:58 EDT wrote
> On Sun, May 16, 2004 at 11:39:20PM -0400, Paul Robinson wrote:
> > What brought this on was that I happened to bid on a programming job
> > on 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.
> OMG... Sounds like a real ugly mess. There exists a FORTRAN to C
> translator, and what I can tell you is that it isn't pretty. The
> compiler itself is (according to Dave Wheeler's sloccount) 26,640
> source lines of code, and the accompanying runtime library is 9,609
> SLOC's, giving a total of some 36,249 source lines of code, not a
> minor project by any stretch. I suggest you give it a look at it
> here:
> Could give you some ideas on how to continue with your project.

Alright Paul,

first I want to wish you much success in your endeavour (albeit
foolish I feel it is). If I were you, I would NOT look at f2c. I have
a lot of respect for its authors but the code is a complete mess. The
part that probably interests you the most (lexing and parsing) has
been "solved" using terribly complicated lex and yacc files. If you're
going to lex and parse FORTRAN 66 or 77, you need to have a look at
Sale's algorithm[1,2]. The authors of f2j understood at least that

I haven't look at the entire project but it looks to me much more
helpful than f2c. They mention Sales' algorithm here:


Jan Burgy, PhD
Zurich, Switzerland

[1] Arthur H. J. Sales, "The classification of FORTRAN statements",
The Computer Journal, Volume 14, Issue 1, pp. 10-12.
[2] J. K. Slape and Peter J. L. Wallis, "A Modification of Sale's
Algorithm to Accommodate FORTRAN 77", The Computer Journal Volume 34,
Issue 1, pp. 373-376.

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.