Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Features  





2 History  





3 Ratfiv  





4 See also  





5 References  





6 External links  














Ratfor






العربية
Español
فارسی
Italiano

Norsk bokmål
Русский
 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


Ratfor
DeveloperBrian Kernighan
First appeared1976 (1976)
Websitesepwww.stanford.edu
Influenced by
Fortran, C

Ratfor (short for Rational Fortran) is a programming language implemented as a preprocessor for Fortran 66. It provides modern control structures, unavailable in Fortran 66, to replace GOTOs and statement numbers.

Features[edit]

Ratfor provides the following kinds of flow-control statements, described by Kernighan and Plauger as "shamelessly stolen from the language C, developed for the UNIX operating system by D.M. Ritchie" ("Software Tools", p. 318):

For example, the following code

if (a > b) {
  max = a
} else {
  max = b
}

might be translated as

      IF(.NOT.(A.GT.B))GOTO 1
      MAX = A
      GOTO 2
1 CONTINUE
      MAX = B
2 CONTINUE

The version of Ratfor in Software Tools is written in Ratfor, as are the sample programs, and inasmuch as its own translation to Fortran is available, it can be ported to any Fortran system. Ratfor source code file names end in .r or .rat.

History[edit]

Ratfor was designed and implemented by Brian KernighanatBell Telephone Laboratories in 1974, and described in Software—Practice & Experience in 1975. It was used in the book "Software Tools" (Kernighan and Plauger, 1976).

In 1977, at Purdue University, an improved version of the Ratfor preprocessor was written. It was called Mouse4, as it was smaller and faster than Ratfor. A published document by Dr. Douglas Comer, professor at Purdue, concluded "contrary to the evidence exhibited by the designer of Ratfor, sequential search is often inadequate for production software. Furthermore, in the case of lexical analysis, well-known techniques do seem to offer efficiency while retaining the simplicity, ease of coding and modularity of ad hoc methods." (CSD-TR236).

In comparison to the Ratfor preprocessor on a program of 3000 source lines running on a CDC 6500 system took 185.470 CPU seconds. That was cut by 50% when binary search was used in the Ratfor code. Rewriting the ad hoc lexical scanner using a standard method based on finite automata reduced run time to 12.723 seconds.

With the availability of Fortran 77, a successor named Ratfiv (Ratfor=rat4 => rat5=Ratfiv) could, with an option /f77, output a more readable Fortran 77 code:

      IF (A .GT. B) THEN
        MAX = A
      ELSE
        MAX = B
      ENDIF

Initial Ratfor source code was ported to C in 1985 [1] and improved to produce Fortran 77 code too.[2]Agit tree has been set in 2010 in order to revive ratfor .[3] Although the GNU C compiler had the ability to directly compile a Ratfor file (.r) without keeping a useless intermediate Fortran code (.f) (gcc foo.r), this functionality was lost in version 4 during the move in 2005 from f77toGNU Fortran.[4]

The original source was available in .deb and .rpm forms at its original site, mirror.corbina.net/mandriva/, and its archive, www.dgate.org/ratfor/ are gone as of April, 2024.

Ratfiv[edit]

Ratfiv is an enhanced version of the Ratfor programming language, a preprocessor for Fortran designed to give it C-like capabilities. Fortran was widely used for scientific programming but had very basic control-flow primitives ("do" and "goto") and no "macro" facility which limited its expressiveness.

The name of the language is a pun (Ratfor (RATional FORtran) -> "Rat Four" -> "Rat Five" -> RatFiv).

Ratfiv was developed by Bill Wood at the Institute for Cancer Research, Philadelphia, PA in the early 1980s and released on several DECUS (Digital Equipment Users Group) SIG (Special Interest Group) tapes. It is based on the original Ratfor by B. Kernighan and P. J. Plauger, with rewrites and enhancements by David Hanson and friends (U. of Arizona), Joe Sventek and Debbie Scherrer (Lawrence Berkeley National Laboratory).

Ratfiv V2.1 was distributed on the DECUS RSX82a SIG tape.[5]

See also[edit]

References[edit]

  1. ^ "Ratfor implementation in C (1985)".
  • ^ "Ratfor77".
  • ^ "Ratfor Git Revived".
  • ^ "gcc lost the ratfor preprocessor".
  • ^ Ratfiv V2.1 archive
  • External links[edit]


    Retrieved from "https://en.wikipedia.org/w/index.php?title=Ratfor&oldid=1217756601"

    Categories: 
    Fortran programming language family
    Programming languages created in 1976
    Hidden categories: 
    Articles with short description
    Short description matches Wikidata
     



    This page was last edited on 7 April 2024, at 18:12 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki