DataMuseum.dk

Presents historical artifacts from the history of:

RC4000/8000/9000

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about RC4000/8000/9000

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦f18c87cbc⟧ TextFile

    Length: 33792 (0x8400)
    Types: TextFile
    Names: »ptoarap1«

Derivation

└─⟦00964e8f7⟧ Bits:30007478 RC8000 Dump tape fra HCØ.
    └─⟦b2ec5d50f⟧ 
        └─⟦this⟧ »ptoarap1« 

TextFile

mode list.yes
rapport=set 200
scope user rapport
rapport=typeset check.no
*se #* #pl ,30,235,,10##lw160##ld18##pn 5,1#
#rh 1,PASCAL TO ALGOL#
#ps0#
#ns1,4,_«bs»1_«bs».__«bs»W_«bs»a_«bs»y__«bs»o_«bs»f__«bs»P_«bs»r_«bs»e_«bs»s_«bs»e_«bs»n_«bs»t_«bs»i_«bs»n_«bs»g__«bs»t_«bs»h_«bs»e__«bs»P_«bs»r_«bs»o_«bs»b_«bs»l_«bs»e_«bs»m_«bs»s_«bs».#
#np15#
  A Chinaman named Yu Song Yu has September 1981 been living two
years in Copenhagen, where he has made a lots og programs on DIKU
(Institute of Computer Science of Copenhagen) in the programming
language Pascal.
#np#
  Now the problem is that Yu Song Yu, when he is returning to China, 
he has no possibility to go on working at his programs, because he
only can get programs in the programmering language Algol executed, and Yu Song Yu dont know anything about Algol.
#np#
  We are now trying to make a translater, which can translate Pascal
to Algol. The translater is written in Algol, because it is the
language Yu Son Yu has on the machine DJS-6 in Shanghai.
#np#
  Some of the things we are going to concider in connection with
drawing up the translater are following:
#lm20#
#nl#

   a) which of the three following things are going to have the
      highest priority
#lm25#
#nl#
      1) the likeness between the Algol and the Pascal version
         of a program is as great as possible
#nl#
      2) the translation from Pascal to Algol of a program is as fast
         as possible
#nl#
      3) the executing time of the Algol version of the program is as
         low as possible
#lm20#
#nl#

   b) how is the precise syntax for Algol in China and which Pascal-
      version should be translated
#nl#
  
   c) which input-, output- and storage possibilities are there on the
      machine in China
#nl#

   d) which possibility do we have for testing the translater (look
      section    )
#nl#

   e) beside the syntax's differens between Pascal and Algol, there
      are in Pascal some facilitetes (heap, pointer, set, case, repeat -
      while, type),
 which do not exist in Algol. How are they going
      to be translated
#nl#
      
   f) which possibilities do we have to get information about the circum-
      stances in China
#nl#

   g) must the translation and the syntaxcheck be done at the same time
      or is the translation going to be in steps
#lm0#
#ns1,4,_«bs»2_.__«bs»P_«bs»r_«bs»o_«bs»b_«bs»l_«bs»e_«bs»m_«bs»a_«bs»n_«bs»a_«bs»l_«bs»y_«bs»s_«bs»i_«bs»s_«bs».#
#nl4#
2.1 The Possibility to Getting Information about the Circumstances in China.
#np#

  As mentioned in section 1 Way of Presenting the Problems, we have to know
the precise Algolversion in China, which  external devices there are on the
machine in China, and how much storage there is, wordsize and so on.
#np#

  Yu Song Yu, the Chinaman for whom we are making the translater, have no
particular knowledge about Algol on the topical machine in Shanghai, on
the other hand he has a friend in Aarhus, who had told us a little bit 
about the machine but nothing about the Chinese Algol. Therefore we have
made some questions on English, which Yu Song Yu and his friend have trans-
lated to Chinese and sent to their place of work in Shanghai. One of the
question was, is it possible to get a manual in Algol.
#np#
  So we have possibility by letters to get information about the Chinese
machine and the language, but because it takes about two mouths, before
we get an answer on a letter, it is limited, how many letters we can get answered
during the periode the projekt is running.
#np#
  After about three months we have got an Algol manual on Chinese, but never
the less we can study the programexamples and realize, how the programming-
language is, and Yu Song Yu is ready to try to translate parts of the manual.
#ns1,4,_«bs»2_«bs»._«bs»2__«bs»T_«bs»h_«bs»e__«bs»A_«bs»l_«bs»g_«bs»o_«bs»l_«bs»v_«bs»e_«bs»r_«bs»s_«bs»i_«bs»o_«bs»n_«bs».#
#np#
  The Algol, Which is used on the machine in China, we are going to make
a translater to, is extended Algol 60 with some small differenses. The
machine is called DJS-6, in the rest of the report we use the name DJS-6
Algol or Chinaalgol, when we referer to the programming language, which
we are going to make a translater to.
#np#
  In Algol 60 there are no input/output procedures, so these are of
couse added in DJS-6 Algol. These procedures can only read an integer
or a real and write them again. There is no possibility for input/output
of characters - more about that in section 3.3.1.
#np#
  The reserved words in DJS-6 Algol are surrounded by apostrophes in
sted of as in Algol 60 to be underlined.
#sj#

  Example:
            DJS-6 Algol          Algol 60
            'BEGIN'              BEGIN
                                 -----

  Ruthermore some of the symbols are changed viz following:

            DJS-6 Algol          Algol 60
              'LS'                 <
              'LQ'                 <
              'GQ'                  >
              'GR'                  >

              'NQ'                 =
#rj#
#np#

  At last it should be mentioned, that the wort COMMENT does not exist in
DJS-6 Algol.
#ns1,4,_«bs»2_«bs»._«bs»3__«bs»W_«bs»h_«bs»i_«bs»c_«bs»h__«bs»P_«bs»a_«bs»s_«bs»c_«bs»a_«bs»l_«bs»v_«bs»e_«bs»r_«bs»s_«bs»i_«bs»o_«bs»n__«bs»M_«bs»u_«bs»s_«bs»t__«bs»B_«bs»e__«bs»T_«bs»r_«bs»a_«bs»n_«bs»s_«bs»l_«bs»a_«bs»t_«bs»e_«bs»d_«bs».#
#np#

  Yu Song Yu works with the version of Pascal, which is implemented on
PDP-11/45 also named "sequentiel Pascal".
#np#
  This version have some restrictions in proportion to "standard Pascal"
because there are no labels, jumpstatements, and only to levels global
and routine, in sted of there are in sequentiel Pascal universal types
and prefix
#ns1,4,3_«bs»._«bs»4__«bs»E_«bs»x_«bs»t_«bs»e_«bs»r_«bs»n_«bs»a_«bs»l__«bs»d_«bs»e_«bs»v_«bs»i_«bs»c_«bs»e_«bs»s__«bs»a_«bs»n_«bs»d__«bs»m_«bs»e_«bs»m_«bs»o_«bs»r_«bs»y__«bs»s_«bs»i_«bs»z_«bs»e_«bs».#
#np#
  The manual, we have got from China, says that there is a papertape-
reader, a papertapepuncher, a printer and a drum. The manual is from 
1974 so may be, there is some new external devices, but it had been im-
possible for us to be enlightened about, there is any modification in
proportion to the manual.
#np#
  Our possibilities to utilize the external devices are the following:
#np#
  The Pascalprogram is read on papertapereader, the syntaxchecked
Pascalprogram is printed on the printer together with errors if any.
On the papertapepuncher the DJS-6 Algol program(i.e. the translated
Pascalprogram) is printed, so if there is no errors the papertape can
be read, and the program executed.
#np#
  The drum is our only possibility for storing other places than in
the machine, the drum is ? K word and one word is 48 bit.
#nl4#

2.5 The Priority between the Quickness in the Translater, Executing
Time of the Algolprogram and the Likeness between the DJS-6 Algol
Program and the Pascalprogram.
#np#

  As mentioned in the heading, there is three drifferent things, you
can mortgage highly, when you are going to make a translater namely:
#lm20#
#nl#

1) The likeness between the aboriginal programtext and the translated
   program should be as great as possible among other things to keep
   as many identifiernames at all as possible.
#nl#

2) The quickness in translating from Pascal to DJS-6 Algol should be
   as great as possible.
#nl#

3) The executing time on the the translated Pascalprogram, that is the 
   DJS-6 Algolprogram should be as little as possible.
#lm0#
#np#

  Of couse it would be lovely, if all three things are fill up, but some 
times the three things would counteract each other, and which of the things
should then have the highest priority.
#lm20#
#nl#

  This mortgage would depend at:
#nl#

  a) On the present Pascalprograms should be translated one time after
     which all modifications are maked in the DJS-6 Algolversions, and 
     you never make new Pascalprograms.
#nl#

  b) On the present Pascalprograms should be translated every time, they
     are going to be executed, if any modifications they are maked in the
     Pascalversion, after which the Pascalprogram is translated again. You
     make new programs in Pascal.
#lm0#
#np#

  If you chose solution a), that is translating the present Pascalprograms
once at all, if any modifications they are maked in the new DJS-6 Algol-
version you have got after the first translation, and you will never make
new programs in Pascal, it does not mean so much, if the translationtime
from Pascal to DJS-6 Algol is high, because it is only necessary to trans-
late every Pascalprogram once.
#np#
  If any modifications in the programs it should be done in the DJS-6 Algol
version. It is on the other hand important that the likeness between the Pas-
calprogram and the DJS-6 Algolprogram is as great as possible, so the program-

mer could recognise his own program again and have the possibility to make 
modifications whitout using a lot of time studing the "new" program.
#np#
  The speed in the executing of the DJS-6 Algolprogram will also have a high
priority, but wheather the speed of the executing at the DJS-6 Algolprogram 
or the likeness between the Pascal- and the DJS-6 Algolprogram is as great 
as possible should mortgage hieghest, is an individuel judgment.
#np#

  On the other hand if you should translate the Pascalprogram every time,
all modifications are made in the Pascalprogram
all modifications are made in the Pascalversion, and you make new Pascal-
programs, it does not mean so much, if the likeness between the Pascal-
program and the DJS-6 Algolprogram is particular great.
because the programmer never should look in the DJS-6 Algolversion  but
only have a necassary intermediate station to get the Pascalprogram
exequeted. On the other would the time, it takes to translate from
Pascal to DJS-6 Algol, have a great meaning, because it is a thing,
which should be made a lot of times. The exequting time of the DJS-6
Algolprogram will like before, be an important factor, and you do not
need to mortgage likeness between the two programs particular high,
it is easyer to get this demand fullfilled.
#np#
 
  Now when we know, that the decisive for, what we shoul give the hieghest
priority in the translation, is depending on, if the present Pascalprograms
should be translated once at all or every time you want to exequete the
programs, the next thing, we have to do, is to find, what Yu Song Yu, who
is going to use the translater, want.
#np#

  Yu Song Yu still wants to make Pascalprograms, when he is coming home to
China. He does not want to make modifications if any in the DJS-6 Algolver-
sion, because he does not know any thing about DJS-6 Algol, there for the
likeness between the Pascal- and the DJS-6 Algolversion does not mean so
much. On the other hand it is important, that the time it takes to translate
the Pascalprogram to DJS-6 Algol is small. These things we have taken care 
of in our solution.
#ns1,4,_«bs»3_«bs»._«bs»6__«bs»T_«bs»r_«bs»a_«bs»n_«bs»s_«bs»l_«bs»a_«bs»t_«bs»i_«bs»o_«bs»n_«bs»s_«bs»t_«bs»e_«bs»p_«bs»s_«bs».#
#np#

  Because the translater also should be used to translation of new
Pascalprograms, is it necessary, that there is a syntaxcheque of the
Pascalprogram in the translater.
#np#

  You can make the translater, so in the first phase you do a syntax-
cheque. The translation can be maked in two phases, where you in the
first construct the necessary tables with identifiernames, typedecla-
rations and similar things, while you in the next phase make the trans-
lation itself.
#np#

  The last two phases you can fold up in one, that is you have two
phases, one where the Pascalprogram would be syntaxchequed and one 
where the translation occur.
#np#
  An other possibility is to make syntaxcheque and translation in the
same phase, that is the translater only got one phase.
#np#
  The advantage of having many phases is if you find any syntaxerrors, is it 
unnecessary to translate the program to DJS-6 Algol, and then because the 
errors should be corrected in the Pascalprogram, you save the time the
translationsphases take.
#np#

  If you use multiphases translater, you have to store the hole program
in the machine, because we do not have exact information about how much
memory we have the disposol of, we find it necessary to make translation
and syntaxcheque in one phase.
#np#

  By this solution it is only necessary to store the tables, which will be
created, while the translation is made.
#np#
  The Pascalprogram would be read as far as possible statement by statement,
after which the necessary information for the tables, whish ar used for translation, is stored. There woild be made a syntaxcheque and the statement would
be translated to DJS-6 Algol, at last the Pascalversion and if any the
syntaxerrors are printed on the lineprinter. The DJS-6 Algolversion is
punched out on papertape.
#np#
  Above when we wrote, that we as far as possible would read  statement
by statement of the Pascalprogram, is it because of that the loopconstrution
could demand, that the hole loopconstrution is stored in the machine.
#np#
  So you should not use memory for the hole program at the same time,
which was exactly what we wanted, but the drawback with this solution is
that even when a syntaxerror had been found, you must use time to translate
the Pascalprogram to DJS-6 Algol. It is possible to cheque, if there has been
syntaxerrors and then stop the translation, if there have been syntaxerrors, 
but in the cases where there is no syntaxerrors, which probably are most of them, you will loose a lote of time asking if there have been any syntaxerrors in
the program.
#np#

  So our solution would be a one phase translater, where both the syntaxcheque
and the translation are made in the same phase, and the hole Pascalprogram
would be translated even, when some syntaxerrors have been found.
#ns1,4,_«bs»3_«bs».__«bs»C_«bs»o_«bs»m_«bs»p_«bs»a_«bs»r_«bs»i_«bs»s_«bs»o_«bs»n_«bs»s__«bs»b_«bs»e_«bs»t_«bs»w_«bs»e_«bs»e_«bs»n__«bs»t_«bs»h_«bs»e__«bs»P_«bs»r_«bs»o_«bs»g_«bs»r_«bs»a_«bs»m_«bs»m_«bs»i_«bs»n_«bs»g_«bs»l_«bs»a_«bs»n_«bs»g_«bs»u_«bs»a_«bs»g_«bs»e_«bs»s_«bs».#
#np#

  In this section we will describe the differences, there are between SequentielPascal and "Standard Pascal", between Sequentiel Pascal and Algol 60, and
between Algol 60 and DJS-6 Algol plus the limitations and extensions make
for the sake of the solution of the task.
#ns1,4,_«bs»3_«bs»._«bs»1__«bs»S_«bs»t_«bs»a_«bs»n_«bs»d_«bs»a_«bs»r_«bs»d__«bs»P_«bs»a_«bs»s_«bs»c_«bs»a_«bs»l__«bs»C_«bs»o_«bs»n_«bs»t_«bs»r_«bs»a__«bs»S_«bs»e_«bs»q_«bs»u_«bs»e_«bs»n_«bs»t_«bs»i_«bs»e_«bs»l__«bs»P_«bs»a_«bs»s_«bs»c_«bs»a_«bs»l_«bs».#
#ns1,4,_«bs»3_«bs»._«bs»1_«bs»._«bs»1__«bs»D_«bs»i_«bs»f_«bs»f_«bs»e_«bs»r_«bs»e_«bs»n_«bs»c_«bs»e_«bs»s__«bs»b_«bs»e_«bs»t_«bs»w_«bs»e_«bs»e_«bs»n__«bs»S_«bs»t_«bs»a_«bs»n_«bs»d_«bs»a_«bs»r_«bs»d_«bs»-__«bs»a_«bs»n_«bs»d__«bs»S_«bs»e_«bs»q_«bs»u_«bs»e_«bs»n_«bs»t_«bs»i_«bs»e_«bs»l__«bs»P_«bs»a_«bs»s_«bs»c_«bs»a_«bs»l_«bs».#
#np#

  By Sequentiel Pascal means the Pascal which is mean the Pascal written
for the machine PDP-11. Here there are some limitations in proportion
to Standard Pascal. The most important differences are, that you in
Sequentiel Pascal do not have jumpstatements and labels. Futher you
cannot in Sequentiel Pascal declare a variable of the type Files as you
can in Standard Pascal.
#ns1,4,_«bs»3_«bs»._«bs»1_«bs»._«bs»2__«bs»E_«bs»x_«bs»t_«bs»e_«bs»n_«bs»s_«bs»i_«bs»o_«bs»n_«bs»s__«bs»o_«bs»f__«bs»S_«bs»e_«bs»q_«bs»u_«bs»e_«bs»n_«bs»t_«bs»i_«bs»e_«bs»l__«bs»P_«bs»a_«bs»s_«bs»c_«bs»a_«bs»l_«bs».#
par 11 page 31 you can read
about constant parametres in a routine call. According to the report
these parametres can not change value inside the call procedure, this
is changed so now you can change the value inside the procedure. This
change have no effect on the identifiers outside the procedure.#np#
The reason for this extension is, that the procedure now look more
like Algol 60 and Standard Pascal, and we not not need to control it
in the syntaxcheque. #np#
In the Sequentiel Pascal report par 12 page 34 you can read, that
procedures cannot be nested. This we have extended so all declarations
, which are on the programlevel can be used in the procedurelevel. The 
reason for this extension is the same as above more likeness to Algol 60.
#np# Dynamic arraylimits is not allowed in Sequentiel Pascal, but because
it is implemented in Algol 60, it is easy to allow it in the Pascalprograms,
which should be translated.
#ns 1,4,3.2. Sequentiel Pascal contra Algol 60.#
#np# Because, we from the beginning thought that the version of the Algol,
which is used in China is "clean" Algol 60 whitout all the diffent fines
and additions, you can find in nearly all Algol versions, we have first make a comparison between
Algol 60 and Sequentiel Pascal with the above mentioned extensions. After
we have got the manual with that version of Algol, They are using in China,
we have made a comparison between Algol 60 and DJS-6 Algol.#np#
In Sequentiel Pascal there is some things, which do not exist in Algol 60
. The most important things are record, type, heap, pointer, set, case,
repeat-until, while-do, char, input and output.#np# To be able to
translate some of the above mentioned things to Algol 60, we have to use
some auxiliary identifiers. When this auxiliary identifiers are going to
have names, you may be guite sure not to use names, which all ready is 
used in the Pascalprogram.
#nl#This you can solve in many different ways, among other things
by prohibited one decided letter as first symbol in variablesnames
in Pascal after which all auxiliaryidentifiers are going to start
with this letter. This solution have that disadvnatage, that all
ready existing Pascalprograms may be are going to be changed, if there
is variablenames, which are starting with the letter, which is forbidden.
An other way to solve the problem (and which is the way we have choosen)
is to prefix all identifiers in Pascal with one or several symbol, then
auxiliary variables can be names, which start with symbols different 
from the symbols, which are used as prefix. Our prefixes consist of
two letters, which is telling which type the variables is.#np#
#nl#
The list whit prefix looks as follow: #nl#
#ns 1,4,Translation of Record.#
#np#As mentioned above there do not exist record in Algol 60, therefore
we translate the identifier inside the record as integer, real or array
depending on the declaration the identifier has in the record. All the
identifiers, which are coming in the Algolprogram and belongs to a
record in the Pascalprogra, are prefixed with 'RE' and the recordname.#np#
A example will illustrate the meaning.
#sj#
            Pascalversion:

            CONST IDLENGTH=12;
necessary   TYPE IDENTIFIER=ARRAY(.1..IDLENGTH.) OF CHAR;
information CONST MAXBANDS=5;
to under-   TYPE COVARTYPE=ARRAY(.1..MAXBANDS,1..MAXBANDS.) OF REAL;
stand the   TYPE NUMBERTYPE=(INTVALUE,REALVALUE,COMPVALUE);
translation
            HEADPAGE=RECORD
              PICTURECODE:NUMBERTYPE;
              PIXELSIZE:INTEGER;
              DATASOURCE:IDENTIFIER;
              COVARSET:BOOLEAN;
              COVARIANCE-MATRIX:COVARTYPE;

  The translation to Algol 60, where only the translation of a record
named EXAMPLE of the type HEADPAGE is showed:

             EXAMPLE:HEADPAGE
               INTEGER REEXAMPLEPICTURECODE,
                       REEXAMPLEPIXELSIZE;
               INTEGER ARRAY
                       REEXAMPLEDATASOURCE(1:12);
               BOOLEAN
                       REEXAMPLECOVARSET;
               REAL ARRAY
                       REEXAMPLECOVARIANCE-MATRIX(1:5,1:5);
