UP | HOME

JOVIAL

JOVIAL is a programming language from the 1960s used for programming avionics. It is virtually impossible to find a free compiler, though. I'm mostly interested in its applications to avionics.

An example of some JOVIAL code:

START
''////////////////////////////////////////////////////////// ''
''// Name: Peter M. Maurer                                   ''
''// Program: Sieve of Eratosthenes                          ''
''// Due: Never                                              ''
''// Language: Jovial                                        ''
''////////////////////////////////////////////////////////// ''
FILE MYOUTPUT ...  $ ''Insufficient information to complete this declaration''
PROC SIEVEE     $
        '' define the sieve data structure ''
        ARRAY CANDIDATES 1000 B $

        FOR I =0,1,999 $
        BEGIN
           '' everything is potentially prime until proven otherwise ''
           CANDIDATES($I$) = 1$
        END
        '' Neither 1 nor 0 is prime, so flag them off ''
        CANDIDATES($0$) = 0$
        CANDIDATES($1$) = 0$
        '' start the sieve with the integer 0 ''
        FOR I = 0$
        BEGIN
             IF I GE 1000$
                GOTO DONE$
             '' advance to the next un-crossed out number. ''
             '' this number must be a prime                ''
 NEXTI.	     IF I LS 1000 AND Candidates($i$) EQ 0 $
             BEGIN
                I = I + 1 $
                GOTO NEXTI $
             END
             '' insure against running off the end of the data structure ''
             IF I LT 1000 $
             BEGIN
                  '' cross out all multiples of the prime, starting with 2*p. ''
                  FOR J=2 $
                  FOR K=0 $
                  BEGIN
                    K = J * I $
                    IF K GT 999 $
                       GOTO ADV $
                    CANDIDATES($K$) = 0 $
                    J = J + 1 $
                  END
                  '' advance to the next candidate
 ADV.		  I = I + 1 $
             END
        END
        '' all uncrossed-out numbers are prime (and only those numbers) ''
        '' print all primes
        OPEN OUTPUT MYOUTPUT $                                            ''
 DONE.	FOR I=0,1,999$
        END
                IF CANDIDATES($I$) NQ 0$
                BEGIN
                        OUTPUT MYOUTPUT I $   '' probably not correct ''
                END
        END
TERM$

Some JOVIAL resources: