Fortran to PL/I translation 
Author Message
 Fortran to PL/I translation

I keep looking for Robin to post a message in the
   re: fortran to PL/I translation   topic thats pertinent to the
topic but since its obvious he just wants to keep the topic alive
because of its subject line, I will give him (or someone) pertinent
from the topic
in comp.lang.fortran topic "parsing input files" an example to do a
real translation involving something that PL/I is supposed to be good
at,
that is, parsing inputs.


Quote:



> >    <snip> Graham example data formats...

> > > From this example, it seems to me to be much more
straightforward to
> > > use plain Fortran:

> > Of course it is, IT ALWAYS IS...
> > What is never discussed here is that by introducing HORRIFIC
> > non-Fortran complexities the programmer consciously or not makes
the
> > package LESS READABLE to co-workers..
> > Resulting in JOB PROTECTION plain and simple..

> With the imminent danger of starting a futile yes/no argument, I
think
> that the text above can be used to illustrate that _sometimes_
Fortran
> does not give the most straightforward programming solution:

> Suppose the above text is a short example of a program that needs to
> analyse text files w.r.t. the use of capitals-only words. The lines
can
> be as long as you like, the words will be limited to, say, 100
letters
> at
> most. In Yacc/Lex, it would be a small matter to parse the text and
> count the words that use only capitals. In Fortran, well, try for
> yourself.

> This is _not_ to say that Fortran is unsuited for this task, just
less
> suited.
> And it does not hurt to know other solutions.

> Regards,

> Arjen

Well, since I havent done any programming this week, below 100%
Fortran exercise reports   #capwords = 10

Note the advantage that co-workers do not have to have non-Fortran
skills to understand what the hot-shot programmer is trying to conceal
to protect his job.

! -------------------------
program parse_test
implicit none
integer :: num = 0
character(200) :: line
open (1,file='parse.txt')
do
   read (1,'(a)',end=100) line
   call count_capwords()
end do
100 write (*,*) '#capwords = ', num
stop
contains
! --------------------------
subroutine count_capwords()
integer :: n, i
character :: prev, ch
n = 0 ; ch = ' '
do          ! until line examined for cap words
   n = n+1
   IF (line(n:) == ' ') exit   ! end of line detect
   prev = ch ; ch = line(n:n)
   if (ch == ' ') cycle
   if (prev == ' '.and.ch >= 'A'.and.ch <='Z') then ! start capword
      do
         n = n+1 ;  ch = line(n:n)
         if (ch >= 'A'.and.ch <='Z') cycle  ! capword continues
         if (ch >= 'a'.and.ch <= 'z') exit  ! word not capword
         num = num+1                     ! count capwords
         exit
      end do
   end if
end do
end subroutine count_capwords
end program parse_test



Tue, 06 Dec 2005 00:37:42 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Fortran to PL/I translation

2. Fortran to PL/I translation

3. FA: Software Source Translation: Fixed per 100 line Cost PL/M,CHILL, FORTRAN to C/C++

4. Vax fortran x microsoft fortran (translation)

5. PL/1 to Cobol translation (AS/400)

6. PL/I analysis, re-engineering, and translation

7. Translation Package : PL/1 to Turbo-Pascal

8. PL/1 to Cobol translation (AS/400)

9. Animation help: Translation->Rotation->Translation

10. fortran to Pascal or C translation

11. FORTRAN Translation to Ada

12. Fortran Translation

 

 
Powered by phpBB® Forum Software