#rj#
#ns1,4,3.2.2. Implementing of HEAP and POINTER.#
#np#
The HEAP we have implemented by making an integer array called HEAP.#np#
Pointers are implemented as intergers.
#ns 1,4,3.2.3. Implementing of CASE.#
#np# This problems we solve with a row of if statements.
#ns 1,4,3.2.4. Implementing of WHILE-DO.#
#np# In Algol 60 you only have while-do combined with a for-statement,
therefore a WHILE-DO in Pascal will be translated asor-statement,
therefore a WHILE-DO in Pascal will be translated as follow:#sj#

        FOR I:=I WHILE  <condition>  DO
            BEGIN
                .
                .
                .
                .
            END;

#rj#
where <condition> is the same condition as in the WHILE- statement
in the Pascalprogram and I is a dummy variable.
#ns 1,4,3.2.5 Implementing of REPEAT-UNTIL.#
#np# That, wich in Pascal is called REPEAT-UNTIL, will in Algol 60
be implemented in the following way:
#sj#

        FOR I:=I,I+1 WHILE -, <condition> DO
            BEGIN
                .
                .
                .
                .
            END;

#rj#
where <condition> and I have the same meaning as in section 3.2.4. about
WHILE-DO.
#ns 1,4,3.2.6. Input and Output.#
#np# In Algol 60 there do no exist in- and outputprocedure, but
because it is not Algol 60 but DJS-6 Algol the Pascalprograms should
be translated to, we will wait and see which in- and outputfacilites there are 
in DJS-6 Algol.
#ns 1,4,3.2.7. Implementing of CHAR and TYPE.#
#np# In Algol 60 there is no CHAr and TYPE, therefore we implement it
as integer.
#ns 1,4,3.2.8. Implementing of SET.#
#np# vides end nu ikke 
#ns 1,4,3.2.9. Differences between Algol 60 and Pascal.#
#np# In this sections we will describe things you can find in Algol 60
but not in Pascal. Because it is Pascalprograms, there should be translated
to Algol, it do not give any problems that there in Algol are some facilites,
whisc do not exist in Pascal, but the things ought to be mentioned as a 
matter of form. In Algol there is labels and jump-statement, these do not
exist in Sequentiel Pascal.
#ns 1,4,3.2.10. Typographical Differences.#
#np# Some of the special symbols are typographical different but with thw
same meaning.#np# Because the special symbols also are typographical different
in Algol 60 contra DJS-6 Algol we have made a table in section 3.3.3, where
you can see how the symbols look in the three languages Seguentiel Pascal,
 Algol 60 and DJS-6 Algol.
#ns 1,4,3.3. Algol 60 Contra DJS-6 Algol.#
#np# As all ready mentioned above in section 3.2 the greatest differences
between Algol 60 and DJS-6 Algol are in the input/outputprocedures and
the typographical differences.#np#Further we now know, that there is some 
things in Algol 60, which do not exist in DJS-6 Algol.
#ns 1,4,3.3.1. Input/Outputprocedure.#
#np# In Algol 60 there is no input/outputprocedure at all. In DJS-6 Algol
there is as far as we know from the Chinese Algolmanual the following
procedures:
#sj#
READR(A,B):   reading real numbers to variables A and B
READI(A,B):   reading integers to the variables A and B
INPUT(A):     reading to a array A
OUTPUTI(A):   printing the value of the integer variable A,what the exact
PRINTA(A):    difference between these two procedures are, it has not
              been possible to find out
OUTPUTR(A):   apart from it is now real and not integer which is printed
PRINTR(A):    there is no difference between these procedures and
              OUTPUTI and PRINTI
OUTAR(A):     printing the array A
PRINTS(S):    printing the string S
#rj#
#np# Because you in Sequentiel Pascal can read, treat and write symbols 
and strings, we are compelled to make some procedure, because there is
no in DJS-6 Algol. In the manual we have got, there is too little about
internal representation so we can make the procedure. There is a machinelanguage

CODE which you can use to make such a things, but there is no closer 
description of CODE, so it is impossible for us to make the input/
outputprocedure. Our solution on the problem is, that we have named
some procedures, which we have used in the translated Pascalprograms,
that is the DJS-6 Algolprograms. We will in the userguide write a list
with the procedures and what they are going to do, so the Chines must make the procedures them selves.
#ns 1,4,3.3.2. Comments.#
#np# As far as we can see in the Chinesemanual, there is no possibility
to write comments in DJS-6 Algol.#np# This of small importanc, because
the comments, there is written in the Pascalprogram, can not be placed in
the right places in the Algolprogram, because the rules, how you can
place comments in Pascal, are less restrictive than Algol.
 #np#Since the user/the programmer do not have to change in the 
DJS-6 Algolversion of a program, it does not mean so much whether there is
comments or not.
#ns 1,4,3.3.3 Special Symbols in the Different Languages.#
#np# In Pascal you cannot see in the program, if a word is reserved,
whereas all resved words in DJS-6 ALgol are surrounded of ' ex. 'BEGIN'.
#sj#
           Typographical differences.

    Pascal             Algol 60               DJS-6 Algol

      +                   +                       +
      -                   -                       -
      *                   x                       x
      <>                  =                      'NQ'
      =                   =                       =
      :=                  :=                      :=
      <                   <                      'LS'
      <=                  <=                     'LQ'
      >=                  >=                     'GQ'
      >                   >                      'GR'
      (                   (
#ns2,2,4. Program description.#
#np#The translater consist of two parts, one which build up the tables which
are necassary to syntaxchegue and translate the Pascalprogram, that is, the
tables contain identifiers and what kind of type they are, reserved words and
so on.#np#The other part of the translaterprogram consist of a lot of procedureswhich are recursive. Every procedure interprete one of the rules described in the 
Sequentiel report.
#ns2,2,4.1. Description of The Tables in The Translater.##np#
The first two tables we will describe are the Nametable and the Searchtable.
#np#The Nametable contains information of all reserved word and of all
declared identifiers.All the information about one reserved word or one
identifier, which are stored in the Nametable we call a Namerecord in the
rest of the description.#np#The search in the Nametable is done by means
of the Searchtable. You calculate a randomiziced key by using all characters in the reserved word or identifier (hashkey), this key is used as index in the Searchtable.
The Searchtable contains information about where in the Nametable the information
about the reserved word or the identifier is.#np#Because you can have more than
one reserved word or identifier, which give the same indexkey to the Searchtable,
it will always be the last inserted identifier or reserved word, the Searchtable
points to.If there is more than one word with the same key, there will be
pointers in the Nametable to the previous inserted Namerecord, and the pointer
of the first inserted Namerecord with a specific key is nill. By doing so
the Nametable is growing compact from top to bottom, because you always
put new Namerecords just behind the previous, and you save a lot of space.
Since a entry in the Searchtable points to the last Namerecord in the
Nametable with that specific key, and pointers in the Nametable always
points at the previous record with the same key, we will, if you declare
the same identifier on different blok levels, always first get the last declared

identifier on the deabest bloklevel. That is ok, but we leave a level, that is, we are going to a lower level,
you will still get the last inserted identifier, the identifier to a deaber
level, than we are on now.We have made a leveltable called Niveautable,
because we want to escape that. The Niveautable contains information about
where in the Nametable the different levels start. When we leave a level
going to a lower, all the identifiers to the higher level are going to
be enhooked from the Nametable by means of the Searchtable.#np#In the
Searchtable there is some spaces, because the keys, you got, depend on
the name of the identifiers and the function you use to calculate the key
with. It is not necassary to have a searchtable as great as the highest key.
You can take modulus of the number you have calculated. The number you
take modulus with is the size of the searsctable.Because you want it as
fast as possible, you have to let the size of the searchtable be a 
primenumber, then you have a greather chance to get different keys. Our
Searchtable have 253 index.#fg150##ns2,2,4.2. Information in a Namerecord.#
#np# As all ready mentioned a Namerecord is all the information about on
identifier or one reserved word, which is inserted in the Nametable. The
length of a Namerecord according to the type of the identifier or reserved word.it has information about, but it always has a minimum length containing some
basic information.
#ns2,2,4.2.1. Basicinformation in a Namerecord.##np#
#sj#
 

                        The identifiername or the reserved word.
                        There is one characters in each entry.

                        Pointer to the previous entry in the Nametable
                        with searchkey. The first identifier in the list
                        has nill in this place.


                        Length og the record in the Nametable. 
                        Minimum 5 basisinformation.

                        Number of characters in the identifier name or
                        reserved word.

                        Type of the identifier or reserved word.
                                
                        Type id.
#rj#
      )                   )

#rj#
#ps#
5. Userquide in a Translater from Algol to Pascal.
--------------------------------------------------
#np#since it had turned out, that there is a demand for translation of 
programs written in Sequentiel Pascal and implemented on a PDP11/45
machine to Algolprograms, which shall be implemented on a DJS-6 machine
we have made a translater, which can solve this problem.
#np#Because the translater is implemented in Denmark, but is going to be
used in China on a machinetype, which do not exist in Denmark, it
has not been possible to finish the translater completely, as there is
missing some input/output procedures, which are rather machinedependent.
These input/output procedures we have no chance to implement, because
we miss an exact description of the machinelanguage CODE in which the
procedures ought to be written.#np#Because these input/output procedures are
going to be written, before the translater can be used, there is in section
5.1. a description of what is required to done, before the translater can be 
used and in section 5.2. there is a desciption of, hwo the translater is
used, when the input/output procedures are written, that is, there is a
firsttime bootstart and then the daily use of the translater.
#np2,2,5.1 The First Time the Translater Is Going to Be Used.#
#ns#We have tried to make the translater as machine independent as possible.
Three files is demanded for storing of programs. These files could be arbitrary
devices connection with the machine or files in memory of the machine. The three
files are as follow:#sj#

1) A file which contains the Pascalprogram, which is going to be translated,
   this is called the sourcecode.

2) A file which contains a list of the Pascalprogram included errormessage,
   because the translater syntaxchegues the Pascalprogram at the same time,
   as it translate it.

3) A file which contains the Algolprogram, that is the translated Pascalprogram,   called the objectcode.

#rj#The procedures, it is necessary to make before the translater can be used,
are following:#sj#

Sourcechar(char)   read a character from the sourcefile, where the Pascal-
                   program is stored

Objectchar(char)   write a character to that file, where the Algolprogram
                   is stored

Listchar(char)     write a character on that file, where the list of the
                   Pascalprogram and the syntaxerrors is stored
#rj##nl#All the procedures should accept and return charactervalues as integer
in the ISO Alphabet.#ns#The procedures should have the names used above,
cause it is these names, which are used in the translater.#nl#The parameter
char should be declared as integer.#nl#The three procedures should be inserted
in the begining of the program, which contains the translater. They are going tobe inserted at that place, where our procedures with these names are.#nl#
When these procedures work and are inserted in our program, the translater
is going to be read in the DJS-6 machine.#ns#That demands, that hte translater is to found on a medium, which can be read of one of the external devices, which
connected to the DJS-6 machine."ns#We supply the translater on a 5 channels
papertape (we know from the manual we have got from China, that there is a
5 channels papertapereader) plus a list of the translaterprogram.#ns#If hthe
papertape could not be used, it is necessary by means of the list to get
the translater on a medium, which can be read at the machine.#nl#When the
translater is stored in the memory the translater can be used, as described
in the next section 5.2. The Daily Use of the Translater.
#ef#
scope user rapport
finis
#ns2,2,5.2. The Daily Use of the Translater.#
#nl#It is expected, that the translater itself, at the present time is stored in
the memory of the DJS-6 machine. If not read section 5.1.#np# The Pascalprogram should be on the medium, that the procedure Sourcechar(char) read from.#nl#
When you run the translaterprogram you got a list of the syntaxchequed Pascalprogram
with errormessages on the medium the procedure Listchar(char) write on, 
plus the translated Pascalprogram, that is, the Algolprogram written on
the medium the procedure Objectchar(char) write on.#np#If the Pascalprogram
has no syntaxerrors, the file with the Algolprogram is read and running as a
niversal Algolprogram.#np#
If there are some programerrors or syntaxerrors, you can correct these errors
in the Pascalprogram and then start again as it was a new program.#ns#
▶EOF◀