UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

Language and computer design for effective software systems Lillich, Alan W. 1979

Your browser doesn't seem to have a PDF viewer, please download the PDF to view this item.

Item Metadata

Download

Media
831-UBC_1979_A6_7 L54.pdf [ 5.86MB ]
Metadata
JSON: 831-1.0051808.json
JSON-LD: 831-1.0051808-ld.json
RDF/XML (Pretty): 831-1.0051808-rdf.xml
RDF/JSON: 831-1.0051808-rdf.json
Turtle: 831-1.0051808-turtle.txt
N-Triples: 831-1.0051808-rdf-ntriples.txt
Original Record: 831-1.0051808-source.json
Full Text
831-1.0051808-fulltext.txt
Citation
831-1.0051808.ris

Full Text

9  LANGUAGE AND COMPUTER FOE  DESIGN  EFFECTIVE SOFTWARE SYSTEMS  ALA M W.  by LILLICH  B.S., M a t h e m a t i c s , Oregon S t a t e U n i v e r s i t y , 1975 B-S., Computer S c i e n c e , O r e g o n S t a t e U n i v e r s i t y , 1975  A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOE THE DEGREE OF MASTER OF SCIENCE  in THE FACULTY  OF GRADUATE  STUDIES  (Department o f Computer S c i e n c e )  We a c c e p t t h i s t h e s i s a s c o n f o r m i n g to the r e q u i r e d s t a n d a r d .  THE UNIVERSITY  OF B E I T I S H COLUMBIA  J a n u a r y , 1979 (cp  A l a n W. L i l l i c h ,  1979  In  presenting  an  advanced  the I  Library  further  for  his  of  this  written  thesis  degree shall  agree  scholarly  by  this  at  the U n i v e r s i t y  make  that  it  purposes  for  freely  permission  It  financial  of  British  gain  Columbia  2075 W e s b r o o k P l a c e V a n c o u v e r , Canada V6T 1W5  Date  / / .  / ? " 7 ?  of  Columbia,  British  by  for  shall  that  not  the  requirements  reference copying  t h e Head  is understood  permission.  University  of  for extensive  Depa rtment The  fulfilment  available  may b e g r a n t e d  representatives. thesis  in p a r t i a l  of  I agree and this  be a l l o w e d  or  that  study. thesis  o f my D e p a r t m e n t  copying  for  or  publication  without  my  Abstract  This supportive,  thesis  describes  research  projects.  implementation for  writing  products. of  of a high operating  It  design  and  control  host  machine has  for  computers;  code  compact and  the  used  with  here  is  an  systems.  design  t o be  second  software control  data  and  p r o j e c t i s the  products  compared  are and  be  a  to  most  This todays  fast.  designed,  are developed, effort.  the  of  a  t h e o b j e c t code i s v e r y  well  viable  environment f o r  is  s t r u c t u r e d languages.  i s simple,  systems  and  suitable  large  powerful  The  block  a minimum amount of human to  other  with  machine i s r e a s o n a b l y  intended  the  o f a machine a r c h i t e c t u r e which  generation  software  is  mutually  f o r t h e c r e a t i o n and  structures.  advantages  space-time  production of software  among  along  modern  several  Effective  first  but  language intended  systems  implementation  congenial  h a v e "low"  level  processes  distinct,  The  provides f a c i l i t i e s  asynchronous  "sequential"  two  first  The  maintained work  step  production  reliable,  presented  towards of  and  the  effective  Language and Machine Design f o r E f f e c t i v e Software Systems i i i Table of Contents PAST 1 - The programming language WISCH ....................... 1 A. I n t r o d u c t i o n t o WISCH ... . 1 B. Excuses and r a t i o n a l i z a t i o n s ........................... 3 C. Overview 6 C . l . Programs and processes ............................ 6 C.2. Statements ....................................... 13 C. 3. Data types, l i t e r a l d e n o t a t i o n s and e x p r e s s i o n s .. 14 C-4. Modules ............... ---16 D. P r i m i t i v e elements .................................... 17 D. I . Alphabet, i d e n t i f i e r s and comments ............... 17 D.2. Reserved words .....................................19 D.3. S p e c i a l symbols .................................. 20 D.4. Standard i d e n t i f i e r s ............................. 21 D.5. A note on the syntax graphs ...................... 22 E. C o m p i l a t i o n u n i t ...................................... 24 F. D e c l a r a t i o n s .......................................... 25 F.1. Constants ........................................ 25 F.2. Types ............. ..................... 26 F.2. 1. A s s i g n a b l e types .......... ............ 29 F.2.1.1. S c a l a r t y p e s ........................... 29 F. 2.1.1.1. Boolean ................ ........ 30 F.2.1.1.2. Character 31 F. 2. "1.1.3. Integer ..................31 F.2. 1.1.4. Storage 33 F.2. 1.1.5. Enumeration ........................ .34 F. 2. 1.1-6. Subrange .......................... 35 F.2.1.2. Real 37 F. 2. 1.3. Powerset . 40 F-2-1.4. S t r i n g ..... 43 F. 2-1.5. Normal p o i n t e r ......................... 46 F.2.2. Array ............................... 49 F.2.3. Record 51 F.2.4. Pool p o i n t e r 53 F.2.5. Pool 54 F.2.6. Process ..................................... 55 F.2.7. C o m p a t a b i l i t y , c o e r c i o n s and a t t r i b u t e s ..... 56 F.3. Variable 60 F.4. Program .......................................... 61 F.5. Procedure ........................................ 63 F.6. Function ......................................... 64 F.7. Module 65 F. 8. Scope of names ................................... 67 G. Statements ............................................ 69 G. 1. Block ......69 G.2. Assignment ....................................... 70 G.3. Procedure c a l l ................................... 72 G.4. Return ........ ....................... ...... ...... 72 G.5. I f 73 G.6. Loop 74 G.7. E x i t 75  Language and Machine Design f o r E f f e c t i v e Software Systems  H. I. J. K. L.  iv  G.8. For 76 G.9. I t e r a t e 77 G.10. Fork .......... 78 G. 11. Bind 79 G. 1 2. A s s e r t .... ........ 79 G.13- C r e a t e . . 80 G.14. S t a r t 80 G.15. Stop ... 81 G.16. Destroy .......... 81 G.17. Await 82 G.18. Send ......... . .................. 82 G.19. Option 83 E x p r e s s i o n s ........................................... 84 I/O f a c i l i t i e s 87 Loading and running programs dynamically .............. 89 Implementation o f WISCfl . .. ..--90 Future work with W.ISCH ... ..... 92  PAST I I - The a r c h i t e c t u r e  of a stack processor ............. 94  M. N. 0. P.  I n t r o d u c t i o n t o ASP ................................... 94 B a s i c s t r u c t u r e of ASP ---- 95 Design r a t i o n a l e ...................................... 100 I n s t r u c t i o n r e p e r t o i r e ............................... 102 P.I, One address i n s t r u c t i o n s ........................ 102 P.2. Immediate operand i n s t r u c t i o n s .....................104 P.3. Jump i n s t r u c t i o n s ............................... 105 P.4. Program r e l a t i v e i n s t r u c t i o n s ................... 106 P.5. Memory b l o c k i n s t r u c t i o n s ....................... 106 P.6. Zero address l o a d , s t o r e 6 save ................. 107 P.7. Machine r e g i s t e r a c c e s s .........................108 P.8. S h i f t i n s t r u c t i o n s .............................. 109 P.9. Word o p e r a t i o n s 10.9 P.10. Real o p e r a t i o n s ................................ 110 P.11. Other i n s t r u c t i o n s ............................. 110 Q. Implementation o f ASP ...................115 R. Future work with ASP ................................. 117  B i b l i o g r a p h y ............................................... Appendix 1. Shy WISCfl with a C?  ..........  119  . 121  Language and Machine Design f o r E f f e c t i v e Software Systems Acknowledgements  I would l i k e t o thanki My wife Pat, f o r her p a t i e n c e and  support- ...  My a d v i s o r Bary P o l l a c k , f o r h i s help and Dave Brent, f o r the e x c e l l e n t work done on The  the  compiler.  department, f o r p r o v i d i n g a s a l a r y f o r Dave.  My o f f i c e My  guidance.  mates, f o r t h e i r good company.  b i c y c l e , f o r teaching me  the value of p a t i e n c e .  v  A. I n t r o d u c t i o n to HISCH  WISCH Heport A.  1  I n t r o d u c t i o n t o HISCH  High  l e v e l languages have f i r m l y e s t a b l i s h e d themselves as  the only s e n s i b l e t o o l f o r  so-called  applications  programming  t a s k s , but with a few notable e x c e p t i o n s , the realm of "systems" programming has remained w i t h i n language  hackers.  The  combined  commonly a v a i l a b l e languages, the  need  f o r space/time  the t i g i i t  grasp  of  assembly  e f f e c t s of the inadequacy o f  the need t o " c o n t r o l the machine",  e f f i c i e n c y and the t e r r i b l y backward  s t a t e of most contemporary computer a r c h i t e c t u r e s have made t h i s area very r e s i s t a n t t o the i n t r o d u c t i o n of h i g h - l e v e l languages.  WISCH  p r o v i d e s one approach t o language design f o r systems  programming. based and  I t i s a member of the  languages,  for  family  of  It provides  traditional  powerful  sequential  data  and  tasks  mechanisms f o r the c r e a t i o n and c o n t r o l of groups of processes.  1  The  PASCAL  bearing c l o s e s t resemblance t o PLATON [SOB 7 5 J  MODULA £WIB 7 6 ] .  structures  growing  philosophy  of  WISCH  control  along  concurrent  i s that the programmer  should c o n c e n t r a t e on the high l e v e l s t r u c t u r e of a system, not  on  with  and  the d e t a i l s of how that s t r u c t u r e i s t o be implememted.  Thus f o r example, c o n c u r r e n t p r o c e s s i n g f a c i l i t i e s are  provided  T h e word " s e q u e n t i a l " here r e f e r s t o the w e l l - d e f i n e d flow of control found i n most languages. Programs w r i t t e n i n F0RT8AN, COBOL, PASCAL, e t c . are a l l s e q u e n t i a l programs. A " c o n c u r r e n t " program i s a s i n g l e program embodying two or more asynchronous processesThe moment-to-moment l o c u s of control in a concurrent program may depend not only on the source program and data but a l s o on e x t e r n a l o b j e c t s such as p e r i p h e r a l d e v i c e s , schedulers, e t c . l  WISCH Report as  A. I n t r o d u c t i o n t o WISCH  language  primitives  implementation. operating  In  system  with  effect,  checks  specification  the language  provides  of t h e i r a  small  k e r n e l , s i m i l i a r t o those c o n s t r u c t e d i n more  t r a d i t i o n a l manners (eg., s t r o n g l y typed  minimal  2  language,  see £ K AH 78 j ) . attempting  WISCH  i s also  t o make maximal compile  on the v a l i d i t y of programs and using  run-time  a  time  checking  where necessary.  The  language  should be u s e f u l f o r c o n s t r u c t i n g c o n c u r r e n t  systems where the data s t r u c t u r e s and a l g o r i t h m s used important  than  the low l e v e l d e t a i l s of how the i n d i v i d u a l  are implemented and c o n t r o l l e d . include  operating  instrument aspects  systems,  monitors, e t c .  of  are  Obvious  areas  of  more tasks  application  terminal concentrators, laboratory  With i t s emphasis on the high  level  i n t e r - t a s k communications r a t h e r than the low l e v e l  d e t a i l s o f a p a r t i c u l a r implementation,  the language should  be u s e f u l i n areas where " r e a l " p a r a l l e l i s m would be very  also  useful  but i s not o f t e n found, such as s i m u l a t i o n , g r a p h i c s , m u l t i - p a s s compilation, etc. see i DIJ 78].)  (For a n o v e l a p p l i c a t i o n of multi-programming  B. Excuses and r a t i o n a l i z a t i o n s  HISCH Report  3  hs. Excuses and r a t i o n a l i z a t i o n s  Existing high-level successful  been  used  to  write been  used f o r some years by Burroughs f o r systems on t h e i r B5500  and  machines.  systems.  have  A v a r i a n t of ALGQL-60 has  later  operating  languages  MULTICS i n PL/I and UNIX i n C are probably the  best known examples.  Others i n c l u d e OS-6  SOLO  Pascal J. BEI 7 5 3 -  in  Concurrent  PLATON and SUE £ ATW  (almost) be w r i t t e n .  The language must All  MODULA,  t  c o l l e c t i o n s of complex  which  wheel?  programming  on  a  were developed:  provide  large  and  Given t h i s body of  i n v e n t yet another v e r s i o n of the  minicomputer, s e v e r a l c r i t e r i a  structures.  72J  EUCLID *.LAM 7 7 \  In l o o k i n g f o r a language to do systems  1.  1STO  7 2 ] , a l s o a r e i n t e r e s t i n g languages i n  operating systems could e x i s t i n g work, why  i n BCPL  powerful  software  data  systems  and are  control primarily  data s t r u c t u r e s and a l g o r i t h m s f o r  their  manipulation. 2. In balance with the above c r i t e r i o n , the not be e x c e s s i v e l y 3. The  language  must  mechanisms  for  large.  language  concurrent programming.  must  have  built-in  (An a r b i t r a r y  d e c i s i o n t o r e s e a r c h what  c o u l d be done with such languages.) 4. The language must p r o v i d e adequate f l e x i b i l i t y to handle a wide range o f " r e a l " problems, p a r t i c u l a r l y operating  systems.  I t must be more than a toy.  in  the  area  of  HISCH  Eeport All  B.  of  the  these  criteria.  data  structures  Strachey  claim  should,  in  BCPL and  data is  are  too  weak  to a  weak  in  in  the  be  rich  and  nested  (eg.  EUCLID and  languages.  and  design  s t i l l  was  to  the PL/I  unimplemented that  correctness  mechanically  the  rather  language  several Chief  novel among  declarations different rather  from  large  these and  are the  software around  and  This  representation i s  system  control  fundamentally  programmer C  i s also  often  weak  Concurrent It  not  only  routines.  The  structures  (eg.  lack are  of  numeric  far  PL/I  A  programs This guite  could  be  the  ability  module  type  has  EUCLID  could  difficult  module o f  MODULA a n d  and  baroque  language.  making  parametrize  WISCH).  SUE  has  implement.  (whose p r o p e r t i e s  the  i t s  also  to  a  their  in  It  hard  of  have  or be  i s  goal  resulted  large.  to  to  notoriously  major  of and  subranges large  conditions.  language.  and  too are  levels,  precision)  PASCAL-like  both of  data  on  Pascal  scope  verified.  that  language  multiple  EUCLID  complex  features  and  Algol-like  Many f e a t u r e s  ensure  Stoy  mechanisms.  implement, e s p e c i a l l y e x c e p t i o n a l  new  designers).  data structures.  procedural  of of  ideal  the  more area  storage  that  or  the  concentrated  i n some a r e a s  others  meet one  much l e s s e r e x t e n t .  routines  even allow  enumerations).  to  of  their  programmer."  and  but  f a r too  pratical  i n t e n t of  the  control  recursive  PL/I  the  to  structures,  does not  weak i n  WISCH p h i l o s o p h y  deplorably  it  very  matters concerning  powerful  forbids  PLATON a r e  opinion,  much  needs  to  our  left  the  fail  resources  and  opposed t o  (by  4  rationalizations  languages  "The  facilities, very  above  E x c u s e s and  type  are  i s  Only Concurrent  quite  also  a  Pascal,  WISCH R e p o r t  B- E x c u s e s a n d r a t i o n a l i z a t i o n s  MODULA a n d PLATON h a v e m e c h a n i s m s (The  multiprogramming  unsuitable.) to  fall  operating  facility  short  on  point  4.  PL/I i s archaic  and  HODULA, n e v e r i n t e n d e d t o be an  system language, a l s o f a i l s  designing  of  programming,  The " s t a t i c " n a t u r e o f c o n c u r r e n t P a s c a l c a u s e s i t  S i n c e no s u i t a b l e of  f o r concurrent  5  a  new  language  an e x i s t i n g o n e .  was f o u n d , t h e c h o i c e became o n e  l a n g u a g e o r a d a p t i n g an e x i s t i n g  p r o v i d e t h e n e c e s s a r y freedom c r e a t e a new l a n g u a g e  t o meet p o i n t 4.  i n t h e d e s i g n i t was  one.  decided  To to  from s c r a t c h r a t h e r than attempt t o modify  WISCH C.  C.  Report  section  and s e m a n t i c s  At t h e processes.  of  A process  is  WISCH i s  that  processes  are  PROGRAM  have  from  programs formal  among  some  set  of  the  syntax  (Process  provide which  parameters,  like local  statements  for  a  body.  procedures,  they  have  unit  of  some  set  objects.  sequential  be  CREATE  assumed that is  Each manner.  since  A l l processes  except  refered  static  processes  a lot  may  and  they  execute  about  the  "high p r i o r i t y " described  statement.  later  Facilities  c o m m u n i c a t i o n and s y n c h r o n i z a t i o n .  may b e  the  the  "parallel"  priority  and t h e  is  programs  executing  purely  in  of  data  computations.  processes  and  It  processor  execute  interprocess  names  look  a  nothing  declarations  Programs objects  but  favored.  provided for  Processes  processes  speed,  speeds  is,  instructions in a  independaat  relative  under  its  different  a non-zero  to  a language  a dynamic o b j e c t .  activity;  essentially  introduction  WISCH.  level,  executes  However,  are  a brief  i n s t r u c t i o n s and a f f e c t i n g  process  at  provides  outermost  computational  are  6  Overview  This  of  Overview  to  by t h e i r  model of may  be  procedures.  no k n o w l e d g e  of  i n s t r u c t i o n s and created.  They have  declarations Programs  creators.  and  may their  a  Textually, a heading  with  sequence  of  be n e s t e d , outer  data  but  unlike  environment-  c . Overview  WISCH Report A MiSCH system all  c o n s i s t s of an outermost  nested o b j e c t s .  "operating  system"  That i s , written  a  WISCH  ( l e v e l zero) program and system  i n WISCH.  When  execution an anonymous process i s c r e a t e d level  zero  program).  is a  complete  a system  (modeled  begins  after  the  As t h i s process executes, i t may c r e a t e  other processes modeled a f t e r the inside  7  t h e l e v e l z e r o program.  programs  immediately  nested  Because o f the nested nature of  programs, a WISCH system e x h i b i t s a tree s t r u c t u r e of  processes  with the o r i g i n a l process as t h e r o o t .  These  concepts  simplified) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28  are i l l u s t r a t e d  by  the f o l l o w i n g  example:  PROGRAM Example; PROGRAM  prog_faz(CONST more: BOOLEAN) ;  PROGRAM prog_bazfaz; { d e c l a r a t i o n s f o r prog_bazfaz}; BEGIN prog_bazfaz {body c f prog_bazfaz]; END p.rog_fcazfaz; VAR p r o c e s s _ f 1 , p r o c e s s _ f 2 : PROCESS; BEGIN prog_faz CREATE processor 1 FROM prog_bazfaz; START p r o c e s s _ f 1 ; IF more THEN CREATE p r o c e s s _ f 2 FROM prog_bazfaz; START p r o c e s s _ f 2 ; Fl; {rest of prog_fazj ; END prog_faz; PROGRAM prog_foo; {declarations f o r prog_foo]; BEGIN prog_foo {body of prog_foo} ; END prog_foo;  (much  C. Overview  WISCH Report 29 30 31 32 33 34 35 36 37 38 39  VAR p r o c e s s _ a , process_b,  8  process_c : PROCESS;  BEGIN Example CREATE process_a FROM prog_faz (true) ; START p r o c e s s _ a ; CREATE process_b FROM prog_faz (false) ; START process_b; CREATE process_c FROM prog_foo; START p r o c e s s _ c ; {rest o f the body of example] ; END Example .  The nodes of the process t r e e are drawn;  i  J |  i  In  process program  this  1  | | i  diagram, "process" i s the name o f the process v a r i a b l e  and "program" i s the name of t i e program after.  Immediately  is: | (anonymous)| | Example |  before  that  Example executes  i t is  modelled  l i n e 30, the tree  C. Overview  WISCH Report assuming  that  Example  finishes  line  33  just  as  9  process_a  f i n i s h e s l i n e 19, but before process_b a c t u a l l y s t a r t s , the t r e e structure i s ; ] (anonymous) | \ Example ] L  1  J  -J  i i  i i  i  T  | process_a J I prog_faz J  1 process_b | I prog_faz J  T  J T  |process_f1 | J prog_bazfaz|  J process_f2 | 1prog_bazfaz|  i  F i n a l l y , a t some l a t e r time the t r e e i s ; J (anonymous) | 1 Example | I J T  I T "i  i  J process_a J 1 prog_faz |  ] process_b j \ prog_faz I  1  T  j process_c | \ prog_foo |  I  S I T  T  |process_f2 | 1prog_bazfazj  jprocess_f1 J J prog_bazfazj  1  i  i T ~i  |process_f1 | J prog_bazf az J i  I 1  L  t  although  there  are  two  processes  patterned a f t e r prog_bazfaz,  J  with  names process_f1 and  they a r e d i f f e r e n t processes having  WISCH Report different  C. Overview  parents.  Since a program cannot  10  d e c l a r e two v a r i a b l e s  with t h e same name and can r e f e r o n l y t o i t s immediate o f f s p r i n g processes  by name, there i s no c o n f u s i o n about which process i s  being r e f e r e d has  a  to a t any p o i n t .  unigue  path  In other  name from  words,  every  the r o o t process t o i t s e l f .  example, t h e l e f t m o s t process on t h e bottom l a y e r of diagram  has  a  path name of  and the righmost  process  the  For above  (anonymous).process_a.process_faz1  process on t h e bottom l a y e r has a path name  of  (anonymous).process_b.process_faz1.  Communication  and  message p a s s i n g f a c i l i t y  synchronization  among processes uses a  modeled a f t e r that of PLATON.  Programs  may d e c l a r e pools o f shared o b j e c t s , request o b j e c t s from and  send o b j e c t s t o p o o l s .  Pools are a c t u a l l y linked  v a r i a b l e s , a l l of t h e same type.  I f two d i f f e r e n t  passed t h e same pool as a parameter, they it.  (Note  programs). pool,  that  the  parameters  of  communicate v i a belong  When a process requests access t o an o b j e c t  i t i s given the f i r s t  a list  lists  processes a r e  syntactically  and added to  no  a If  the end  of processes waiting f o r o b j e c t s from t h a t p o o l .  a process sends an o b j e c t t o a. p o o l , i f there are  to  from  one i f the pool i s non-empty.  the pool i s empty, the process i s stopped of  may  pools,  When  processes  w a i t i n g on that p o o l , the o b j e c t sent i s added t o the end of the list.  I f t h e r e are processes  pool,  the  continue. from  only  first  one  waiting  i s given  I t i s guaranteed  f o r objects  from  that  the new o b j e c t and allowed to  t h a t a shared o b j e c t can be accessed  one process at a time.  Shared  o b j e c t s may be passed  WISCa S e p o r t by  C.  reference  large  (processes are given p o i n t e r s  b l o c k s of d a t a  For  example,  system t h a t writes and  t c be  consider  reads i n p u t  output  a  from  on a n o t h e r  with  very one  device.  process,  computation processes  a  process  compute  Schematically,  communicates  input process  i  p o o l of f u l l input  J JL  —-i .  J | J I  1  that  i  i  i1  compute process 1 I I  r  process t o output  i  1  1  i<  | p o o l of Jempty i n p u t  1 |  i t ,  the  and  of  I/O  processes,  an  process.  The  output input  and  output  •  really here.  consume, and  «•  two  i  i  i  ;  J 1  output process  1 ,  r  1  1 j \ 1 1  J l<  «  I i  i  I  classical  producer/consumer  input process  t h e compute  t o consume.  a  -j | I I  i pool of J lempty output!  have The  I I j  i  J  1  process  an  | 1  A  j  relationships  and  three  i—>J p o o l of | J f u l l output l | l —  | J  we  "batch"  buffers.  i  | |  J i  Note  processes  I 1 I  1  1 j  dedicated  of  with  I  >|  simple,  the system i s ;  1 , J II  overhead.  allowing  To a c h i e v e c o n c u r r e n c y  process  v i a pools of shared  them),  little  device,  p r o c e s s i n g t h e s y s t e m i s composed  input  1 I  shared  to  11  Overview  produces f o r the  process  produces  compute for  the  C.  WISCH Report A  skeletal  version  everywhere  and  the n o t a t i o n "ffi POOLED type" denotes a p o i n t e r to a shared  o b j e c t of the s p e c i f i e d I 2 3 4 5 6 7 8 9 10 II 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44  12  of the code f o r t h i s system f o l l o w s , (For  now, simply note t h a t a PERVASIVE name i s known that  Overview  PROGRAM  type.)  batch;  PERVASIVE CONST i n _ l e n = (an a p p r o p r i a t e value} ; o u t _ l e n = {an a p p r o p r i a t e value}; no_in_bufs = {an a p p r o p r i a t e value}; no_out_bufs = (an a p p r o p r i a t e value.] ; PERVASIVE TYPE in_buf = STBING ( i n _ l e n ) ; out_buf = STRING ( o u t _ l e n ) ; VAR  empty_in, f u l l _ i n : POOL OF i n _ i u f ; empty_out, f u l l _ o u t : POOL OF out_buf; i n p u t , compute, output : PROCESS;  PROGRAM input_prog (VAR empty, f u l l : POOL OF in_buf) ; VAR b u f f e r : a POOLED i n _ b u f ; BEGIN input_prog FOR i ;= 1 TO no_in_bufs LOOP { a l l o c a t e buffers} NEW ( b u f f e r ) ; SEND b u f f e r TO empty NEXT; LOOP {read input f o r e v e r j AWAIT b u f f e r PRCM empty; { f i l l the b u f f e r } ; SEND b u f f e r TO f u l l RESPOND empty; NEXT; END input_prog; PROG BAM compute_prog (VAR f u l l _ i n : POOL OF i n _ b u f ; VAR empty_out, f u l l _ o u t : POOL OF o u t _ b u f ) ; VAR inbuf : 3 POOLED i n _ b u f ; outbuf : S POOLED out_buf; BEGIN compute_prog FOR i := 1 TO no_out_bufs LOOP { a l l o c a t e buffers} NEW (outbuf); SEND outbuf TO einpty_out NEXT; LOOP {process input f o r e v e r j AWAIT i n b u f FROM f u l l _ i n ;  C  WISCH Report 45 46 47 48 4.9 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70  Overview  13  AWAIT outbuf FROM empty_out; {produce the output from the i n p u t } ; SEND inbuf TO SENDER; SEND outbuf TO f u l l _ o u t SESPOND empty_out; NEXT; END compute_prog; PROGRAM output_prog (VAR f u l l : POOL OF out_buf) ; VAS b u f f e r : a POOLED out_buf; BEGIN output_prog LOOP {write the output f o r e v e r j AWAIT b u f f e r FROM f u l l ; {output the b u f f e r ] SEND b u f f e r TO SENDER; NEXT; END output_prog; BEGIN batch CREATE i n p u t FROM i n p u t _ p r o g ( e m p t y _ i n , f u l l _ i n ) ; START i n p u t ; CREATE compute F BOM compute_prog (f u l l _ i n , empty_out, f u l l _ o u t ) ; STABT compute; CREATE output FBOM o u t p u t _ p r o g ( f u l l ^ o u t ) ; STABT output; END batch.  C.2.  Statements  WISCH p r o v i d e s a p l e a s i n g , e c l e c t i c control  structures  from  such  blend  languages  of  the  better  as PASCAL, ALGOL-68,  EOCLID and PLATON, along with some r e c e n t l y p u b l i s h e d p r o p o s a l s . The of  structures provided f a c i l i t a t e  the c l e a r and easy e x p r e s s i o n  a wide v a r i e t y o f a l g o r i t h m i c concepts.  All delimited  "compound" statements syntax  with  major s y n t a c t i c u n i t s . sequence  of  statements  (IF, FOB,  etc.) have  a  fully  s h o r t , mnemonic keywords d e l i m i t i n g a l l T h i s " c l o s e d " syntax a l l o w s an a r b i t r a r y to  be  used  any  p l a c e that a s i n g l e  WISCH Beport statement  can  philosophy write. and  C. Overview with  of  no  WISCH  extraneous  is  to  BEGIN—END  pairs,  14 The  be easy t o read and reasonable to  V e r b o s i t y and redundancy a r e used t o improve  prevent simple e r r o r s from going undetected,  readability  while a v o i d i n g  the COBOL-esque extreme of h i n d e r i n g the programmer,  C. 3. Data types, l i t e r a l  In  denotations and e x p r e s s i o n s  the t r a d i t i o n of PASCAL, the p r i m i t i v e data types,  declaration  facilities  and  operators  of  WISCH  provide  programmer with a powerful t o o l f o r the manipulation of oriented  data.  Elements  MODULA, BCPL and PL/1. concepts  from  PASCAL,  and  the  from  string are  and  process.  enumerations,  shared  The l i t e r a l  denotations f o r the  quite f a m i l i a r .  denotation  The  of  compile  time.  the  the  and process  primitive  type  types  (bitstring), declaration  sets, pointers, arrays,  standard  primitive  types  Note that a l i t e r a l i s  f o r a data value t h a t r e p r e s e n t s i t s e l f ,  a l l literals A  type  Of note i s the a b i l i t y t o w r i t e s t r u c t u r e d  the i n t e g e r value 100 or the values  problem  variables).  l i t e r a l s o f s e t , array and r e c o r d types. a  a l l of  variable  PLATON.  subranges,  records and pools (of shared  are  almost  Among  the  from PASCAL, PLATON,  boolean, c h a r a c t e r , i n t e g e r , r e a l , s t o r a g e  character concepts  extracted  Included are  s t r u c t u r i n g type concepts include  are  type  literal  string  value  "abc".  such as  Thus,  the  (and l i t e r a l expressions) are known at expression  is  one  involving  only  C. Overview  WISCH Report literals,  declared  attributes  known  references  with  constants  at  compile  literal  known time  at  compile  and  expressions  as  constant i s used i n WISCH t o denote a name cannot  be a l t e r e d by a program  be.  time,  standard  function  arguments.  The word  for a  value  F o r example, a procedure  value, but  which The  doesn't  have  might d e f i n e a constant whose  value i s computed using a parameter of the procedure. of  data  (as opposed to a v a r i a b l e ) .  value of a constant i s o f t e n a l i t e r a l to  1 5  t h i s constant i s computed a t every procedure  The value  e n t r y , but once  i n i t i a l i z e d , the constant cannot be a l t e r e d .  Apart from boolean  the  widely  no  relational,  conversions  A l l expressions are " s e l f - t y p i n g " ,  type.  There  associated  are  are  almost  with o p e r a t o r s .  no  most  data t y p e s .  evaluated a t compile  automatic  some  code.  (but n o t  as simply:  s 1  b i s a l i t e r a l e x p r e s s i o n with the value TBOE.  t o be  guaranteed)  F o r example, the source  b THEN s i ELSE s 2 F l  might get compiled  type  attributes  L i t e r a l e x p r e s s i o n s are guaranteed  time, with p o s s i b l e  e f f e c t s on the compiled  if  that  Programmed c o n v e r s i o n s  are a v a i l a b l e though, along with the values o f  IF  and  c o n t e x t e x t e r n a l to an e x p r e s s i o n i s needed to determine  the r e s u l t  for  arithmetic  o p e r a t o r s , WISCH provides o p e r a t i o n s on b i t s t r i n g s , s e t s  and c h a r a c t e r s t r i n g s . is  used  line;  WISCH S e p o r t  C. O v e r v i e w  16  C.4. M o d u l e s  WISCH MODOLA. around  has  a  modularization  This allows sections  of  facility  similiar  to that of  t h e programmer t o b u i l d s e m i p e r m e a b l e w a l l s declarations,  p o r t i o n s of the o u t s i d e world  explicitly  a r e known w i t h i n  controlling the  module  what and  what o b j e c t s d e c l a r e d i n s i d e t h e module a r e known o u t s i d e o f i t . The m o d u l e p r o v i d e s  a means  of  hiding  implementation  details  f r o m p o r t i o n s o f t h e c o d e w h i c h h a v e no need o r b u s i n e s s k n o w i n g them.  WISCH Report  D. P r i m i t i v e elements  D. P r i m i t i v e  elements  This s e c t i o n d e s c r i b e s WISCH a t the lowest  lexical  level,  that of the s t r i n g s o f c h a r a c t e r s composing a l l programsis  17  a f r e e format language, a l l o w i n g source t e x t  to  be  WISCH written  anywhere on a source l i n e and a l l o w i n g blanks and/or comments t o occur between any s y n t a c t i c o b j e c t s -  However,  as  opposed  to  some languages, p h y s i c a l source l i n e s a r e sometimes s i g n i f i c a n t Comments and s t r i n g l i t e r a l s boundaries.  a r e not  allowed  to. cross  The i d e n t i f i e r s a f t e r the BEGIN and END of program,  procedure and f u n c t i o n bodies must be on the same l i n e s BEGIN  and END.  In t h e t r a d i t i o n o f other ALGOL-like  semicolons a r e used WISCH  allows  an  to  separate  optional  major  syntactic  (the examples  given  I t i s desirable,  that  allow  implementation  languages, constructs.  a r e terminated  throughout  w r i t t e n i n t h i s manner). an  this  report  but not  a programmer t o omit  where p o s s i b l e .  D.1.  as t h e  t e r m i n a t i n g semicolon f o r those who  p r e f e r t h e P L / 1 - l i k e r u l e that c o n s t r u c t s semicolons  line  Alphabet, i d e n t i f i e r s and comments Letters =  A B C D E F G H I J K L H N O P Q f i S T U V W X Y Z a b c d e f g h i j k l a n o p g r s t u v w x y z  Digits  =  0 1 2 3 4 5 6 7 8  Others  =  =  9  # ; : * " _ « • - * / - . &  (  I  )  { % a  3 »  < > $ #  with are  required, semicolons  WISCH Eeport The  D. P r i m i t i v e elements  s e t of  letters  in  upper and lower case l e t t e r s . the  cases  string  anywhere  literals.  in  18  WISCH c o n s i s t s of the 72 E n g l i s h No d i s t i n c t i o n  tbe language  i s made  between  except f o r c h a r a c t e r and  F o r example:  and. And, AND are  three ways t o s p e l l  pretend literals)  that  the same  a l l letters  preprocessor and not go wrong.  letters,  digits  The  programmer  case  (or lower  The s e t o f d i g i t s  Identifiers  and underscores  case)  a r e w r i t t e n as  (_). The f i r s t  be  of  arbitrary  This l i m i t must not be l e s s  s e t of  "other"  strings  than f i f t e e n  character  for  some s p e c i a l  special  however.  literals.  symbols a r e g i v e n  They  are  a l l  Of course, c h a r a c t e r s not  but i n the implementation string  identifier.  s e t may  Suggested below  be  used  transliterations  i n the section  on  symbols.  Comments brace  and  Identifiers  c h a r a c t e r s l i s t e d above i n c l u d e s a l l  found i n the 128 c h a r a c t e r ASCII s e t .  in  of  c h a r a c t e r must  c h a r a c t e r s i n an  other c h a r a c t e r s used as part o f the language.  used i n the language  a  l e n g t h , but an implementation may p l a c e a  l i m i t on the number of s i g n i f i c a n t  The  by  i s composed o f  be a l e t t e r and the l a s t must not be an underscore. may  can  {except those i n c h a r a c t e r or s t r i n g  a r e converted t o upper  the t e n d e c i m a l d i g i t s .  sord.  in  WISCH extend from a l e f t brace  {j) or end of the source l i n e  ({) t o a r i g h t  (which ever comes f i r s t ) .  s i n g l e comment may not c r o s s a l i n e boundary.  For example:  A  WISCH Report IF  D. P r i m i t i v e elements  19  a < b THEN a := b; {Select t h e l a r g e r of a and b-  or^ VAB ( i , j ) : = 0 With  this  {# u s e d j , k:=-1  convention  i t is  [next f r e e ) : INTEGEB; impossible  to  write "reversed"  programs and i t i s much e a s i e r to avoid i n a d v e r t a n t i n c l u s i o n o f code  in  comments.  Comments may be used anywhere i n the source  program t h a t a " t r i v i a l " be  nested,  so  blank may.  D.2.  also  that the f o l l o w i n g i s a l i n e t h a t i s c o m p l e t e l y  commented out by the f i r s t {  Comments i n WISCH may  left  brace and the end of l i n e s  dump_status ( c u r r e n t _ s t a t e ) ;  {for debugging  only)  Beserved words  The f o l l o w i n g ABS ASSAY ASSEBT AW A I T BEGIN BIND BLOCK BY CASE CONST CREATE DESTROY DIV DOING EL I F  table l i s t s  the r e s e r v e d words of WISCH;  ELSE END ENDBLOCK ENDFINAL EN D I N I T I A L ENDMODULE ENDS ECO BD EE BOB EXIT EXPORT EXTEBNAL  Fl FIN FINALLY FOB  FOSK FORWARD FROM FUNCTION HEAP IF IMPOST IN INITIALLY ITEBATE «IOIN LOOP MOD MODULE MYSELF  NEXT OF OPTION OTHER PEBVASIVE POOL POOLED PBIOBITY PBOCEDUBE PROGBAM BECOBD BEU BESPOND BETUBN SEND  SENDEE SET STACK STABT. STOP STRING THEN TIME TYPE UNBIND UNLESS VAR WHEN XOB  These words may not be used as user d e f i n e d i d e n t i f i e r s . although  Again,  they a r e w r i t t e n i n upper case throughout t h i s r e p o r t ,  they may l e g a l l y be w r i t t e n u s i n g any combination of lower c a s e .  upper  and  WISCH Report D.3.  Special  The  symbols  special  symbols  used  in  WISCH  can  be d i v i d e d f o r  convenience i n s y n t a c t i c s e p a r a t o r s and o p e r a t o r s . reserved  20  D. P r i m i t i v e elements  Some o f t h e  words are a c t u a l l y o p e r a t o r s , so they a r e l i s t e d  again  here. The  s y n t a c t i c separators are:  1  '•  *  (  )  {  •  1  $  }  £  1  *: =  : *=  :=  :=:  +:=  : +=  -: =  /: =  s/=  %t =  s«=  S: =  :£=  |: =  :| =  ; **=  &£: =  :&&=  1  : J 1=  IN: =  -.IN : -  DIV: =  : Div=  SEM:=  : BEH=  MOD: =  ;MOD=  XOR: =  : XOR=  <: =  :<=  -.<: =  : -.<=  <=: =  :<==  -<=: =  : -<==  >: =  ;>=  ->: =  : ->=  >=: =  :>==  ->=: =  :  *  1  perators a r e :  .m-m  •* ^  |s =  — —  +  -  *  /  DIV  REM  MOD  ABS  **  *  -»  &  1  6S  i i  XOR  <  -<  <=  -.<=  >=  ->=  >  ->  IN  -IN  Suggested t r a n s l i t e r a t i o n s f o r non-ASCII c h a r a c t e r {* and *) f o r { and j <. and .) f o r £ and J  sets  includ'e:  D.  WISCH Report D_4_ The  Stan dard  ADDR ATAN BOOLEAN CARD CEIL CHAR COS DECR DISPOSE EM PT Y EXP  FALSE 'FIND_CHA.fi FIRST FIRST_ELEM FLOOR INCB INTEGER LAST LAST_ELEH LENGTH LO_BND LOG LOG 1 0  identifiers  identifiers  MAX MAX_POS_SEAL MIN MIN POS SEAL NEW NIL PAD_STRING PR ED PROCESS REAL SOTATE ROUND  of WISCH-  SHIFT SIGN SIN SQRT STORAGE SUCC TAN TRUE TRUNC UP_BND VALUE SIZE WAITING  are t r e a t e d as though they are d e c l a r e d  i n a scope surrounding the WISCH program, procedure being  21  identifiers  f o l l o w i n g t a b l e l i s t s the s t a n d a r d  These  P r i m i t i v e elements  compiled.  The  standard  or  function  d e f i n i t i o n s f o r each are given  where they are introduced i n the body o f the  report.  Most  of  them are t r e a t e d e x a c t l y as though they are o r d i n a r y , programmer d e f i n e d names and may standard  redefined-  if  desired.  However,  the  type names (BOOLEAN, CHAS, INTEGER, PROCESS, REAL, and  STORAGE), the boolean pointer  be r e d e f i n e d  value Thus,  reserved words.  (NIL) to  values are the  (TRUE  and  FALSE)  and  pervasive  names  and  programmer  these  names  the  may  not  look  nil be like  WISCH Report D.5.  D. P r i m i t i v e elements  22  A note on the syntax graphs  Many s e c t i o n s of t h i s r e p o r t i n c l u d e syntax c h a r t s to t h e i r t o p i c .  1.  The " r u l e s " of these c h a r t s a r e as f o l l o w s :  Words w r i t t e n i n a l l CAPITAL l e t t e r s  words.  relevant  represent  reserved  They a r e i n a l l c a p i t a l s f o r i d e n t i f i c a t i o n only.  allows them t o be w r i t t e n as any combination of upper and case.  WISCH lower  Standard names are w r i t t e n i n upper case a l s o .  2. Items brackets  written  (<,>)  are  in  lower  case  and  enclosed  s y n t a c t i c o b j e c t s described  in  angle  with c h a r t s o f  t h e i r own. 3.  Seguences o f s p e c i a l c h a r a c t e r s a r e l i t e r a l s  representing  themselves. 4. A l l  charts  have a s i n g l e e n t r y a t the l e f t and a s i n g l e  e x i t at the r i g h t . 5.  Flow  i s , from l e f t or  up,  in  the charts i s b a s i c a l l y counter-clockwise,  to r i g h t ; o r down, from l e f t  from r i g h t t o l e f t and back down.  that  to r i g h t and back up; Arrows on the c h a r t s  help emphasize t h i s .  As an example c o n s i d e r the c h a r t f o r program, procedure and f u n c t i o n formal  parameters:  prog/proc/func f o r a a l parans :  —y  COSST  - V\B  -  <iaent> — I — s  < t y p e > -jc  WISCH Report  D, P r i m i t i v e elements  The parameters c o n s i s t of a l e f t one  or more d e c l a r a t i o n s separated  right parenthesis or  parenthesis  { () ,  by semicolons,  followed  23 by  f o l l o w e d by a  { ) ) . A d e c l a r a t i o n c o n s i s t s of the word CONST  the word VAE or n e i t h e r , f o l l o w e d by one or more i d e n t i f i e r s  separated by commas, followed by a c o l o n and a type., and type a r e d e f i n e d by other c h a r t s .  Identifier  WISCH Report E. Compilation  E„ Compilation  unit  24  unit  c o a p i l a t i o a unit :  E  <program declaration> 5<procedare declarat.ion> —T <functiou declaration> •  The procedure  the u n i t o f c o m p i l a t i o n i n WISCH i s a or  function.  c l o s e d scope, so a  A  compilation  separately  single  defines  compiled  piece  of  program,  a completely code  nothing about the environment i t i s e v e n t u a l l y used i n .  knows That i s  t o say, while an i n n e r procedure of a program has access t o objects  declared  i n outer  scopes,  a  separately  procedure declared at the same l e v e l has no those  outer  objects,  a s e p a r a t e l y compiled  access  to  a l l  compiled any of  program, procedure  or f u n c t i o n i s d e c l a r e d by s p e c i f y i n g t h a t i t s body i s EXTERNAL. (See  the s e c t i o n s  declarations.)  below  on  PROGRAM,  PROCEDURE and FUNCTION  WISCH Report F.  Declarations  25  Declarations  declarations : <constant d e c l a r a t i o n > <type d e c l a r a t i o n > — — <variable declaration> <prograni d e c l a r a t i o n > — <nrocedure d e c l a r a t i o n > <£unction d e c l a r a t i o n > <nodule d e c l a r a t i o a >  WISCH variable, any  has  s i x forms  of  declarations:  program, procedure and f u n c t i o n .  order,  provided  that  constant,  type,  They may be mixed i n  a l l identifiers  a r e declared  before  they are used.  (A s m a l l exception  of  I t i s a l s o i l l e g a l t o r e d e f i n e a name i n a scope  pointers.)  i s made f o r the o b j e c t  once i t has been used i n t h a t scope.  (This  i s explained  type  more  f u l l y below i n the s e c t i o n on scope of names.)  F . 1 . Constants  constant  declaration : PERVASIVE  <ident>  COHST  = — - <expressioa>  The CONST d e c l a r a t i o n allows i d e n t i f i e r s unalterable  values.  The e x p r e s s i o n  identifier.  compile time,  If  the e x p r e s s i o n  the CONST  with  may or may n o t be a l i t e r a l  e x p r e s s i o n , i t s type i s the type t h a t w i l l the  t o be eguated  declaration  be  cannot  associated be  essentially  with  evaluated a t declares  a  HISCH Report variable  F. D e c l a r a t i o n s  which  is  initialized  at  scope  entry  and  otherwise be assigned to- The PERVASIVE a t t r i b u t e i s in  the s e c t i o n on the scope of names.  Some examples of constant d e c l a r a t i o n s a r e : TYPE chars = SET OF CHAR; vec = ARRAY (1.-5) OF INTEGER; CONST s i z e = 100; ibm = "IBM"; hp = "HP"; t a r g e t = hp; d i g i t _ s e t = c h a r s (» 0. . * 9) ; 1o«er_case_set = c h a r s ( ' a . . * z ) ; a l p h a _ s e t = lower_case_set * d i g i t s ; codes = vec(0,2,4,6,8) ;  F.2. Types  typo d e c l a r a t i o n  :  PEHVRSIVE  TYPE  —  type <type nane> — — — — < s c a l a r typs> <sot type> < s t r i n g typ<3> <array typs> <rocord type> — — — — <norna.l p o i n t e r type> <pool type> 1  — —  »— <pool pointer type>  <ident>  <type>  26  cannot  discussed  WISCH Beport  F.  Declarations  27  type name : <iaent> —  1  <standard type naae> standard type naae :  standard s c a l a r  <standard scalar> real process  boolean — — char • integer ——- storage  This s e c t i o n d e s c r i b e s data types i n d e t a i l . and  semantics  presented and  here  also  function  apply  to  declarations.  The types  used i n  variable,  parameter  strongly  typed language, that i s types must be known at compile  time f o r a l l o b j e c t s and checking o f a l l operands A  large  variety  WISCH  syntax  is a  i s enforced.  of types a r e provided, i n c l u d i n g s i x s t a n d a r d  types and ten c o n s t r u c t o r s .  F. D e c l a r a t i o n s  KISCH Beport A c l e a r understanding of the data throughout  type  nomenclature  t h i s r e p o r t i s e s s e n t i a l to understand  28 used  the f o l l o w i n g  s e c t i o n s , so the f o l l o w i n g t a b l e i s presented; type  class standard  process real boolean character integer storage enumerated subrange string set array record normal p o i n t e r pool p o i n t e r pool module  scalar  assignable  shareable  structured  X X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  x X  X  X X X  X  X  X  <1>  <2> <2>  <1>  X X  X  <1> - Arrays and records a r e a s s i g n a b l e i f f a l l 11 tt II II n shareable <2> "  The  standard  types  are  the f i v e b u i l t - i n t y p e s .  types are those with values that can be mapped 1 t o 1 with finite  subset  of the i n t e g e r s .  which v a r i a b l e s o f t h a t t y p e types  are  those  may  Scalar some  Assignable types are those f o r be  assigned  to.  Shareable  f o r which o b j e c t s of t h a t type may be shared  among d i f f e r e n t processes  (pooled  objects).  Structured  are those f o r which " s t r u c t u r e d " values may be w r i t t e n .  types  WISCH Report  F. D e c l a r a t i o n s  J_.2-.l- A s s i g n a b l e  The  29  types  assignable  types a r e those t h a t may be i n v o l v e d i n an  assignment statement,  that i s a v a r i a b l e of  that  type  may  be  assigned t o .  F.2, 1. 1. S c a l a r types  The  scalar  t y p e s a r e the s i m p l e s t data t y p e s .  of any s c a l a r type a r e f i n i t e totally  ordered.  ( i n number and magnitude) and are  There e x i s t s a {machine-dependant) one-to-one  mapping between the values of any s c a l a r type and the i n t e g e r v a l u e s represented on the machine.  a  which  have  the  obvious  than, l e s s than o r equal t o , e t c . ) .  meanings The  subset  A l lscalar  share the r e l a t i o n a l operators <, -*<, < = , -«<=, =, -•=, >#  The values  >=,  of  types -»>=,  (less than, not l e s s relational  operators  have p r i o r i t y 0, lower than a l l other o p e r a t o r s .  There types. type  are  s i x standard  The f u n c t i o n s FIRST and LAST accept the name of a s c a l a r or  variable,  and r e t u r n the lowest and h i g h e s t values o f  the type r e s p e c t i v e l y . scalar  f u n c t i o n s defined f o r a l l s c a l a r  expression  The f u n c t i o n s SUCC  and  and  PEED  accept  a  r e t u r n the next l a r g e r and next s m a l l e r  values r e s p e c t i v e l y .  An attempt to take the SUCC of the l a r g e s t  value  of  or  the  PRED  the  smallest  value i s an e r r o r .  The  f u n c t i o n s MIN and MAX accept two s c a l a r e x p r e s s i o n s as arguments and  return  the  value  of the s m a l l e r and l a r g e r  respectively.  F. D e c l a r a t i o n s  WISCH Seport  INCH and DECR a r e provided to increment  Two standard procedures, and  decrement  scalar  30  (by  variables  "one").  They  are also  checked f o r range e r r o r s .  In a d d i t i o n , t h e name of any s c a l a r type may be used generic  transfer  function  to  appropriate  conversion  the implementation  by  range  between any s c a l a r type and the i n t e g e r s . machine  using  The  The  The  i s denoted  values  with FALSE < TRUE. boolean  The  d e f i n e d mapping  F o r example,  on  a  is illegal.  Boolean  type boolean  BOOLEAN.  checking.  the 128 c h a r a c t e r ASCII s e t , CHAR (7) i s t h e b e l l  c h a r a c t e r , INTEGER('a) i s 97 and CHAR (300)  F.2. 1. 1.1.  a  convert a value from any s c a l a r  type t o t h e named one, with i s defined  as  by  of boolean  There  ££i°.£i±!  S J -.  2 1 1  operators  "McCarthy"  S  manner,  type  name  a r e the words TRUE and FALSE,  are three  arguments and r e t u r n a boolean  operator  the standard  operators  which  accept  value:  operation l o g i c a l c o n j u n c t i o n (and) l o g i c a l d i s j u n c t i o n (or) unary l o g i c a l negation (not)  and  I  that  are evaluated is a  string  in a  left-to-right  of and»ed terms i s not  evaluated past the l e f t m o s t term t h a t i s FALSE, and a s t r i n g or'ed  terms  i s not e v a l u a t e d  TRUE.  Because o f t h i s McCarthy  of  past the l e f t m o s t term t h a t i s evaluation,  boolean  operators  F. D e c l a r a t i o n s  WISCH Report cannot be s a i d to  F.2.1.1.2.  The CHAR.  define  associate.  Character  type  The  defined  character  values  of  character other  i s denoted by the standard  type  set.  specific  A S C I I _ 1 2 8 or EBCDIC.  character  An  a r e an  implementation  character  types,  type name  implementation  may (should)  such  as  Character  literals  also  ASCII_64,  There are no o p e r a t o r s on c h a r a c t e r  except t h e r e l a t i o n a l ones. single  31  values  a r e w r i t t e n as a  c h a r a c t e r preceded by an apostrophe  (*), f o r example »A.  An apostrophe i s w r i t t e n as two c o n s e c u t i v e  apostrophes, t h a t i s  **.  Non-printable  c h a r a c t e r s may not be denoted d i r e c t l y , but  may be denoted using the CHAR t r a n s f e r f u n c t i o n mentioned with  a  literal  argument.  There are no d i r e c t denotations f o r  a l t e r n a t e c h a r a c t e r types, but they built-in  transfer  ASC1I_64(*A)  functions  would  return  r e p r e s e n t a t i o n of the c h a r a c t e r  F.2. 1 . 1 . 3 .  Integer  inteaer l i t e r a l  (no embedded  above  blanks)  may  mentioned the * A.  be  written  above.  &SCII_64  using  the  For example, representation  WISCH Report  F. D e c l a r a t i o n s  The type i n t e g e r i s denoted INTEGER.  the  values  of  type  d e f i n e d subset o f the i n t e g e r s . represented  internally  Literals  are  followed  by  specifing  the number base.  the  last  written  i n an  an  as  a  octothorpe  by  the  integer  standard are an  Negative  of  There can be no  of  the  are  d e f i n e d manner. optionally  decimal i n t e g e r  characters  d i g i t of the number and the octothorpe digit  values  digits,  (#) and an unsigned  name  implementation  integer  implementation  seguence  type  32  between  or between the  octothorpe  and the f i r s t  radix.  the  base  specifier  i s ommited, the number i s assumed t o be decimal.  The  a l l o w a b l e r a d i x v a l u e s must i n c l u d e a t l e a s t 2, 8, The  digits  of  the  10  and  16.  the number must be l e g a l f o r the base used, f o r  example, 4 5 9 # 8 i s i l l e g a l . for  If  minimum  and  There a r e no  predefined  constants  maximum i n t e g e r values s i n c e they  may be  obtained v i a FIRST (INTEGER) and LAST (INTEGER) . There are t e n o p e r a t o r s which accept i n t e g e r  operands  and  r e t u r n an i n t e g e r r e s u l t : operator  Integer  priority  ** * DIV REM  3 2 2 2  MOD  2  +,•,ABS  1 1 1  exponentiation  operation integer exponentiation multiplication d i v i s i o n (truncate towards zero) d i v i s i o n remainder i REM j = i - ( i / j ) * j the s i g n of ( i REM j) i s always the same as the s i g n of i mathematical modulus the s i g n i s always p o s i t i v e f o r i>=0, i MOD j = i REM j e l s e , i MOD j = ( i REM j) + (ABS j) a d d i t i o n and s u b t r a c t i o n unary p l u s and unary minus unary a b s o l u t e value i s defined i n the obvious manner.  That  F.  WISCH Report is, b  a**b i s d e f i n e d i s positive,  negative.  1  if b  i s zero,  and 1 DIV (a**-b) i f b i s  Association of a l l integer  SIGN, i s provided  i t i s negative,  LL2-.i-i-.ii  operators  except  r i g h t - t o - l e f t.  associates  integer expression. if  33  as a*a* ... *a ( i . e . , b occurances of a) i f  l e f t-to-r ight, function,  Declarations  t o e x t r a c t the numeric  I t accepts  A  ** i s standard  sign  of an  a s i n g l e argument and r e t u r n s -1  0 i f i t i s zero and +1 i f i t i s p o s i t i v e .  Storage  storage l i t e r a l : ( D O embedded blanks) —  $ —-1— + —x— <integer l i t e r a l >  The  type  STORAGE.  storage  • • .> 1  i s denoted  The values of type storage  are  written  as  signed  sign  ($), f o r example $64 and  by  the standard  type name  are b i t p a t t e r n s .  Literals  i n t e g e r l i t e r a l s preceeded by a d o l l a r $100#8  both  pattern  1000000 ( i g n o r i n g l e a d i n g z e r o s ) .  allowed  and t h e i r corresponding  represent  the b i t  The range of i n t e g e r s  b i t patterns  i s implementation  defined. There are four operators r e t u r n a storage  storage  result:  operator  priority  5&  2 1 1  i I XOR  which accept  operation b i t w i s e and b i t w i s e i n c l u s i v e or b i t w i s e e x c l u s i v e or unary b i t w i s e complement  arguments and  HISCH Seport Note  F. D e c l a r a t i o n s  t h a t although  operators &, | and particular, manner. The  34  these o p e r a t o r s look s i m i l i a r t o the boolean ->,  they  the storage  are  indeed  very  different.  In  o p e r a t o r s do not work i n a "McCarthy"  A s s o c i a t i o n of a l l storage o p e r a t o r s i s  left-to-right.  meaning o f r e l a t i o n a l comparisons between storage v a l u e s i s  implementation  defined.  In a d d i t i o n , t h e r e are two f u n c t i o n s which accept a s t o r a g e first  argument  and  an  i n t e g e r second argument.  s h i f t i n g f u n c t i o n s , SHIFT and zero-fill  SHIFT  i s an  s h i f t and SOTATE i s a c i r c u l a r r o t a t i o n .  argument i s the number indicates shift.  SOTATE.  They a r e the  a  left  of  bits  to  shift,  a  The i n t e g e r  positive  value  s h i f t and a n e g a t i v e value i n d i c a t e s a r i g h t  (Easy to remember i f l e f t s h i f t s a r e thought  essentially  end-off,  of as being  m u l t i p l i c a t i o n s by a power of two.)  F.2.1.1.5. Enumeration  enumeration : [  <iflent> —'— ] .  Enumeration (enumeration) type.  types  •>  are  declared  The  giving  a  list  of unique i d e n t i f i e r s which are the values o f the  The values a r e ordered l e f t  highest.  by  value  identifiers  to may  right,  from  lowest  to  n o t be r e d e f i n e d i n any  WISCH Report  F„ D e c l a r a t i o n s  i n n e r scope that has access to the type. for  35  There a r e no o p e r a t o r s  values o f enumeration types except the r e l a t i o n a l  ones.  Some examples of enumeration types a r e : TYPE c o l o r = [ black,red,green,blue,white "j; disk_op = [read,write,seek,resetJ; The  type  color  has  five  values,  l i t e r a l s of type c o l o r a r e  denoted by the i d e n t i f i e r s b l a c k , r e d , green, The  blue  and  white.  lowest value i s b l a c k , the highest i s white.  F.2.1.1.6. Subrange  subrange : <expression>  ..  <expression>  >  Subrange types are based on other s c a l a r types. declared  by p r o v i d i n g l i t e r a l  the i n i t i a l and f i n a l must  not  be  larger  are  e x p r e s s i o n s of the b a s i s type f o r  values o f the subrange. than  They  the  upper  bound.  The  lower  bound  The values o f a  subrange are the values of the b a s i s type between the values the  initial  and  final  expressions,  inclusive.  Literal  d e n o t a t i o n s and o p e r a t o r s are the same as f o r the b a s i s type. Some examples of subrange types a r e ; TYPE  hue = r e d . . b l u e ; c a p i t a l _ l e t t e r = »A..*Z; table_index = 0..size-1;  of  {dangerous with EBCDICI}  WISCH Report  F. D e c l a r a t i o n s  Subrange types may limits  are  not  a l s o be  defined  for  known a t compile time.  which  I f either  the  36  exact  (or both) of  the subrange bound e x p r e s s i o n s are not l i t e r a l e x p r e s s i o n s , subrange  defined  is  a  "dynamic" subrange.  In t h i s case, the  l i m i t s of the range are not f i x e d u n t i l scope e n t r y a t run The  range  explicit  expressions  are  evaluated  usage of a dynamic subrange.  exactly For  the  once  example,  time.  f o r each given  the  code segment; TYPE range = 1 ..  no_entries+1;  VAR o l d , new: ARBAY(range, range) OF CHAB; i 1 , i 2 , i 3 : 0 .. no_entries+1; J1# j 2 , j 3 : 0 ., n o _ e n t r i e s * 1 ; the  e x p r e s s i o n "no_entries+1" i s e v a l u a t e d three times, once i n  the d e c l a r a t i o n of the type "range", once i n the d e c l a r a t i o n the  "i"  variables  reevaluated  when  specification.  and  once f o r the " j "  "range" The  whenever a v a r i a b l e i s  is  dynamic created  variables.  used  in  bounds  are  with  p o i n t e r types f o r a d e s c r i p t i o n of NEW).  the  the  VAE (lwb, upb):=0 : INTEGER; TYPE index = lwb-1. . upb+1; dyn_array = S ARRAY (index) OF INTEGER; VAR  BEGIN lwb := 0; upb := NEW(tablel) ;  19;  array  procedure  type though (see  For example, given the  code:  table"!, t a b l e 2 : dyn_array;  I t i s not  reevaluated NEW  of  HISCH Report  F» D e c l a r a t i o n s  lwb .:= 1; upb NEW(table2);  :=  37  100;  the v a r i a b l e t a b l e 1 w i l l point t o  an  array  with  22  elements  indexed from -1 t o 20 and t a b l e 2 w i l l p o i n t t o an array with  102  elements  and  11  upb+1"  arrays.  indexed from 0 to 101are  time.  expressions  subranges  thus  allow  the  allow  a r r a y s as parameters,  procedures  to  accept  variably  embedded  ^- <digit> —I— .  sized  SEAL) : REAL;  type  real  blanks)  <digit> —^  i s denoted  JZ  rational  numbers.  <digit>  by the standard type name BEAL.  The values of type r e a l are an implementation Literals  d e f i n e d subset  an o p t i o n a l exponent.  digits  Note that there must be at l e a s t  d i g i t on each s i d e of the p o i n t and that no embedded blanks allowed.  The  exponent  is  of  are w r i t t e n as a sequence o f  decimal d i g i t s , a p o i n t (.), another sequence of decimal and  run  Seal  r e a l l i t e r a l : (no  the  and  f o r example:  FUNCTION mean {lwb, upb: INTEGER; v a l u e s ; ARB AY (lwb-.upb) OF  The  creation  of data s t r u c t u r e s whose s i z e i s not known t i l  They a l s o  F.2. 1.2.  "Iwb-I"  evaluated twice, once each f o r the c r e a t i o n of t h e  Dynamic  manipulation  The  written  as  the  letter  e  one are  (or E)  Declarations  WISCH Beport f o l l o w e d by an o p t i o n a l s i g n again  and  with no embedded blanks-  values i s implementation  a The  decimal range and  integer  literal,  p r e c i s i o n of  real  defined.  There are e i g h t operators which accept r e a l return a real  38  arguments  and  result:  operator  priority  *  3 2 2  exponentiation multiplication division a d d i t i o n and s u b t r a c t i o n unary p l u s and unary minus unary a b s o l u t e value  1 1 1  ABS  operation  a s s o c i a t i o n of a l l r e a l o p e r a t o r s except  ** i s l e f t - t o - r i g h t ,  associates r i g h t - t o - l e f t .  I f the o p e r a t o r s f o r  multiplication,  or s u b t r a c t i o n have one  addition  and one i n t e g e r argument, they  will yiels  a  **  exponentiation, r e a l argument  real  value.  The  operator f o r r e a l d i v i s i o n always y i e l d s a r e a l v a l u e , e i t h e r or both arguments w i l l be converted operators  defined  above  d e f i n e d f o r r e a l values. implemented  as repeated  for  i f necessary.  Exponentiation  might be implemented as: x * x * x * x * x * x * x * x * x  X *  { (X2) ) 2 2  guaranteed  The  actual  d e f i n e d , i t i s only guaranteed  9  or as:  is  m u l t i p l i c a t i o n s f o r some  and e x p o n e n t i a l s w i l l not be used. x **  relational  s c a l a r values are of course a l s o  d e f i n e d range of i n t e g e r exponents. i s implementation  The  For example:  to  be  implementation algorithm  used  that logarithms  WISCH Report that i s ,  F. D e c l a r a t i o n s 4  with  exponentiation  multiplications  hy  a  real  instead  of  8-  Note  v a l u e i s indeed allowed.  that  The p o i n t  made above i s t h a t e x p o n e n t i a t i o n by c e r t a i n i n t e g e r values be  faster  real  and  39  may  more accurate than e x p o n e n t i a t i o n by e q u i v a l e n t  values.  There a r e s e v e r a l standard integers  and  f u n c t i o n s f o r c o n v e r s i o n between  r e a l s and f o r mathematical computation.  The type  name REAL may be used as a f u n c t i o n to c o n v e r t i n t e g e r values t o r e a l values  (but i s a c t u a l l y s u p e r f l u o u s s i n c e t h i s w i l l be done  automatically). to  integers,  There a r e f o u r f u n c t i o n s t o convert r e a l TRUNC,  ROUND,  t r u n c a t i o n towards z e r o . FLOOR  gives  FLOOR  CEIL.  TSUNC g i v e s a  ROUND g i v e s a rounding away from z e r o .  t h e l a r g e s t i n t e g e r t h a t i s l e s s than o r e g u a l t o  the r e a l value.  CEIL gives the s m a l l e s t i n t e g e r t h a t i s g r e a t e r  than or e g u a l t o the r e a l v a l u e . SQRT, EXP, LOG ( n a t u r a l ) , ATAN.  and  The  standard  L O G 1 0  functions  The mathematical f u n c t i o n s a r e (common), WIN  SIM, COS,  defined  values when constants  above given  of  real  type  agruments. REAL,  There  MAX_EOS_REAL  MIN_POS_REAL i s the s m a l l e s t p o s i t i v e  may be represented.  the f u n c t i o n  f o r i n t e g e r v a l u e s . ,• A l l t h r e e r e t u r n r e a l a r e two and  HAX_POS_REAL i s t h e l a r g e s t r e a l value that may and  TAN and  and MAX d e f i n e d above f o r  s c a l a r v a l u e s a l s o accept r e a l arguments, as does SIGN  values  be  standard  aiN_POS_aEAL. represented  (non-zero) value that  WISCH Report F. 2. 1.3-  set  F. D e c l a r a t i o n s  Power set  type : SET  OF  <scalar type>  Powerset defined  powerset hue"  types  based  subrange).  on  The  (hereafter some  values  simply  scalar of  a  type  called (other  s e t type  s e t types) a r e than  a  dynamic  are elements  of the  For example the type "SET OF  has e i g h t values (with hue as d e f i n e d above i n the subrange  (red,green), (the  >  of t i e s c a l a r b a s i s type.  type examples).  They  a r e the s e t s  (red,blue) ,  (red),  (green),  (blue),  (green,blue) , (red,green,blue) and ()  empty s e t ) .  Values of a s e t type a r e w r i t t e n as the type name by  UO  a  parenthesized  elements) . denotation  l i s t of e x p r e s s i o n s i n t h e b a s i s type (the  I f a l l elements a r e l i t e r a l is  a  set  declaration: TYPE hues = SET OF hue; one could w r i t e : h u e s ( r e d , green)  followed  literal.  expressions, For  example,  then  the  given  the  F- D e c l a r a t i o n s  WISCH Report  A "subrange ' n o t a t i o n may a l s o be used i n s e t values1  element  of  t h e form  a-.b  denotes  a l l values  i n c l u s i v e , where a and b are a r b i t r a r y e x p r e s s i o n s type.  from of the  An  a to b basis  F o r example:  chars (•+,•<).. '5, •-) i s equivalent to; chars {» + , * 0, M , «2, *3, *4,»5, '-) If  the  lower  bound  range" i s used-  i s l a r g e r than the upper bound, the " n u l l  For example:  i n t s { 0 , 1,7..3,10) i s equivalent t o : ints(0,1,10)  A  particular  implementation may place r e s t r i c t i o n s on the  allowable c a r d i n a l i t y "magnitude"  of the b a s i s type  and  on  the  allowable  of the b a s i s v a l u e s , but must at l e a s t allow f o r the  d e c l a r a t i o n of a SET OF CHAR. There  are four  operators  which accept s e t arguments and  r e t u r n a s e t value: operator •  priority 3 2 1 1  operation set i n t e r s e c t i o n set union set d i f f e r e n c e i n terms of b i t w i s e l o g i c , a - b = a XOE (a && b) unary s e t complement  WISCH .fieport  F. D e c l a r a t i o n s  association  of  a l l set  42  operators i s l e f t - t o - r i g h t .  The  r e l a t i o n a l o p e r a t o r s d e f i n e d above f o r s c a l a r v a l u e s may a l s o be used  with  set  values.  They  test  the  subset r e l a t i o n , f o r  example, s e t _ a < set_b i s TRUE i f the value of s e t _ a i s a proper subset  of  the  value  of  which accept a s c a l a r l e f t return  a boolean  and -IN. the  value.  set_b.  Fa_S£  IN  have a p r i o r i t y  and  argument i s an element  otherwise, -IN does j u s t the o p p o s i t e . operand  r e t u r n s FALSE  normal i n t u i t i o n .  argument  They are the s e t element o p e r a t o r s , IN  that i f t h e value of the l e f t type  are a l s o two o p e r a t o r s  argument, a s e t r i g h t  IN r e t u r n s TRUE i f t h e l e f t  right,  basis  There  is  not  within  relational  Note  the s e t  (-.IN r e t u r n s TRUE) , agreeing  Like the other  of  operators,  with these  of 0.  For example, given the f o l l o w i n g code segment: TYPE c h a r s = SET OF char; nums = SET OF 0,.10; vaR  c h a r _ d i g i t s : chars; num_digits : nums;  BEGIN c h a r _ d i g i t s := c h a r s ( * 0 . . '9) ; num_digits := nums(1,3,5,7,9); the f o l l o w i n g e x p r e s s i o n s are TRUE: •3 IN c h a r _ d i g i t s 10 -IN num_digits and  the f o l l o w i n g are FALSE: •a 4 500  There  IN c h a r _ d i g i t s IN num_digits IN num-digits  are  three  standard  functions  dealing  with s e t s .  The  WISCH Report  F- D e c l a r a t i o n s  f u n c t i o n s FIRST_ELEM and LAST_EL£m" accept and  a s e t as  an  43  argument  r e t u r n the s c a l a r value of the s m a l l e s t and l a r g e s t elements  respectively-  I t i s an e r r o r i f e i t h e r i s passed the empty s e t -  The  CARD accepts  function  cardinality  a s e t as an argument and r e t u r n s the  of i t .  F.2.1.4. S t r i n g  s t r i n g type :  STRING —  The  (  <expression> —  string  followed  by a  length.  types  literal  1  >  are denoted by the reserved expression  giving  the  word STRING  maximum  on  the  range  maximum.  of  allowed  An implementation may place maximum l e n g t h s .  s t r i n g types a r e sequences of c h a r a c t e r s from an defined  set  (the same  as  the  s e t used f o r t h e type CHAR),  types are w r i t t e n as seguences of  enclosed  ("). I f an implementation provides  i n quotes  character character  t y p e s , i t must a l s o set-  The  maximum  l e n g t h , f o r example the l i t e r a l guote  may  be  included  twice, f o r example "a guote  Values of  implementation  l i t e r a l s of s t r i n g  The  string  S t r i n g v a r i a b l e s i n HISCH may have values of a v a r y i n g  l e n g t h , up to the d e c l a r e d limits  )  provide  string  types  length of a l i t e r a l  characters alternate f o r each  i s i t s exact  "a s t r i n g " i s a STRING(8)  value.  i n a s t r i n g l i t e r a l by w r i t i n g i f " i s a STRING (10)  (not 11)  value.  WISCH Report The  empty  F. D e c l a r a t i o n s string  i s "".  c r o s s l i n e boundaries attempt  to  String  i n the source  l i t e r a l s a r e not allowed t o program.  It i s illegal  to  a s s i g n a value to a s t r i n g v a r i a b l e which i s l o n g e r  than the v a r i a b l e ' s maximum  length.  Non-printable  may not be denoted d i r e c t l y i n a s t r i n g  There  44  is  one  operator  on  characters  literal.  string  values,  %, t h e  c o n c a t e n a t i o n o p e r a t o r which has a p r i o r i t y of 1., T h i s o p e r a t o r also  accepts  treating  character  them  relational  as  values  though  operators  they  as  either  were  for ineguality  o r both arguments,  STRING(1)  values.  (<, -»<, etc)  perform  standard l e x i c a l comparisons, with the c o l l a t i n g seguence the  ordering  of  the  appropriate  character  set.  The  being If  a l l  " e x i s t i n g " c h a r a c t e r s match, t h e s h o r t e r s t r i n g i s always " l e s s " than  the  string  longer.  These o p e r a t o r s w i l l a l s o accept mixtures of  and c h a r a c t e r e x p r e s s i o n s .  Note t h a t s i n c e restriction  to  HISCH  single  line  allows  constant  strings  expressions,  the  and no n o n - p r i n t a b l e s i s  r e a l l y no problem at a l l : CONST a l p h a _ s t r i n g = "abcdefghijklmnopgrstuvwxyz" % "ABCDEFGHIJKLHNOPQRSTUVWXYZ" ; s p e c i a l _ s t r i n g = " a s c i i c o n t r o l chars:" % " b e l l " % CHAR (7) % » c r " % CHAR (13) % " I f " % CHAR (12) ;  SISCH Seport  F. D e c l a r a t i o n s  S u b s t r i n g s may be s e l e c t e d by s u f f i x i n g a with  a  substring  string  45  variable  s e l e c t o r , two i n t e g e r e x p r e s s i o n s s p e c i f y i n g  the i n i t i a l c h a r a c t e r f o r the s u b s t r i n g and the  length  of i t .  For example; string_var (start,length) Characters one.  in  a  s t r i n g are numbered from the l e f t s t a r t i n g a t  The value of  portion  of  the  a  substring  selected  selection  string.  is  the  "existing"  F o r example, given t h e code  segments VAR  s : s t r i n g (10); s := "12345";  the value  of s(3,5) i s "345" and the value of s(7,4) i s t h e n u l l  string.Assignment replacement  to  a  substring  is  allowed  and  causes  o f the s e l e c t e d s t r i n g by the r i g h t hand s i d e .  The  s t a r t o f the s u b s t r i n g must not be beyond the end of the c u r r e n t string having  value.  (This  i s t o prevent  strings.  The  f u n c t i o n s and one standard  function  LENGTH  accepts  argument and r e t u r n s i t s c u r r e n t l e n g t h . accepts  a  string  and  p o s i t i o n of the f i r s t It  from  "holes" i n i t . )  There are two standard for  the subsequent value  a  arguments.  accepts It  pads  string  a c h a r a c t e r as arguments, r e t u r n i n g t h e  occurence o f the c h a r a c t e r i n the  a  as an  The f u n c t i o n FIND_CHAS  r e t u r n s zero i f the c h a r a c t e r i s not present.  PAD_.STR.ING  procedure  string the  l e n g t h with the c h a r a c t e r .  variable  and  a  string.  The procedure character  as  value of the v a r i a b l e to i t s maximum  WISCH  F. D e c l a r a t i o n s  Eeport  F. 2 . 1 - 5 .  N orroal  46  pointer  n o r r a l pointer type : <type> E  —  PBOGRAH  _zn  PUNCTIOH - | • <func f o r a a l params>  The and  space f o r most v a r i a b l e s i s a l l o c a t e d  d e a l l o c a t e d at scope e x i t .  data o b j e c t s dynamically indefinite  period.  usual manner, but  and  Such  one  program.  For  scope  entry  I t i s also possible to a l l o c a t e  objects  must be accessed  point to dynamically  at  have them continue  "normal" p o i n t e r s d e s c r i b e d here may  • <functioc result>  to exist for  cannot be referenced  i n the  v i a "pointers'* to them. (as opposed to " p o o l "  rest  of t h i s s e c t i o n  The  pointers)  c r e a t e d o b j e c t s used completely  the  an  within  ( o n l y ) , the word  p o i n t e r means normal p o i n t e r .  P o i n t e r t y p e s are the  o b j e c t type with  d e c l a r e d by an a t - s i g n  types, a p o i n t e r type may object  type.  preceding  (8) .  of the declared o b j e c t type.  declaration  of  To allow s e l f - r e f e r e n c i n g  be d e f i n e d before  P o i n t e r s values may  a  or  inside  of  only be r e f e r e n c e s to  P o i n t e r types may  to point to programs, procedures or f u n c t i o n s .  a l s o be  values  declared  T h e i r values  then r e f e r e n c e s t o a code o b j e c t i n s t e a d of a data  its  object.  are  WISCH Report  F. D e c l a r a t i o n s  47  There i s only one l i t e r a l o f any p o i n t e r type, the standard name  NIL. The value  of NIL i s a r e f e r e n c e t o no o b j e c t .  are only  two  operators  that  equality  o p e r a t o r s = and -»=.  accept  pointer  There  arguments,  The o b j e c t pointed  the  to i s obtained  by s u f f i x i n g a p o i n t e r v a r i a b l e name with an a t - s i g n (a>) .  Data o b j e c t s a r e c r e a t e d by the standard  procedure NEW.  It  accepts a p o i n t e r v a r i a b l e as an argument, c r e a t e s a data o b j e c t of the a p p r o p r i a t e type and a s s i g n s a r e f e r e n c e t o the o b j e c t to the  pointer  variable.  data area, separate allocated.  returned  o b j e c t s a r e c r e a t e d from a heap  from the area  WISCH  collection.  These  does  not  where  normal  provide  any  to  the  heap  i t references  by  the standard  to  garbage may  be  procedure DISPOSE. I t returns  the  object  the heap and s e t s the v a r i a b l e to NIL.  Note that t h e s e c u r i t y o f the heap programmer  automatic  Dynamic o b j e c t s which are no longer needed  accepts a p o i n t e r v a r i a b l e as an argument, that  variables are  uses DISPOSE-  i s not guaranteed  i f the  I t i s the programmer's r e s p o n s i b i l i t y  to e l i m i n a t e " d a n g l i n g r e f e r e n c e s " to r e c y c l e d s t o r a g e .  P o i n t e r types t h a t procedures  are d e c l a r e d  to  reference  o r f u n c t i o n s a l s o have the value NIL and the e q u a l i t y  o p e r a t o r s , but s i n c e code o b j e c t s cannot be c r e a t e d the  NEW  standard code  programs,  procedure  cannot  be  used  with  them-  f u n c t i o n ADD! may be used to o b t a i n a  object-  The  ADDR  function  hence r e f e r e n c e s may only be obtained  dynamically, Instead, the  reference  to a  may only be a p p l i e d t o (and to)  programs,  procedures  HISCH Report and  F. D e c l a r a t i o n s  functions  which  are external  outermost scope of the program. program  may  only  program pointed function  or  are  Dereferencing  declared a  48  i n the  pointer  to a  be done i n a CREATE statement and y i e l d s t h e  to.  Dereferencing  causes i t t o be c a l l e d .  a p o i n t e r to a  procedure  Although the formal  or  parameter  names of the o b j e c t type are i n c l u d e d i n t h e d e c l a r a t i o n of the pointer,  they  are  present  completely  ignored.  referenced  must  only  pointer's object  type.  The  f o r mnemonic reasons only and a r e formal  parameters  of  the  objects  agree i n number, type and order with t h e  Some examples of p o i n t e r types and t h e i r use a r e ; TYPE i n t = INTEGER; i n t _ p t r = a INTEGER; node_ptr = 3 node; node = RECORD op : CHAR; l e f t : node_ptr; {node_ptr and "S node"} r i g h t : 3 node; {are e q u i v a l e n t types.} ENDfiECOBD; f u n c _ p t r = a FONCTION ( i : i n t ) RETORNS (j : i n t ) ; f o o = a PROCEDURE (bar: f o o ) ; {note c i r c u l a r reference} VAR i_p : int_ptr; r o o t : node_ptr; func ; f u n c _ p t r ; i s INTEGER; FUNCTION f a c t o r i a l  (n: i n t ) RETURNS ( i : i n t ) ;  BEGIN NEH (i_p) ; i_p3 0; r o o t := NIL; func i  :=  ADDR(factorial);  ;= f u n c S ( i ) ;  EXTERNAL;  F.  WISCH Report  Declarations  49  F.2.2. Array  array type :  ( —^- <scalar type>  APaAT  —  »  —  )  <type>  OF  >  t  The  array types are composite types, with a l l components o f  the same type.  The components are s e l e c t e d by i n d i c e s which may  be of any s c a l a r type. sharable  An  types  defined  element  as  an  except  written s i m i l i a r l y to a  by  r e p e t i t i o n f a c t o r may as  be  that  element  applied  test. The  to  " r e p e t i t i o n s ! component".  a  component  tests  denoted  a  "subrange"  If  TYPE  vecvec  (1..2) OF v e c t o r ;  matrix = ARRAY the f o l l o w i n g : v e c t o r (-1,310 , 1 )  (1--2, 1..5) OF INTEGER;  notation  This  is  a l l components a r e  i s an  given the declarations;:  (1..5) OF INTEGER;  are  In a d d i t i o n , a  component.  of a one dimensional  v e c t o r = ASSAY  which  An array value i s  array  literal.  array i s a simple  element, of a two dimensional array i s a row, e t c .  = ARRAY  and/or  There a r e no o p e r a t o r s on  i s a l s o allowed here.  l i t e r a l e x p r e s s i o n s , the value Note  i s assignable  the e q u a l i t y  s e t value.  f o r s e t values  written  type  i f i t s component type i s .  values of array  allowed  array  F o r example,  F. D e c l a r a t i o n s  WISCH Beport vecvec(2  50  ! v e c t o r (1,2 ,3 , 4, 5) )  matrix{2! (5,4,3,2,1)) are e q u i v a l e n t t o ; vector(-1,0,0,0, 1) vecvec (vector (1,2, 3,4,5) , v e c t o r (1,2,3,4,5)) matrix((5,4,3,2, 1) , (5,4,3, 2,1) ) Some examples of a r r a y types a r e ; CONST  prime = {an a p p r o p r i a t e value] ;  TYPE name_table = vec = ARRAY mat1 = ABB AY mat2 = ARRAY VAR  ARRAY (0., prime-1) OF STRING ( 1 0 ) ; (-1.. + 1) OF INTEGER; (1-.2) OF vec; (1-.2, -1..+1) OF INTEGER';  old_names, new_names ; name_table; numsl : mat1; nums2 ; mat2; l e t t e r _ c o u n t s ; ARRAY  (•A.. Z) OF INTEGER; 4  BEGIN FOR ch := »A TO 'Z LOOP l e t t e r _ c o u n t s (ch) := 0 NEXT; numsl := mat1 (vec (1,2,3) ,vec(4,5,6) ) ; nums2 := mat2 ((1,2,3), (4,5, 6)) ; FOB i := -1 TO +1 LOOP numsl (1) (i) +:= numsl (2) (i) NEXT; FOR i := -1 TO +1 LOOP nums2(l,i) *•;= numsl (2,i) NEXT; Note i n p a r t i c u l a r the s i m i l a r i t i e s denotations  of  and d i f f e r e n c e s between  the  values of types mat1 (array of arrays) and mat2  (two dimensional array) . The standard f u n c t i o n s LO_BND and UP_BND find  the  lower  and upper l i m i t s of any dimension  They accept an a r r a y arguments.  The  bound i s wanted.  may  type  integer  or  expression  argument  and  an  be  used  to  of an a r r a y . integer  as  s e l e c t s the dimension whose  I t may be omitted f o r one dimensional a r r a y s .  F. D e c l a r a t i o n s  •WISCH Report  51  F-2-3. Record  record  type  :  BECOBD  field  <field  list>  - —  EHDKECOHD  l i s t  ^—  variant  body  <ident>  POBK  <type>  < v a r i a u t body>  case f i e l d l i s t  *  •  <scalar type>  possibly  C ' S E  record  <case f i e l d  <ezpr>  <expr>  types  different  identifiers  OF  list>  :  <field  The  7ZT  JOIN  :  <ident>  field  *>  <field  list>  list>  are composite types with components of  types.  known as f i e l d  The  components  selectors.  are s e l e c t e d  by  The f u l l name of a r e c o r d  i s the record name, a dot (.) and  the f i e l d  identifier.  The i d e n t i f i e r s o f a l l f i e l d s i n a record must be d i f f e r e n t , b u t may be the same records full  or  as  identifiers  identifiers  i n other  (possibly  o u t s i d e the r e c o r d .  names of a l l record f i e l d s must be  where t h a t name i s known.  unigue  nested)  S p e c i f i c a l l y , the i n a l l scopes  HISCH Report Record  F. D e c l a r a t i o n s types  may a l s o have " v a r i a n t " p o r t i o n s whose exact  s t r u c t u r e i s determined by a " t a g f i e l d " . field  determines  which  The value of the t a g  o f the cases i n the FORK c l a u s e  apply.  F i e l d names i n d i f f e r e n t cases must be d i f f e r e n t from each and  52  d i f f e r e n t from a l l other f i e l d  other  names i n the r e c o r d .  Values of a r e c o r d type (with no v a r i a n t s ) a r e w r i t t e n array  values,  different  types  except and  that the  the  components  are  of  possibly  r e p e t i t i o n n o t a t i o n may not be used.  Values may not be w r i t t e n f o r records  with v a r i a n t p o r t i o n s .  Some examples of record types a r e ; TYPE binary_tree_node = RECORD kind : 0..10; l e f t , r i g h t : a> ENDR ECORD; dev_kind  like  bin_tree_node;  = [ d i s k , mag_tape , paper_tape, t e r m i n a l ) ; i  status_rec = RECORD up ; BOOLEAN; channel ; INTEGER; i o _ w a i t _ l i s t : S process_list_node; FORK kind : dev_kind OF CASE disk : b l o c k _ s i z e : INTEGER; CASE mag_tape : d e n s i t y : INTEGER; n i n e _ t r a c k : BOOLEAN; OTHER : [emptyj ; JOIN; ENDR ECORD;  HISCH Beport F.2.4.  53  F. D e c l a r a t i o n s  Pool p o i n t e r  pool pointer type : 3  POOLED  <type>  »  Pool p o i n t e r s are the second p o i n t e r type i n WISCH. normal  pointers  may  point only to heap or "code" o b j e c t s known  w i t h i n a s i n g l e program, pool p o i n t e r s may data  objects.  shareable  compared never  Since  type.  They  equal).  may  by  not  only  to  assignable  heap  NIL.  as  Shared  pointer  is  "guaranteed" than one  assignment.  subsequenly that  may  of  a  only  be  will  no  variables  are  but are not n e c e s s a r i l y  non-shared  A r e f e r e n c e to a shared  the  of a  objects  and  variables.  o b j e c t may  The  v a r i a b l e s to  be assigned  to  procedure or the AWAIT statement.  In e i t h e r case the p o i n t e r must have the value to  objects  a l s o be used to r e t u r n shared  a pool p o i n t e r only by the NEW  prior  pooled  (not with each other s i n c e they  to the value  same  procedure DISPOSE may free storage.  contain  only p o i n t  t h e standard procedure NEW,  from the  only p o i n t to  Upon c r e a t i o n , a l l v a r i a b l e s of pool p o i n t e r  types are i n i t i a l i z e d  allocated  are  with the value NIL  be  created  pools  type, pool p o i n t e r s may  shareable  Where  NIL  immediately  T h i s r e f e r e n c e i s removed when the  used shared  pool p o i n t e r at a time.  in  a  SEND  statement.  It  is  object can be pointed t o by more (The guarantee i s not  s i n c e t h e r e are ways i n WISCH to circumvent  absolute  a l l checks i f one  is  Beport  WISCH  F-  really  so i n c l i n e d . )  except  v i a t h e BIND  Pool  pointers  may  Declarations  not  be  54  dereferenced  statement.  F_2.5_ P o o l  pool  type  :  POOL  The Pools  OP  <type>  >  basic semantics  are  processes  o f p o o l s have a l r e a d y  f o r the purpose of  of  communication.  objects  actually  c o n s i s t of an i n a c c e s s i b l e p o r t i o n  shareable  types.  empty  when  created.  If  subrange,  are  They may be v i e w e d a s  the  range  any  dynamic  subranges.  are not  When a  shared  subrange  and f i x e d f o r t h a t one o b j e c t .  The same  j u s t a header f o r a l i n k e d several  pools  dynamic  with d i f f e r e n t subrange l i m i t s .  contain  a l l  expressions  p o o l p o i n t e r may l a t e r b e u s e d t o c r e a t e a n o t h e r  may  only  t h e o b j e c t type o f a pool i s o r  by t h e NEW p r o c e d u r e ,  evaluated  may  f o r linkage,  and a s s o c i a t e d w i t h t h e p o o l v a r i a b l e .  variable i s created bounds  used  o f d a t a o b j e c t s , a l l o f t h e same t y p e .  c o n t a i n s a dynamic evaluated  Pools  among  The o b j e c t s i n t h e p o o l  and t h e a c c e s s i b l e b u f f e r p o r t i o n .  linked l i s t s are  discussed.  c o l l e c t i o n s o f message b u f f e r s t h a t a r e s h a r e d  contain  etc.,  been  list  one  variable  Since a pool v a r i a b l e i s r e a l l y of shared  variables Thus,  shared  with could  variables,  different create  the  pool  l i m i t s f o r any a  pool  which  HISCH Report contained units.  F. D e c l a r a t i o n s  varying  length  one  dimensional  vectors o f storage  For example;  TYPE  b u f f e r _ p o o l = POOL OF ARRAY  (lwb..upb) OF STORAGE;  where lwb and upb a r e v a r i a b l e s d e c l a r e d elsewhere. no  55  literals,  constants,  or  operators  There  are  f o r pool types.  v a r i a b l e s and VAS parameters may be of pool t y p e s .  Only  V a r i a b l e s of  pool types must be d e c l a r e d i n the outermost scope of a program.  There  a r e two standard f u n c t i o n s , EMPTY and WAITING, which  accept a p o o l returns  variable  and  return  from  References  the  value..  pool.  process  Note  that  EMPTY WAITING  waiting  f o r access  WAITING  implies  EMPTY.  pooled  statements.  objects  have a pool a s s o c i a t e d with them, the  r e p l y p o o l , which may be used t o t e l l a process where t o the  to  to pooled o b j e c t s are obtained and r e l i n q u i s h e d using  the AWAIT and SEND  All  boolean  TRUE i f t h e r e a r e no o b j e c t s l e f t i n the pool.  r e t u r n s TRUE i f there are any objects  a  object.  The  r e p l y pool i s i n i t i a l l y a standard  p o o l , but may be changed i n the SEND  return  "garbage"  statement.  F.2.6. Process  The PROCESS. process. program.  type process i s denoted Only  variables  and  by VAR  the  standard  parameters  type  name  may be o f type  V a r i a b l e s must be d e c l a r e d i n the outermost scope of a There  are  no l i t e r a l s  or c o n s t a n t s o f process  type.  WISCH Report  F. D e c l a r a t i o n s  and no o p e r a t o r s on values of process type. may  only  be  Process  56  variables  acted upon by t h e CREATE, START, STOP and DESTROY  statements.  A process may be i n one of f o u r s t a t e s . (a  process  until  restarted.  ready t o be executed be  blocked,  event is  a  not  exist  v a r i a b l e which c o u l d be s a i d t o have a v o i d v a l u e ) .  I t may e x i s t , but be stopped, i n which case further  I t may  this  i t cannot  I t may be ready, i n which case i t i s  by a processor a t any time. occurs  execute  when  L a s t l y , i t may  i t i s waiting on some e x t e r n a l  ( u s u a l l y w a i t i n g on a reguest f o r a pooled o b j e c t ) . standard  enumeration  type,  process_status_type,  There and a  standard f u n c t i o n , p r o c e s s _ s t a t u s , t h a t may be used to determine the c u r r e n t s t a t u s of a process.  They are d e f i n e d as:  TYPE p r o c e s s _ s t a t u s _ t y p e = [ v o i d , stopped,  blocked,  ready};  FUNCTION p r o c e s s _ s t a t a s (CONST proc ; PROCESS) : p r o c e s s _ s t a t u s _ t y p e ; (return the c u r r e n t s t a t u s of proc};  F , 2 . 7 . C o m p a t a b i l i t y , c o e r c i o n s and a t t r i b u t e s  Two l e v e l s o f c o m p a t i b i l i t y is  A type x  weak!y compatable with a type y i f the i n t e r s e c t i o n o f t h e i r  s e t s of v a l u e s i s not empty. with  are d e f i n e d i n WISCH.  A type x  i s strongly  compatable  a type y i f t h e values o f x a r e a superset o f (or the same  as) the v a l u e s of y.  WISCH Report  F. D e c l a r a t i o n s  57  For example, given t h e d e c l a r a t i o n s ; TYPE z e r o _ t o _ t e n - 0..10; one_to_nine The  type  =1.-9;  zero_to_ten  but one_to_nine  i s not  i s s t r o n g l y compatable with strongly  compatable  with  They are of course weakly compatable with each  Note  to  a  variable  checks f o r range e r r o r s . then  other.  A l s o , x s t r o n g l y compatable with y  a t l e a s t y weakly compatible with x.  i s weakly compatable with y, assigned  zero_to_ten.  t h a t weak c o m p a t a b i l i t y i s a commutative r e l a t i o n but  s t r o n g c o m p a t a b i l i t y i s not. implies  one_to_nine,  values  of  of  then type  values  of  Intuitively, i f x type  y  may  be  x with a p p r o p r i a t e run time  I f x i s strongly  compatable  with  y,  type y may always be assigned t o a v a r i a b l e o f  type x with no checking at run time.  The standard t y p e s BOOLEAN, CH AB, and  INTEGEB,  BEAL,  STOBAGE  PROCESS a r e of course compatable (strongly and weakly) with  themselves.  Any  two subrange types a r e weakly compatable  i f they  are  d e f i n e d on the same b a s i s type and have a n o n - n u l l i n t e r s e c t i o n . A s c a l a r type x i s s t r o n g l y compatable with a s c a l a r type y i f y i s a subrange of x. itself. )  {Note that any s c a l a r type i s a subrange o f  MISCH Seport  F. D e c l a r a t i o n s  Two s e t types a r e compatable  58  (weakly and s t r o n g l y ) i f t h e i r  b a s i s t y p e s a r e the same.  Any  two s t r i n g  types are weakly compatable.  i s s t r o n g l y compatable of x i s a t l e a s t  Two strongly)  String  type x  with s t r i n g type y i f the maximum  length  as l a r g e as t h a t f o r y.  normal  pointer  types  are  compatable  and  i f t h e i r o b j e c t types are s t r o n g l y compatable.  Two pool p o i n t e r types are compatable if  (weakly  (weakly and s t r o n g l y )  t h e i r o b j e c t types a r e s t r o n g l y compatable.  Two  pool  types  a r e compatable  t h e i r o b j e c t types a r e s t r o n g l y  all  (weakly and s t r o n g l y ) i f  compatable.  Any two module types are weakly  (strongly)  exported  and  names  are  the  same  compatable  are weakly  i f  (strongly)  compatable.  Two array index  types  (strongly)  types are weakly  (strongly) compatable  fields  their  a r e i d e n t i c a l and t h e i r component types are weakly  compatable.  Two record types are compatable all  i f  (weakly  and  strongly)  i f  have the same names ( i n the same order) and a r e a l l  of s t r o n g l y compatable types.  F.  WISCH R e p o r t The in  the  use  sections  assignment  are  and  coercions integer  only value  two  type  coercions  apply may  may  be c o e r c e d  explanation  are  WISCH-  formal  of  parameter  programs,  transfer  conversions.  coerced  t o REAL.  to  Note t h a t For  procedures  functions  any t y p e  a  machine  do  exist  where  parameter formal  discussion  f u n c t i o n s f o r an  for  s c a l a r values  dependent  program,  argument t o c o n v e r t  the type  type.  The s i z e s of v a l u e s  o f t h e two t y p e s  statement.)  an  programmed  name may be used as a  name may be used a s a g e n e r i c  i s declared  these  parameters.)  single  routine  (See t h e and  R e c a l l t h a t any s c a l a r t y p e  Inside  function,  REAL.  each  example,  i s a CONST o r p l a i n  transfer function to convert  type.  the  Where  be used a s an argument t o a p r o c e d u r e  o f CONST, VAR and p l a i n  However,  (A  functions,  in  t o uses i n e x p r e s s i o n s .  i s a VAR p a r a m e t e r o f t y p e  parameters  generic  procedures,  i s discussed  REAL, b u t i t may n o t be used i f t h e c o r r e s p o n d i n g  parameter on  only  INTEGER  corresponding  of type  programs,  t h e t y p e s CHAR and STRING ( 1 )  appropriate, other.  about  compatablilty  59  s t a t e m e n t and e x p r e s s i o n s -  There  the  o f (and need f o r ) t y p e  Declarations  to the  named  procedure f u n c t i o n with  or a  o f t h e argument t o t h e named must  be  " m a c h i n e d e p e n d e n t " by u s i n g  the  same.  t h e OPTION  WISCH  fieport  F. D e c l a r a t i o n s  Standard f u n c t i o n s e x i s t data  types.  already  various  attributes  mentioned.  The  VALUE_SIZE  function  provides  about the space required t o hold values o f any type.  I t accepts a v a r i a b l e or type name and returns an  integer,  number  of t h a t  The  of  storage  units  needed t o hold a value  f u n c t i o n TOTAL_SIZE i s s i m i l a r , except i t r e t u r n s  number  o f storage  space t h a t s i l l  the  units  The f u n c t i o n s LO_BND and 0P_BND  arguments,  the name  expression,  and  appropriate  dimension of the a r r a y r e s p e c t i v e l y .  return  integer expression  of  an  array  the lower  must have a value  of dimensions of the array  of  variable and  and  upper  accept  For heap  integer  bounds  o f the  Of c o u r s e , the  between one and the  (inclusive).  variable declaration : PKRVASIVE —a—- VIB  \ - Oar  list>  :  <type>  var list <ident> — ? — :=  <expression>  ( ^ir. <ident> ••  <ezpression>  two  an  Variable  I  total  be used i f a v a r i a b l e of that type i s c r e a t e d by  the NEW procedure.  r—  the type.  u n i t s needed by a v a r i a b l e o f that type.  example, TOTAL_SIZE g i v e s the number of storage  F-3-  of  The FIRST and LAST f u n c t i o n s f o r s c a l a r types have  been  information  to access  60  -»  number  WISCH Beport  F. D e c l a r a t i o n s  Variables variables  are  used  declared  declaration-  All  i n a program must be declared before use.  If a  v a r i a b l e i s of an a s s i g n a b l e specified entry)  v i a the  type,  VAR  an  initial  the expression  i s evaluated  Note t h a t although  entry  or  use  be  (at a scope to  p o o l p o i n t e r v a r i a b l e s are not to NIL when created  of the NEW procedure).  e x p r e s s i o n r e f e r s only to the i d e n t i f i e r on i t s immediate l e f t -  may  and the value i s assigned  a s s i g n a b l e , they are always i n i t i a l i z e d scope  value  f o r i t . Each time the v a r i a b l e i s c r e a t e d  the v a r i a b l e .  61  The i n i t i a l  (or l i s t  (by value  of i d e n t i f i e r s  For example:  VAB i , j:=0, k : INTEGER; causes only j to be i n i t i a l i z e d ,  while:  V1B ( i , j ) : = 0, k : INTEGER; causes both i and j t o be i n i t i a l i z e d .  F. U . Program  proqraa  declaration <prograo  ;  heading>  <prog/proc/func EXTEBNAL  program  heading PROGRAM  prog/proc/func  bod?>  T~T  ;  T-  >  I <ident>  foraal  -  — q — <prog/proc/func foroal  paraas  COMST VAR -  params>  ^  j  :  v  <ident>  <type> A • > 1  1  ;  ^  >  HISCH  prog/proc/func  — —  F.  Report  body  :  <decls> — — BEGIN —  Most  of  presented.  62  Declarations  the  <ident> —  <statoments> —  features  A l l that  of  really  programs  remains  BHD — - <ideut>  have  is  to  >  already discuss  been formal  parameters.  Programs  (and  procedures)  may have t h r e e k i n d s o f f o r m a l  parameters,  VAR, CONST and p l a i n .  of  arguments  actual  corresponding parameters,  must  formal  the  the actual  parameter  a c t u a l argument computation" for  evaluated  (array  in  VAR p a r a m e t e r  Their  the  in  program CREATE  subscripting, done  once,  and  value i s t h e value  the plain  compatable  use  of  i s really  a use o f t h e  statement.  A l l "name  pointer dereferencing, etc.) while  CREATE s t a t e m e n t .  must be a v a r i a b l e  (of  CONST  by r e f e r e n c e , t h a t i s a  v i a the  parameters  expression  For  with  parameters.  the  f o r programs a r e p o o l  CONST  an  passed  VAR p a r a m e t e r s i s  allowed  formal  the types  compatable  a r g u m e n t s need o n l y be weakly  p a r a m e t e r s a r e passed  formal  strongly  parameters.  with t h e corresponding  Var  be  F o r VAR p a r a m e t e r s ,  arguments  The a c t u a l  name.  are  being  argument f o r a  The o n l y VAR  parameters  variables.  a r e t r e a t e d a s c o n s t a n t s i n the program. o f t h e a c t u a l argument, which  which  a literal  or variable  must  be  reference i s a  HISCH R e p o r t trivial  kind).  assignable  Plain is  F. D e c l a r a t i o n s  parameters  specified.  value).  t h a t CONST p a r a m e t e r s c a n  only  be  of  an  type.  initialized  F.5.  Note  63  They  a r e t h o s e f o r which look  to t h e value  like  local  neither  variables  o f t h e a c t u a l argument  The a c t u a l argument  must be an  VAR o r CONST which  are  ( i . e . p a s s e d by  expression.  Procedure  procedure declaration : <procedure heading>  <prog/proc/func body> EXTEBHAL. FOEBABD  procedure heading <ident>  rSOCEDtJBE -  <prog/proc/func formal parass>  prog/proc/func f o r n a l paraas  COM ST - VAR -  JL sir <ident> —i— :  <type> -ja—  prog/proc/func body : — <decls>  BEGIN  <iaent>  <statenents>  SHD  <ident>  >  WISCH Eeport All  F. D e c l a r a t i o n s  procedures  recursively.  i a WISCH  They  may  parameters f o r procedures that  procedures  computation  may  be  nested  to  of  any  being  depth.  are t h e same as f o r programs,  have  f o r VAR  are capable  VAB  parameters  parameters  i s done  of any type. only  once,  64  called Formal except Name while  arguments a r e being evaluated p r i o r t o the a c t u a l c a l l .  F.6.  Function  function ——  declaration  <function  function  heading  FUHCTION  function  heading>  —  - ™  (  <iaent>  fornal  | |  body  " • » <decls>  Like  '• •  <ident> — j — <fanc f o r a a l s >  -  prog/proc/fanc  EXTERNAL FORWARD  :  - J R —  <func  result>  :  RETURN  (  < p r o g / p r o c / f u n c body> -jjf  :  result  prog/proc/func  :  paraas  CONST VAR -  :  <type>  )  :  4t •  <ident>  <type>  ~x  : BEGIK  procedures,  nested to any depth.  <ident>  <stateaents>  a l l functions  —  EHD —  <ident>  >  are r e c u r s i v e and may be  Function formal parameters a r e the same as  f o r programs and procedures.  The f u n c t i o n value i s r e t u r n e d v i a  WISCH Report  F. D e c l a r a t i o n s  the RETURNS v a r i a b l e .  Within the f u n c t i o n looks  variable.  function  When  the  returns,  like  a  65 local  i t s value becomes the  value of t h e f u n c t i o n .  __Z_ Module  feodule  declaration HODOLB  :  —p-  <ident>  — ; j — - <nodule body>  <iap/exp>  END  <ident>  >  inp/exp  *  I 1—  nodule  IMPORT JK<ident> EXPORT — '  body  action  action  body  •• "j  <block  <block  action>  •• [• •• < f i n a l  action>  ^  • >  ENDIHITIAL  >  body>  EHDPIKAL  •  >  :  Modules  MOD ULA.  < i n i t i a l  body>  <declarations>  routines.  ~>y •—'  :  PINAL  block  ;  :  INITIAL  f i n a l  1  :  <declarations>  i n i t i a l  — ^ — r —  BEGIN — —  provide  The modules They  allow  an of  <stateaents>  means WISCH  to  >  encapsulate  are derived  v a r i a b l e s and from  those  of  the implementation d e t a i l s of an a b s t r a c t  design to be hidden from the users of that design.  Identifiers  HISCH Report defined unless read  F. D e c l a r a t i o n s  inside  a  module  they a r e e x p l i c i t l y only  are unknown exported.  o u t s i d e of the module.  66  outside of t h a t module Exported  variables  are  Exported types are "opaque",  v a r i a b l e s of that type may be d e c l a r e d o u t s i d e of the module but they  may  not be operated  on e x t e r n a l l y since t h e s t r u c t u r e of  the type i s unknown.  They may only be operated  defined  module.  within  surrounding  entered), used  Identifiers  known  a  imported  routines  i n the scope  module  i s created  (when i t s c o n t a i n i n g scope i s  the o p t i o n a l INITIAL block i s executed.  data s t r u c t u r e s . FINAL  When block  they  {or a r e PERVASIVE).  This  f o r any necessary i n i t i a l i z a t i o n of i n t e r n a l  optional  by  the module a r e unknown w i t h i n the module unless  are e x p l i c i t l y  When  the  on  the c o n t a i n i n g  scope  can be  (or e x t e r n a l )  i s exited  the  i s executed, p r o v i d i n g a means t o do any  f i n a l cleanup, r e p o r t i n g , e t c .  F. D e c l a r a t i o n s  WISCH Report  67  An example of a module i s ; MODULE symbol_table_manager IMPOST t a b l e _ s i z e , sym_type; EXPORT enter_syra, find_sym; VAR  sym_tab ; ARRAY ( 0 . . t a b l e _ s i z e - 1 ) OF sym_type; num_entries, n u m _ c o l l i s i o n s : INTEGER;  PROCEDURE enter_sym (ne»_sym : syn_type) ; {add new_sym t o t a b l e i f not t h e r e nowj ; END enter_sym; PROCEDURE find_sym Csym:sym_type; VAR found: BOOLEAN) ; {look up. sym (by name), i f found then} { f i l l i n the r e s t of t h e i n f o to sym } ; END find_sym; INITIAL BEGIN (num_entries, n u m _ c o l i i s i o n s ) ;= 0; ENDINITIAL FINAL. BEGIN {report s t a t i s t i c s on use, c o l l i s i o n s } ; ENDFINAL END  symhol_table_manager;  F. 8. Scop_e o f names  The  region  of source t e x t i n which a p a r t i c u l a r name (and  the o b j e c t i t names) i s known i s c a l l e d the scope of t h a t These  nested,  delimiters  in  declarations,  delimited WISCH  are  function  r e g i o n s a r e c a l l e d scopes. program  declarations,  declarations,  b l o c k s , FOR statements and BIND statements.  module  name.  The scope procedure  declarations,  A l l r e f e r e n c e s to a  HISCH Report name  are  outward  F. D e c l a r a t i o n s  to  the  innermost  declaration  of the name, working  from the r e f e r e n c e .  Normally, the only names known w i t h i n formal  parameter  names  and l o c a l l y  PERVASIVE  a  declared  d e c l a r e d i n o u t e r scopes are unknown.  program  a r e the  names.  A l l names  T h i s r u l e i s excepted f o r  names, which are known i n a l l i n n e r scopes and cannot  be r e d e c l a r e d . the  68  Any c o n s t a n t o r type name may be PERVASIVE, but  only v a r i a b l e s that  may be are pool v a r i a b l e s .  Procedures,  f u n c t i o n s and b l o c k s know the innermost d e c l a r a t i o n of a l l names declared  in  outer  scopes.  The only  (non-PERVASIVE)  names known i n a module are t h o s e which are e x p l i c i t l y Names  which  declared  in  are  exported  from  the  immediately  a  external imported.  module a r e known as though  surrounding  scope.  The  index  v a r i a b l e of the FOR statement i s known only w i t h i n the statement body, where i t i s a c o n s t a n t .  The  binding  identifier  o f the  BIND statement i s known only w i t h i n the statement body, where i t i s a normal  Once a  variable.  name  has  been  used  in  a  scope  {e.g.,  in  an  e x p r e s s i o n or as a type i d e n t i f i e r ) , i t ma.y n o t be r e d e c l a r e d i n t h a t scope following  {but may be i n an i n n e r is illegal:  CONST max_size = 1 0 0 0 ; PROCEDURE f o o ; VAR index : 0 . . r a a x _ s i z e ; CONST max_size = 1 0 0 ;  scope).  For  example,  the  G. Statements  WISCH Report  69  Statements  statements : <block>  <as?:ignnRnt  statement> <procedure c a l l > — — — <return statement> <if stateaent> <loop statement> <for statement> — <<v*it s t a t e n o n t > — <iterate statenent> <fork state;sent> <bind statement> <assert stateicenO <create statenent> <start statement> — <stop statement> <destroy statenent> <send state£sent> — <avait stateaent> <option statement>  T7N  G. 1 - Block  block : BLOCK  block  body  <bloc!c body>  EHDBLOCK  >  :  <dr-cIarati.on;i'>  BEGIN  <statements>  The block opens a new scope, a l l o w i n g l o c a l d e c l a r a t i o n s to be made.  I t i s e s s e n t i a l l y an i n l i n e ,  parameterless procedure.  G- Statements  WISCH Report  70  G. 2. Assignment  assignment  stateaent  <narae>  ; 3  <name>  symbol  :  (no eabedded  < r e l op> < a d d op> — — <sul op> <power op> — — L—  0  WISCH has a standard  ——  <expression>  blanks)  := := • := ' :=  <add o p > <mul o p > < p v e c op>  : — : .  syBbol>  <nane>  <nane>  assign  <assign  = — = — — • =  large  assignment  variety uses  :=  of to  assignment assign  symbols.  the  value  The  of the  expression on the r i g h t t o the storage s p e c i f i e d by the name the  left.  The  name  i s e v a l u a t e d a f t e r the e x p r e s s i o n t o be  assigned.  The type o f t h e name must be weakly  the  of  type  run-time before performs  the e x p r e s s i o n .  checks are needed; the a  compatable  swap.  with  I f i t i s s t r o n g l y compatable, no  otherwise  a  check  assignment to ensure type s e q u r i t y . storage  on  For  simple  e q u i v a l e n t t o (but perhaps more e f f i c i e n t BLOCK VAR t : type_of_a_and_b; BEGIN t := a; a := b; b z- t ; ENDBLOCK;  values, than):  must  be  made  The symbol a  b  is  WISCH Seport For  G. Statements  overlapping  values  (e.g.,  two  substrings  v a r i a b l e ) the r e s u l t of a :=: b i s implementation  The  other  another, They  assignment  being shorthand  may  be  divided  on  i n t o two c l a s s e s by form  For  first,  the  variables.  {and f u n c t i o n ) .  second  is  ":op=".  op:= b i s e q u i v a l e n t to a z- a op b, except  t h a t the name of " a " i s evaluated o n l y once i n the former S i m i l a r l y , a :op= b i s e q u i v a l e n t t o a := b op a. i  same  defined.  f o r "update" o p e r a t i o n s  c l a s s i s o f the form "op;=", a  the  symbols are a l l very s i m i l a r t o one  The f i r s t the  of  71  case.  For example:  +:= 1  increments  the i n t e g e r v a r i a b l e i by 1, and  s :%= "value of s: " concatenates  "value of s: " onto t h e f r o n t o f s t r i n g v a r i a b l e s.  There i s one of these symbols operator  ( i n each  f o r each  binary  (for which i t makes s e n s e ) .  Multiple  assignments  are  allowed  o p e r a t o r s except the swap operator by list  form)  writing  of v a r i a b l e names t o be assigned t o . (a,b,c)  f o r a l l assignment a  parenthesized  For example:  +: = expr;  i s equivalent to: a *:= expr; b •:= expr; c +:= except  expr  expr;  i s evaluated only once i n the former case,  any o f t h e names.  before  WISCH Report  G. Statements  G.3, Procedure  procedure  c a l l  72  call  :  i  <name> —  — (  Procedures  ^  <expression>  are c a l l e d  and s u p p l y i n g a l i s t evaluated  from  left  — * —  )  >  by simply w r i t i n g the procedure name  of actual  arguments-  The  arguments  to r i g h t , and must be s t r o n g l y  are  compatable  with t h e i r c o r r e s p o n d i n g formal parameters,  G.4. Return  return  stateaent RETURN  The  : >  r e t u r n statement i s simply the word RETURN-  I t causes  an immediate  r e t u r n from the c u r r e n t procedure or f u n c t i o n .  is  to  illegal  program.  attempt  to  (To stop a program  return  from  It  the outer l e v e l of a  use the STOP statement.)  G. Statements  HISCH Report  73  G.5. I f  i f statement : IF  The  -ik- <expt>  IF  EL I F THEN  <stQts>  -7^-  FI  The ELIF c l a u s e a l l o w s c o n c i s e coding of the  common IF-THEN-ELSE-IF seguence. IF b l THEN si;  s2; ELSE I F b2 THEN S3;  Fl;  <stats>  statement a l l o w s a r b i t r a r y seguences of statements  f o r e i t h e r branch.  Fl;  - i — p ELSE  s<4;  can be compressed t o : IF b1 THEN s1; s2; ELIF b2 THEN s3; s4; Fl;  F o r examples  G. Statements  WISCH Report G.6.  Loop  loop  stateaent LOOP  The  : <statements>  indefinite  defined  NEXT  looping  >  structure  o f WISCH  v i a two statements, LOOP and EXIT-  executing  an  EXIT  statement.  s t r u c t u r e t o handle a l l common forms  This of  i s actually  The LOOP statement  d e l i m i t s a range of statements to be repeated by  until  terminated  provides  looping  such  " w h i l e " and " r e p e a t " statements of PASCALThe t r a d i t i o n a l "WHILE b DO s " form can be w r i t t e n as: LOOP EXIT UNLESS b; s• NEXT; The "REPEAT s UNTIL b" form can be w r i t t e n a s : LOOP s« EXIT WHEN b; NEXT ; The "n+1/2" times l o o p can be w r i t t e n a s : LOOP  s1;  EXIT WHEN b;  s2;  NEXT ;  74  a  single as the  WISCH Report  G. Statements  75  G. 7. E x i t  loop c o n t r o l : T— —-  EXIT -x—I— U N L E S S - — — < e x p r > I T E R A T E — " — WHEN  'Vk"-|  1  The  EXIT  statement  closest enclosing procedure  or f u n c t i o n  i n s i d e a loop other  LOOP  o r FOR body.  the EXIT  cannot cause e x e c u t i o n  <stmts> ••  FIH —af '  i s used t o immediately e x i t from the  (in the c u r r e n t  words,  DOIKG  1  within  the c u r r e n t  program,  Use of the EXIT statement when not program,  must  t o leave  etc.) i s i l l e g a l .  In  have something t o e x i t from, and the c u r r e n t  program,  procedure  or  function.  I t i s l e g a l though t o EXIT from a l o c a l BLOCK.  The  exit  occur  present, true.  will  otherwise  unconditionally  WHEN  clause  is  i t w i l l occur i f the boolean expression i s  The DOING c l a u s e allows  action,  useful  specific  exit conditions.  specification  f o r multi-level  For example, c o n s i d e r  i f no  exits  the following  of  a  "postlude"  and " s i d e e f f e c t s " f o r  code  t o do  disk  track  allocation: new_track z- - 1 ; FOR c y l i n d e r := 0 TO l a s t _ c y U n d e r LOOP FOR t r a c k ;= 0 TO t r a c k s _ p e r _ c y l i n d e r - 1 LOOP EXIT WHEN - r e s e r v e d ( c y l i n d e r , t r a c k ) DOING new_track := c y l i n d e r * t r a c k s _ p e r _ c y l i n d e r EXIT; {from outer FOR also} FIN; NEXT; NEXT ;  + track;  IF new_track ->= - 1 THEN . . . When  a f r e e t r a c k i s found, both l o o p s are e x i t e d and new_track  KISCfl Report i s assigned the value of the t r a c k outer  loop  construct  G.8.  will  finish  leaving  (and example) are due  G. Statements  76  I f no t r a c k s are f r e e ,  the  new_track  as -1-  to M. Yasumura iYAS  T h i s loop  773-  For  f o r statement  :  FOE  LOOP  <for control>  <stateaents>  NEXT  — —  >  for c o n t r o l : <ident>  <expr> — j —  := —  TO  '—  The FOR ALGGL-like and i s  statement  constant  expressions type) and semantics  may  The index  within  i t .  be of any s c a l a r  the "BY" are  BY — —  sign  ascending  of  roughly  the  TO —  ^ A  <expr>  '  to  or  other  The  «;=«  type  (but must be of the same  and  "TO"  control  value.  The  step the index v a r i a b l e from the ABS (BY) 'th  BY e x p r e s s i o n determines  (positive)  in  >  v a r i a b l e i s l o c a l to the loop  e x p r e s s i o n must have an i n t e g e r  value to the TO v a l u e , using every The  <expr> — —  <eipr>  i s very s i m i l a r to those found  languages.  a  <expr> — p - B Y  descending  value  z=  inbetween.  whether the loop i s  (negative).  The  BY  e x p r e s s i o n must not be z e r o .  I f the i n i t i a l value i s beyond the  f i n a l a t the s t a r t , the loop  body  isn't  entered.  All  three  c o n t r o l e x p r e s s i o n s are evaluated only once, at the beginning  of  the loop.  an  EXIT  The  statement.  FOR  statement  may  a l s o be  exited  early  via  WISCH Report  The  G. Statements  p r e c i s e semantics of the FOB statement  77  are i l l u s t r a t e d  by the f o l l o w i n g WISCH code: FOB  index := s t a r t TO f i n a l  BY step LOOP statements NEXT  i s eguivalent to; ELOCK TYPE i n t = INTEGER; index_type = {type of s t a r t and f i n a l } ; CONST t1 = f i n a l ; t2 = step; vaa t 3 : = s t a r t : index_type; BEGIN LOOP EXIT WHEN ( i n t (t3) *SIGN (t2) ) > ( i n t (t 1) *SIGN (t2) ) ; BLOCK CONST index = t 3 ; BEGIN statements; ENDBLOCK; t3 := index_type ( i n t (t3) +t2) ; NEXT; ENDBLOCK; where t l , t2 and t3 a r e not otherwise used i n the program.  loop  control:  WISCH Report  G. Statements  78  The ITERATE statement causes an immediate jump to the  next  iteration  of  a  LOOP  or FOR statement.  For a LOOP statement,  t h i s means to the s t a r t of the loop body and f o r a FOR statement to it  the  "increment and t e s t " p o r t i o n .  may only be used i n s i d e  a  LOOP  L i k e the EXIT statement,  or  FOR  statement  i n the  c u r r e n t program, procedure or f u n c t i o n .  __±Q_  Fork  fork stateaent : \ FORK  <expression> —  OF —— <case stmt l i s t > — — JOIH  case s t a t l i s t :  CASE - - - <ex pr> -  <stateaents>  OTHER  The  FORK  statement i s WISCH's v e r s i o n of what i s known i n  some languages as a "case" must lists  <statenents>  <expr>  statement.  The  branch  expression  have a s c a l a r value, which s e l e c t s one of the l a b e l e d case f o r execution.  expressions  agreeing  The in  case  type  labels  with  p a r t i c u l a r case may be l a b e l e d by any "subrange"  form  of  values i n t h e range. explicit  labels  case  label  must  be  literal  the branch e x p r e s s i o n . A number  of  values.  i s s h o r t f o r the l i s t  The  of a l l  The OTHER case i s s e l e c t e d i f none of the  match the e x p r e s s i o n value.  I t i s an e r r o r i f  no OTHER case i s present and none of the e x p l i c i t l a b e l s match.  G- Statements  WISCH Report G. 1 1.  Bind  bind stateaent  : I  BIND  The  : |  v  <ident>  1  TO  <name>  variable  identifier  r  -  name  i s bound  (the bound i d e n t i f i e r ) .  variable  name  1  IN  —  to  <stats>  dereferencing.  The  record bound  which  a  DNBIHD  )  (long  and  some (short and simple)  On e n t r y to  i s "evaluated",  a c t i o n s as array s u b s c r i p t i n g , pointer  ~ a  BIND statement c r e a t e s a scope i n  complex)  the  possibly field  the  statement,  involving selection  such and/or  i d e n t i f i e r i s then made to  r e f e r to the s e l e c t e d storage l o c a t i o n and has the same type the  name.  Subseguent  l o c a t i o n referenced  BIND statement.  —  : ( —  may  A pool p o i n t e r may not be a l t e r e d (by a SEND or  G.12. A s s e r t  ASSERT  Pool p o i n t e r s  when used as part o f the v a r i a b l e name i n a  AWAIT) while i t i s dereferenced  stateaent  as  changes t o the "name" do not change t h e  by the bound i d e n t i f i e r .  only be dereferenced  assert  79  <expression>  i n a BIND statement.  HISCH Report  if  G. Statements  80  The ASSERT statement e v a l u a t e s the boolean e x p r e s s i o n ,  and  i t is  not  TRUE,  causes  the p r o c e s s t o stop with a f a t a l  error.  G.13.  Create  C r e a t e statement : — -  CREATE  create  options  <name> - —  :  {011st  FROH  be i n order  <naae>  —  froa  < n a a o > ERROR — PRIORITY <expression> ! STACK ——• <expression> — HEAP — — <exprassion> — TIME — <expression>  —  top t o  <create  specified  program.  start  Start  statement START  : <name>  >  >  j  process  modeled  after  The process v a r i a b l e must not already  r e f e r to an e x i s t i n g process.  G. 1 a.  ••'  bottom)  The CREATE statement c r e a t e s a new the  options>  WISCH Beport The state.  G- Statements  STABT  statement  removes  a  81  process from the stopped  Where i t goes depends on i t s s t a t e when i t was  stopped.  I f i t was w a i t i n g , i t w i l l go back t o a waiting s t a t e , otherwise must have been i n a s t a r t e d s t a t e and processes ready t o be executed.  will  I t will  time i n some implementation d e f i n e d  join  the  list  of  then be given p r o c e s s o r  manner (the only  guarantee  i s that i t w i l l be g i v e n processor time e v e n t u a l l y ) .  G. 15. Stop  stop  statenent  :  STOP — I — I  <narae> HISELF  A  — >  1  The STOP statement removes a p r o c e s s from waiting  the  s t a t e s and puts i t i n the stopped s t a t e .  started  As long as i t  i s stopped, i t w i l l not get any p r o c e s s o r time, nor w i l l g i v e n any shared o b j e c t s i f i t was w a i t i n g .  G-.J.6- Destroy  destroy  stateaent DESTIiOT  : <naoe>  >  or  i t be  WISCH Report The in  G. Statements  DESTROY statement  a stopped  state.  destroys the process, which  must  82 be  A l l pooled o b j e c t s t o which the o b j e c t has  r e f e r e n c e s are returned t o t h e i r owner pools.  __12_  avait  Await  stateaent  :  AWAIT  The  <naae>  AWAIT  FROH  statement  <naae>  »  requests t h a t an o b j e c t be a l l o c a t e d  from a pool and the r e f e r e n c e to i t assigned t o a pool The  pointer  must have the v a l u e NIL b e f o r e the assignment.  an o b j e c t i s a v a i l a b l e the process i s given i t continue.  pointer.  If  the  pool  i s empty,  and  allowed  If to  the process i s put i n t h e  waiting s t a t e and a t t a c h e d to the p o o l .  G. 18. Send  send  stateaent SEND  The  ; <name>  SESD  TO  <naae> • - SENDER  statement  sends  RESPOHD  an o b j e c t pointed t o by a pool  p o i n t e r t o a p o o l , a l l o w i n g t h e sending the  pool  i s empty  <uaae>  process t o continue.  If  and t h e r e are any processes i n the w a i t i n g  WISCH Report  G. Statements  s t a t e , one of them i s given access t o the o b j e c t and the  started state.  I f OWNER i s s p e c i f i e d  o b j e c t i s sent to i t s owner pool. sent  to  object.  the  response  83  placed  in  i n the TO c l a u s e , the  I f SENDER i s s p e c i f i e d , i t i s  pool given i n the p r e v i o u s SEND on that  The RESPOND clause s p e c i f i e s the pool  f u t u r e " r e t u r n s t o sender".  I f i t i s omitted,  to  be  used  in  the f i e l d i s l e f t  unchanged.  G.19. Option  option statement : OPTION  The options.  <iient>  OPTION  statement  i s used  to  specify  compile  time  (At t h i s time, the standard o p t i o n s a r e undefined.)  BISCH  H.  Report  Expressions  H_ E x p r e s s i o n s  expression : —  <relation> - - j - - <repeat op> - — <relation> ^  )  relation : <siap expr>  siir.p  <rel op> h~ <elem op> —  <simp expr> — — <siap expr>  '  >  exp:  <uaary op>  - <tera>  j^  <add op> - — <tera>  ^  *  tern : <factor>  < E U 1 op>  <factor>  factor : <itea> — j ^  <potrer op> - —  <factor> ~* ^  B U I op  item : ( — —• <expression> i ——<Uteral> <naae> a  - 1 —  I '  —»  r e l op  • '• • ) —yr  I — II ' XOR  %  >= -.>= > —  —  elea op ——•  — —  DIV REM MOD S — 66 -  add op < — -.< <= -  * /  -»IH - —  1  84  WISCH  H»  Report  I  <ident>  ( — .  ident :  literal  - <expression> <ident> —  (no embedded b l a n k s , l a s t c h a r c a n n o t be _)  -i  <letter>  <letter> <digit>  1  -  unary op :  Eh.  ^  :  power op : <boolean l i t e r a l > <char l i t e r a l > <enurcerated  **  —  While t h i s expressions,  contrary, have  of  This  terms, i t i s very  operators  i s  not  and  important  to  types  the  language  f o rtheir  i s that the determination  especially  by  realize  s o l e l y by  types  of the  t o say that types a r e ignored,  WISCH i s a s t r o n g l y t y p e d suitable  not  of  and  operators.  which  o p e r a n d s i s done on t h e b a s i s o f o p e r a t o r is  >  e t c . , and programmers u s u a l l y  t h e a n a l y s i s o f e x p r e s s i o n s i n WISCH i s g o v e r n e d  operands.  say  !  i e . i n t e g e r , boolean,  precedence  must  repeat op :  r e p o r t d i s c u s s e s e x p r e s s i o n s i n terms o f " t y p e d "  t h i n k o f them i n t h e s e  the  >  liteial>  <integer l i t e r a l > <real l i t e r a l > <string l i t e r a l > — — <st.orago l i t e r a l > <structured l i t e r a l >  that  85  , —  3 t  . a  Expressions  noticeable i n expressions  on t h e  a l l operands What t h i s  operators  have  which  precedence o n l y . which  contain  does  This  boolean  HISCH  operators boolean as  *  (S, | ,  and -«) and r e l a t i o n a l o p e r a t o r s .  operators are treated or  *  Since t h e  liJce other s c a l a r o p e r a t o r s  f o r integers),  r e l a t i o n a l operators. (p  86  H. Expressions  Report  (such  they have higher p r i o r i t y than t h e  Thus common e x p r e s s i o n s such a s :  NIL) & (pa.value < a)  must be p a r e n t h e s i z e d f c r proper The f o l l o w i n g operator  interpretation.  t a b l e summarises the o p e r a t o r s a v a i l a b l e prec.  operands  i n WISCH:  description  **  3  integer,real  exponentiation  * *  2 2 2 2 2 2 2 2  integer,real set real integer integer integer boolean storage  multiplication set i n t e r s e c t i o n real division integer d i v i s i o n i n t e g e r remainder mathematical modulus l o g i c a l and b i t w i s e and  1 1 1 1  integer,real set boolean storage string  addition, subtraction s e t union, s e t d i f f e r e n c e l o g i c a l or b i t w i s e o r , b i t w i s e xor s t r i n g concatenation  integer,real integer,real set boolean storage  unary unary unary unary unary  /  DIV REM MOD  &  &S  +, ~ 1  II,XOB  %  1  *,-  ABS  -  <l  1 1 1 1  <,-<,<= -<=r>=. ->=,>,-> = ,~v=  IN  . - . I H  0 0 0 0 0  any  <1>  ii n  any,pointer scalar S set  p l u s , unary minus a b s o l u t e value s e t complement l o g i c a l negation b i t w i s e complement  general i n e q u a l i t y it ii  «  II  test ii  II  " equality s e t element t e s t  <1> Where "any" means any s c a l a r , r e a l , s t r i n g or s e t type.  "  WISCH Seport __  87  I/O f a c i l i t i e s  The I/O  I . I/O f a c i l i t i e s  WISCH  programmer has a need f o r two d i s t i n c t forms o f  facitities.  facilities  F i r s t , , i n order to write an  operating  system,  must he provided t o c o n t r o l and communicate with any  d e v i c e a t the l e v e l of a device handlermechanisms  are needed t o perform  Second,  higher  level  the I/O r e q u i r e d by the higher  l e v e l p r o t i o n s of t h e system, e.g., to read from and write to a " c o n s o l e " t e r m i n a l or t o access f i l e s on backing s t o r e .  The in  a  low l e v e l f a c i l i t i e s a r e v i r t u a l l y i m p o s s i b l e to d e f i n e  machine  Different  or  machines  even  configuration  have  vastly  c o n t r o l l i n g p e r i p h e r a l equipment. quite  different  means  A  independant  different single  manner.  mechanisms f o r  machine  may  of communicating with d i f f e r e n t  have  devices  depending on t h e d e v i c e type, use o f d i r e c t memory access, e t c . Because  of  these  approach t o I/O. necessary be  low  called  from  difficulties,  WISCH does n o t d e f i n e a s i n g l e  I n s t e a d , an implementation  must  provide  the  l e v e l d r i v e r s as standard r o u t i n e s t h a t may only a  machine  dependant  program,  procedure  or  function.  These d r i v e r s w i l l provide only very low l e v e l support, f o r example seeking a d i s k arm  to  a  cylinder,  reading/writing  a  s e c t o r from the c u r r e n t c y l i n d e r , r e q u e s t i n g s t a t u s i n f o r m a t i o n , r e a d i n g / w r i t i n g a s i n g l e c h a r a c t e r / l i n e to/from a t e r m i n a l , e t c . To  the  process  requesting  i t , the I/O t r a n s f e r appears as a  WISCH  fieport  I . I/O f a c i l i t i e s  synchronous, i n d i v i s i b l e o p e r a t i o n . need  to  be  structure. interrupt  a l l concerned  The WISCH programmer has no  about any u n d e r l y i n g i n t e r r u p t  I f a process i n i t i a t e s  an  I/O  d r i v e n , i t w i l l become blocked  operation. driven  at  Of course  88  f o r operations  operation  that i s  u n t i l completion  that  are  not  of the  interrupt  {e.g. t h e r e a d i n g of a r e a l time c l o c k ) , the process need  not block. existing  I d e a l l y , t h i s b l o c k i n g mechanism would u t i l i t i z e the  message passing  Since  the  facilities.  structure  of  the high l e v e l I/O mechanisms i s  e x a c t l y what one i s w r i t i n g i n WISCH, they undefined.  must  also  be  left  WISCH Beport  J . Loading and running programs dynamically  89  J-, Loading and running programs dynamically  The  design  of  a "complete"  language s u i t a b l e f o r w r i t i n g  " r e a l " operating systems i s complicated by a d i f f i c u l t i s s u e not found  i n "normal" language design.  An operating system must be  able t o dynamically l e a d an a r b i t r a r y and  then execute t h a t program.  program i n t o  main  memory  The new program must be a b l e t o  communicate with the system, p r e f e r a b l y  in a  well-controlled,  secure  manner.  issue  i s only  resolved  i n WISCH.  Unfortunately,  It i s suggested procedure,  LOAD,  this  that an implementation  which  accepts  two  provide  main  LOAD  to  parameter)  and  will  i t t o do the a c t u a l l o a d i n g .  have a l a r g e ABBAY OF ST08AGE as a VAB set  a  pointer  VAB to a  w i l l a c q u i r e a s u i t a b l e amount of memory (the  amount may be another passed  standard  arguments:  parameter which i s a p o i n t e r t o a program and • a procedure.  a  partly  up any necessary  call  the r o u t i n e  (This procedure  parameter.)  LOAD  should will  d e s c r i p t o r i n f o r m a t i o n and make the program  p o i n t e r r e f e r to the newly loaded program.  Processes  be c r e a t e d from t h i s program j u s t l i k e any other.  may  then  WISCH Report  K. Ifflplementatio.il of WISCH  90  K. Implementation o f WISCH  A  major  aspect  of  this  research  implementation of most of the language. p r o j e c t , the implementation e f f o r t the  sequential  parts  multi-programming  of  the  features,  been  the a c t u a l  Due t o the s i z e of  the  has so f a r been r e s t r i c t e d to  language.  Except  for  the  the only major unimplemented  are array and r e c o r d l i t e r a l s , statement.  has  items  dynamic subranges and the  OPTION  S e v e r a l other areas a r e i n c o m p l e t e l y implemented  of t h i s w r i t i n g , notably many o f the standard operations,  the  FORK  statement,  routines,  as  string  the BIND statement, modules,  most run-time checking and "code" p o i n t e r s .  The bulk of produces  object  the  implementation  modules f o r the ASP  is  the  compiler,  which  machine (described i n PART  I I of t h i s t h e s i s ) .  The compiler i s w r i t t e n i n PASCAL and  under  u n i v e r s i t y * s AMDAHL 470.  MTS  on  used to l i n k suitable  WISCH  the load modules and t r a n s l a t e  for  minicomputer  the  final  loading  on  owned by the department  program  may  The  The ASP l i n k e r i s them  a  form  Hewlett-Packard  21 MX  of Computer  then be run using the ASP  RTE-2 o p e r a t i n g system on the 21UX. implemented  the  Thus,  into  Science.  consists  modelled a f t e r  the  compilers  77].  £ HAR  of  Concurrent The  first  three PASCAL  WISCH  passes and  The  machine under the is  as a c r o s s - c o m p i l e d , s e g u e n t i a l h i g h - l e v e l  compiler  runs  currently language.  and i s somewhat  Sequential  pass performs l e x i c a l  PASCAL analysis  WISCH Report and  parsing,  generates  K„ Implementation of WISCH using a hand-coded r e c u r s i v e an  representation compiler.  intermediate  code  of the parse t r e e .  I t b u i l d s the block  declaration generates  analysis, code  literal  postfix  and  as a push-down  the p o s t f i x output from pass one i n t o language  f o r pass three.  small; i t i s e s s e n t i a l l y  tokenized  output  assembler  from pass two and generating  a  Pass t h r e e i s accepting  the  l o a d modules f o r  ASP l i n k e r .  Each r o u t i n e i s output as a separate modules  contain  compilation  The  These  compiler  allows  separate  but  a  (This must c u r r e n t l y be done by manual  program  to  do  i t would  E x t e r n a l r o u t i n e s must be i d e n t i f i e d program  module.  of i n d i v i d u a l r o u t i n e s and the replacement of a l o a d  module i s a simple task. editing,  load  not j u s t the name of the r o u t i n e , but a l s o i t s  path name i n the program t r e e .  it  a  expressions  I t i s organized  relatively  the  containing  It  s t r u c t u r e d symbol t a b l e , performs  f o r statements.  assembly  parser.  Pass two i s the heart o f the  evaluates  automaton, transforming "tokenized"  file  descent  91  tree.  be  g u i t e simple.)  by name and l o c a t i o n i n t h e  The l i n k e r b u i l d s a t r e e - s t r u c t u r e d load map as  l i n k s t h i n g s together.  no problem at a l l (provided  Two r o u t i n e s  with t h e same  they a r e not s i b l i n g s ) .  name a r e  L. Future work with WISCH  WISCH Eeport  92  L. Future work with WISCH  Although still  i t i s intended  a research vehicle.  arising  out  of  the  to  be a useable t o o l , WISCH i s  There a r e s e v e r a l  language  yet to  be  compiler i s w e l l s t r u c t u r e d and reasonably completing  the  implementation  or  interesting investigated.  well  The  documented  modifying the language  f e a s i b l e task.  Much of the language  evaluation  i t s c u r r e n t design a l s o f e a s i b l e .  of  areas  works  at  present,  so is a  making  Some o f these  p o s s i b l e areas o f f u t u r e development a r e ; 1. Completion features.  There  of  the  implementation  are several  of  interesting  the concurrency  questions  involved  here, p a r t i c u l a r l y i n v o l v i n g how to organize the process c o n t r o l and message p a s s i n g f a c i l i t i e s .  There a r e many c h i o c e s  of  how  to  p a r t i t i o n p h y s i c a l memory, how t o provided the shared memory  for  pools, etc. 2. I n v e s t i g a t e  the a c t u a l  usefulness  p a r t i c u l a r l y i n a p p l i c a t i o n s t h a t have multiprocessing. language, be  Evaluation  especially  attempted  the  language,  not t r a d i t i o n a l l y  used  the s e q u e n t i a l aspects o f t h e  the c o n t r o l s t r u c t u r e s and  a t t h i s time.  depends on completion  of  of  modules,  could  E v a l u a t i o n of the c o n c u r r e n t p a r t s  of them, but c o u l d be an e x c i t i n g area.  3. Examine s o l u t i o n s t o some problems faced by a l l "systems programming" languages. ability  to  without  abandoning  language.  call  One such i s s u e i s how  procedures  Another  provide  an  with v a r y i n g numbers of parameters  the " p r o t e c t i o n i s t " i s how  to  to  handle  philosophy type  of  escapes;  the WISCH  WISCH Report currently The  L. Future work with WISCH  d e f i n e s one approach but there are c e r t a i n l y  combination  of  these  two  93  others.  i s a l s o i n t e r e s t i n g , i t i s the  problem f a c e d when one t r i e s to write r o u t i n e s such as  PASCAL'S  BEAD and WRITE without having them b u i l t i n t o the c o m p i l e r . 4.  Use  development.  the  language  The  current  as  a  base  design  f o r further  and  implementation  p r o v i d e a good b a s i s f o r other experiments i n It  i s hoped t h a t people w i l l f e e l  will.  language  language  could design.  f r e e to modify the language a t  M. I n t r o d u c t i o n to ASP  The ASP machine  94  fl. Introd u c t i o n t o ASP  The primary motivation .for the design and implementatioa of the  programming  language  WISCH  was  to  provide  a  suitable  h i g h - l e v e l language f o r systems programming on the department of Computer  Science's  Since the a r c h i t e c t u r e of t h e 2 1 MX i s l e s s  minicomputer. pleasant,  2 1 M X microprogramable  Hewlett-Packard  especially  f o r the  implementation  of A l g o l - l i k e  languages, i t was decided that WISCH would be implemented totally  different  instruction set.  architecture,  The ASP machine  r e s u l t of t h i s design  ignoring (&  the  Stack  than  on  standard  Processor)  a  21 MX  i s the  effort.  Although designed as a v e h i c l e f o r WISCH, ASP i s a s u i t a b l e machine f o r many modern languages.  I t has been  t o run on an HP 2 1 M X , E - s e r i e s computer. abstract or  microprogrammed  I t i s not a v i r t u a l or  machine, i t i s every b i t as r e a l as the standard 2 1 M X  any  other  microprogrammed  computer.  Because  of  this  commitment t o r e a l i t y , performance c o n s t r a i n t s and the nature of the u n d e r l y i n g hardware have f o r c e d compromises i n t o the d e s i g n . ASP i s n o t claimed t o be an " o p t i m a l " machine i n any sense. is  however  a  viable  architecture,  It  o f f e r i n g easy t o generate  code, very compact code and r e a s o n a b l e speed.  The Iii  N. Basic s t r u c t u r e of ASP  ASP machine  95  Basic s t r u c t u r e of ASP  The  machine  architecture.  has  a  fairly  Conceptually,  normal  memory  stack  i s divided  program  r e - e n t r a n t program code plus l a r g e  constants.  the  The  Stack a l l o c a t i o n of v a r i a b l e s  r e c u r s i v e r o u t i n e s a r e the normal mode  heap  heap.  At any i n s t a n t , t h e s t a c k c o n t a i n s a s t a c k frame f o r  each c u r r e n t l y a c t i v a t e d r o u t i n e . and  the  three  the  contains  and  into  d i s t i n c t a r e a s , the program, area  stack,  oriented  i s used  f o r dynamic  of  operation.  The  a l l o c a t i o n of space under e x p l i c i t  program c o n t r o l .  All  memory  addressed. b i t 0. but  i s composed  The  rightmost  caused  document  offsets  and  used  Some o f t h e terminology  But  unless  addresses  undefined,  bytes o f memory.  word.  is  byte  word  addressing,  performance problems (because  in  otherwise the  a r i t h m e t i c i s two's complement. currently  and  o f the  used i n the r e s t  i s a c a r r y over from t h i s v e r s i o n and d e a l s  (8 b i t ) b y t e s .  string.  b i t words  ( l e a s t s i g n i f i c a n t ) b i t of a word i s  serious  hardware o f 21MX).  length  16  An e a r l y v e r s i o n o f the machine  this  this  of  mentioned,  sequel  but they are t e n t a t i v e l y  S t r i n g s a r e s t o r e d as  a  one  with  a l l sizes,  are i n words.  The exact format  of  of  Integer reals  is  planned  t o use 6  word  (current)  f o l l o w e d by "max-length" bytes f o r the c h a r a c t e r s i n the Sets are simply a seguence of words, Arrays  lexicographic  are order.  just  a  The  sequence array  of  16  elements  elements  subscripting  stored  per in  instruction  The ASP machine requires  a  N. B a s i c s t r u c t u r e of ASP  descriptor,  but  memory and need not be l i n k e d  this  may  96  be l o c a t e d anywhere i n  to the a r r a y .  P h y s i c a l memory i s organized as f o l l o w s : (high address) heap  (grows down) < — stack  limit  < — workspace t o p workspace  (grows up)  variables parameters l i n k a g e area f u n c t i o n value  < — c u r r e n t stack frame ( i f appropriate)  e a r l i e r stack frames g l o b a l stack frame < — stack base program  area  (low address)  The  code  followed by the  for a actual  routine body  consists of  the  of  a "prologue"  routine.  The  area  prologue  contains; offset 0 1 2 3 4-n The f i r s t  contents s i z e o f parameter and l i n k a g e area s i z e o f v a r i a b l e area maximum amount of workspace needed s i z e of "constant" area 11  c o n s t a n t " area  (large  literals)  f o u r words must always be present.  The constant  area  may be empty, but by convention the f i r s t part of i t should be a s t r i n g l i t e r a l g i v i n g the name of the r o u t i n e . The l i n k a g e area  N. B a s i c s t r u c t u r e of ASP  The ASP machine  97  f o r each stack frame i s a s i x word area composed o f : offset 0 1 2 3 4 5 The  contents static link e n t r y point of c u r r e n t r o u t i n e dynamic l i n k r e t u r n address index r e g i s t e r save address of l a s t stack word needed {end o f v a r i a b l e s and maximum workspace)  g l o b a l {bottom-most) stack frame i s  a  must begin with a n i n e word area organized offset 0 1 2 3 4 5 6 7 8 The  Its  as f o l l o w s ;  use of these words i s e x p l a i n e d i n the s e c t i o n d e a l i n g with  The  index  There a r e i n s t r u c t i o n s , however, t o l o a d {intended  e r r o r handling r o u t i n e s ) . -  Normally,  only  r e g i s t e r i s d e a l t with d i r e c t l y , the others are used  of them d i r e c t l y  PC PS SB SF HP SL IR CI  of ASP.  machine has e i g h t i n t e r n a l r e g i s t e r s . ,  implicitly. any  case.  contents address of f i r s t word i n t h e stack {a p o i n t e r to i t s e l f ) main e n t r y p o i n t o f the program address of HP save area address of ASP save area e n t r y p o i n t of i n t e r r u p t i n t e r f a c e address of l a s t stack word needed by main program address o f highest word a v a i l a b l e f o r stack or heap e r r o r code mask i n s t r u c t i o n that caused the e r r o r  the a c t u a l implementation  the  special  store  to be used only by debugging and  The r e g i s t e r s a r e :  program counter program s t a t u s stack base p o i n t e r s t a c k frame p o i n t e r workspace top p o i n t e r stack l i m i t p o i n t e r index r e g i s t e r current instruction  or  N.  The  ASP  machine  The  program s t a t u s xxxx  but  SCCC The  "x"  error.  "C"  bits  compare  The are  Normally they are  comparison c o n d i t i o n  instructions  contains frame. frame  b i t i s f o r a planned s i n g l e - s t e p  the  The  next i n s t r u c t i o n  The zero,  the  and  tested  code.  by  be  address  executed.  conditional  of  the  The  first  register  contains  s t a c k frame.  address  of  the  word i n the  The  the top  workspace top  word c u r r e n t l y  the s t a c k .  I t d e f i n e s the  s t a c k , so  i t changes as the  register  may  current  current  be  used  instruction.  stack  word  heap grows and  shrinks-  i n operand addressing and  In  the  event  a t o f f s e t 8 i n the  codes are:  no e r r o r i l l e g a l instruction stack overflow heap overflow integer arithmetic error r e a l arithmetic error (unused)  word of  The  of  a  the the  stack  available  boundary between the heap and The  the  index  loop c o n t r o l .  fatal  word of  the  error, i t s  g l o b a l s t a c k frame.  c u r r e n t l y recognizes 1 1 error states.  t h e i r associated -  The  contains  i n s t r u c t i o n r e g i s t e r c o n t a i n s the f i r s t  c o n t e n t s are s t o r e d machine  last  register stack  i n the workspace.  l i m i t r e g i s t e r c o n t a i n s the address of the  the  global  first  register  by  branch  address of  stack . base  address of the  The  They are s e t  program c o u n t e r c o n t a i n s the  to  mode.  I t allows r a p i d access to g l o b a l v a r i a b l e s .  current  0 1 2 3 4 5 6  as;  b i t s are c u r r e n t l y unused-  machine e r r o r s t a t u s .  "S"  instructions.  The  98  i f a f a t a l e r r o r o c c u r s , they are s e t to a code to i d e n t i f y  the  for  s t r u c t u r e of 4SP  r e g i s t e r i s as organized  xxxx EE EE  "E" b i t s are the  Basic  These s t a t e s  The and  N. Basic s t r u c t u r e of ASP  The ASP machine 7 8 9 10 11 12  -  99  s u b s c r i p t out of range range check f a i l u r e (unused) s t r i n g operation error a s s e r t i o n f a i l u r e (used with the " s u i c i d e " i n s t r u c t i o n ) FOfiK jump e r r o r (used with the " s u i c i d e " i n s t r u c t i o n )  Almost a l l e x p r e s s i o n e v a l u a t i o n i s workspace  f o r temporary  storage.  f o r temporaries.  words l o n g . form.  A l l workspace  or  only  program  space  one  The f i r s t operand i s taken from the top of the  on  the workspace.  A  set  the  address  workspace,  result  is  placed  (Comparison o p e r a t i o n s do not r e t u r n a  value t o the workspace, they simply s e t the comparison code.)  the  operands a r e 1, 2, 3 or 4  Commonly used dyadic o p e r a t o r s have a  the second i s the addressed operand and back  using  The e x c e p t i o n s are the s t r i n g  and s e t o p e r a t i o n s which must use stack aside  done  condition  few common monadic o p e r a t i o n s are a l s o provided i n a  one address form.  Less commonly used o p e r a t i o n s are provided i n  a zero address form with a l l operands taken from the  workspace.  The ASP  0. Design  100  rationale  The  stack  workspace was of  0. Design r a t i o n a l e  machine  code  orientation  with  e x p r e s s i o n e v a l u a t i o n on the  chosen over a r e g i s t e r o r i e n t a t i o n f o r  g e n e r a t i o n and code compaction.  simplicity  R e g i s t e r machines are  more f l e x i b l e and p o t e n t i a l l y f a s t e r , but are c o n s i d e r a b l y difficult  to  certainly  will  generate be l a r g e r .  address o p e r a t i o n s was for  space and time  expression  code  with  f o r and the r e s u l t i n g code almost  The  mixture of one address  LOAD'S, n/2  The  savings. n variables  one address  operations A+B+C+D and provide  one  (many  Consider  the  evaluation  (n-1 o p e r a t o r s ) .  some  numbers,  zero  of  operations  n-1  zero  (n/2)-1  results).  illustrate assume  and  that  these  zero  (The two  LOAD'S  address  address  extremes.) and  n/2  expressions  one  o p e r a t i o n s are 16 b i t s long and zero address o p e r a t i o n s T a b u l a t i n g the above r e s u l t s :  an  The zero address  address machine w i l l r e q u i r e a t most  intermediate  (A + B)*(C+D)  and  s e l e c t e d over a pure zero address machine  machine w i l l r e q u i r e n LOAD i n s t r u c t i o n s and operations.  more  To  address are  8.  0- Design r a t i o n a l e  •The ASP machine  zero addr. 2n - 1 24n - 8  # of i n s t r . # of b i t s  best one addr. n 16n  101  worst one addr. 1.5n - 1 20n - 8  For v a r i o u s v a l u e s of n the f o l l o w i n g r a t i o s of zero address one address are o b t a i n e d : # of b i t s . best worst  n  # of i n s t r . worst best  2 3 4 5  1. 50 1.67 1.75 1.80  1.50 1.43 1.40 1.38  1.25 1-33 1.38 1-40  1.25 1.23 1-22 1.22  l i m i t 2.00  1.33  1.50  1-20  Further scheme as schemes  by  may  be r e a l i z e d through an encoding  Tannenbaum  £TAN 78J.  not the case f o r the  hardware  such  that  ASP  must  deal  A l l ASP i n s t r u c t i o n l e n g t h s are m u l t i p l e s of 16 b i t s (so  the worst case s i z e above becomes 24n-16). should the  However,  r e g u i r e cheap byte a d d r e s s i n g t o perform w e l l , which i s  definitely with-  improvements  suggested  to  An " o p t i m a l " machine  a l s o be designed a f t e r an a n a l y s i s of a c t u a l programs i n  languages  difficult  that  the  task with WISCH.  machine  is  to  support,  clearly  a  The P_  ASP  P. I n s t r u c t i o n r e p e r t o i r e  machine  Instruction repertoire  In  the"  instruction  i n s t r u c t i o n s are defined these  classes  definitions. are in  102  are  classand  basic  showing the  P-1.  One  labels,  that f o l l o w , c l a s s e s  of  The  to  they  "Program  names are  attached  not meant to  Relative  Address is  g i v e s a short hexadecimal  are d i f f e r e n t  Instructions".  a list  be  Instructions"  address i n s t r u c t i o n , but  "One  description  This l i s t  the  described.  For example, the  s t r u c t u r e from the class  and  simply  r e a l l y a form of one  each  descriptions  Following  of the i n s t r u c t i o n s i n that  d e s c r i p t i o n of  the  value of the f i r s t  instruction  word of i t ( i e .  opcode).  address i n s t r u c t i o n s  These a l l have both one  and  two  word forms.  The  first  byte  of the i n s t r u c t i o n i s always; CCCC CCSG where  "CCCC CC"  (0 i s one current  i s the "opcode", "S"  word) and  "G"  or g l o b a l stack  selects frame  gives the i n s t r u c t i o n s i z e  addressing  (0 i s c u r r e n t ) .  relative  to  the  For the one  word  form, byte 2 i s : IXOO 0000 where " I " s e l e c t s i n d i r e c t addressing indexed offset is;  addressing  (0  is  (0 i s d i r e c t ) , "X"  non-indexed)  (a value from 0 to 63).  For  the two  and  "00  selects  0000" i s the  word form, byte  two  The  P. I n s t r u c t i o n r e p e r t o i r e  ASP machine IX—  where  LLLL  " I " and "X" are as above and "LLLL" s e l e c t s the r e l a t i v e  static  level  (0  "grandfather",  i s local,  etc.).  "LLLL" b i t s are ignored. is  103  the  offset  negative).  as  a  Indirection  If  1 the  is  the  "father",  "G"  b i t of byte  The second word i n the two 16  b i t signed  i s single  2  the  1 i s s e t the word  form  i n t e g e r { i e . i t can be  level  and  occurs  before  indexing. 0000 1000 2000 3000 4000 5000 6000 7000 8000 900 0 A000 B000 C000 D000 E0O0 PQQ0 0400 1400 2400 3400 4400 5400 6400 7400 8400 9400 A4Q0 B400 C400 D400 E400 F400 0800 180 0 2800 3800 4800  l o a d 2 bytes to top of the workspace II II II 4 ii ti ii II II n 6 it it ti ti ii ti ii II it 8 ti the upper byte o f a word (as a value from 0 to 255) ii it lower " " " " " " " " " " index r e g i s t e r e f f e c t i v e address t o top of the workspace bytes from the top of the workspace (pop work) store  ii it  it it it  II  ti  ti it n  II  it  it ii ti ii  II  ii  ii  II  II  to the upper byte of a word ti II II lower " " " " ii the index r e g i s t e r n a word i n the stack zero it IJ increment " ti - II II ii i t i t decrement " compare stack operand with zero (opnd r e l zero) compare index r e g i s t e r with stack operand i n t e g e r add s t a c k operand t o workspace top " s u b t r a c t s t a c k operand from workspace top " m u l t i p l y workspace top by stack operand " divide " " " " " " compare workspace top with stack operand b i t w i s e AND s t a c k operand to workspace top II  OE  "  "  "  "  "  r e a l add stack operand t o workspace top it s u b t r a c t stack operand from workspace t o p II m u l t i p l y workspace top by stack operand II divide " " " " " it compare workspace top with s t a c k operand save 2 bytes from workspace to stack (no pop)  n  H  II II  Q  n  6  it «i II  ti it  it ii  it it  II  II  It  to the upper byte of a word  n  II  it it ii it  P. I n s t r u c t i o n r e p e r t o i r e  The ASP machine 5800  "  "  "  lower  "  "  "  104  "  __2_ Immediate operand i n s t r u c t i o n s  These a l s o have one and two word forms.  The f i r s t  byte  is  always; CCCC 10Swhere "CCCC" i s the opcode and "S" g i v e s the i n s t r u c t i o n s i z e as before. the  For the 1 word form the lower 9 b i t s of  operand,  t r e a t e d as a 9 b i t s i g n e d i n t e g e r  the  word  are  (-256 t o +255).  For  the two word form the second word c o n t a i n s the value as a 1 6  bit  signed i n t e g e r while the lower 9 b i t s of the f i r s t word are  ignored. 6800 7800 8800 9800 A800 8800 C800  l o a d immediate t G t o p of workspace " " " index r e g i s t e r add " " " " " " " top of workspace m u l t i p l y top of workspace by immediate divide " " » " " b i t w i s e AND immediate t o top of workspace  E8Q0 F800  compare index r e g i s t e r with immediate compare top of workspace with immediate  D800  "  OE  "  "  " "  "  The  ASP machine  P. I n s t r u c t i o n r e p e r t o i r e  105  P.3. Jump i n s t r u c t i o n s  The first  jump  instructions  a l l use addressing  word past the jump i t s e l f -  word forms.  They have  both  relative one  to the  and  two  The f i r s t byte i s always:  SXXX 110where  "XXX" i s the opcode and "S" i s the i n s t r u c t i o n s i z e .  For  the one word form the lower 9 b i t s a r e t r e a t e d as a 9 b i t signed integer of  (-256 t o +255).  For t h e two word form the lower 9 b i t s  t h e f i r s t word a r e ignored; the second word c o n t a i n s t h e jump  o f f s e t as a 16 b i t signed i n t e g e r . o f f s e t of -1 i s an i n f i n i t e  l o o p , while f o r a two word  o f f s e t of -2 g i v e s an i n f i n i t e 0C00 1C00 2C00 3C00 4C0 0 5C00 6C00  jump " " " « " "  7C00  »  The  then  to  referenced  the  loop.  further  explanation.  It  The  adds  top of the workspace (which i s then T h i s value a t  the  i s then added i n t o g i v e the f i n a l  higher l e v e l  table.  an  v i a FOBK t a b l e  to the program counter.  table.  jump  unconditionally on equal " greater " greater or equal " less " l e s s o r equal " not equal ( l e s s or greater)  FOBK jump needs  offset  Thus, f o r a one word jump an  of  jump  popped) and  location  thus  jump address.  terms, t h e jump o f f s e t i s the o f f s e t top  the  to  a  In  branch  the workspace c o n t a i n s an index i n t o  this  The t a b l e e n t r i e s a r e o f f s e t s from themselves t o a f i n a l  destination.  \  The ASP machine  P. I n s t r u c t i o n r e p e r t o i r e  P. 4. Prog rani r e l a t i v e  These  instructions  instructions  use  addressing  r e l a t i v e to the e n t r y  point of a r o u t i n e i n s t e a d of r e l a t i v e to a stack frame. primary  word forms. SCCC  where  Their  i n t e n t i s t o provide a simple access mechanism t o l a r g e  constants s t o r e d i n the program area. two  106  The f i r s t  They have  both  one  and  byte i s always;  1110  "CCC"  is  the opcode and "S" g i v e s the i n s t r u c t i o n  The r e s t of the i n s t r u c t i o n i s  identical  to  the  one  size.  address  instructions. 0E0 0 1E0 0 2E00 3E00 4E00 5E00 6E0 0 7E00  P.5,  load '» " real " " " "  2 bytes from the program area 6 " " " " " the e f f e c t i v e address add program operand to top of workspace s u b t r a c t program operand from top of workspace m u l t i p l y t c p of workspace by program operand divide " " " " " " compare " » " to " "  Memory block i n s t r u c t i o n s  These are i n s t r u c t i o n s which d e a l with contiguous of  memory.  Except f o r the workspace p o i n t e r increment, they a l l  r e g u i r e two of  them  "chunks"  a b s o l u t e addresses on the top of the workspace.  have  both  one and  two word forms.  The f i r s t  All  byte i s  always: CCCS where "CCC"  1111 i s the opcode and "S" i s the i n s t r u c t i o n s i z e .  For  The ASP machine the.  one  word  P. I n s t r u c t i o n r e p e r t o i r e case,  the  second  words as a value from 0 t o 255. bottom b i t o f the f i r s t  byte i s the operand l e n g t h i n For  the  two  word  the  the  If i t i s  l e n g t h as  a  signed  O b v i o u s l y , n e g a t i v e values a r e nonsense f o r a l l  but the workspace p o i n t e r increment i n s t r u c t i o n . set,  case  word s e l e c t s a "dynamic" mode.  c l e a r , the second word c o n t a i n s the operand 16 b i t i n t e g e r .  107  second  l e n g t h i s taken  word from  of the  If  bit 0 is  t h e i n s t r u c t i o n i s omitted and the top o f  the  workspace  (above  the  addresses). 0F00 2F0 0 4FO0 6F00  increment the workspace p o i n t e r r e g i s t e r by the operand l e n g t h ; no addresses a r e used compare words as i n t e g e r s ; the top address i s the r i g h t comparand, t h e bottom address i s the l e f t one; t h e comparison s t o p s a t the f i r s t p a i r of d i f f e r i n g words move a block o f words; the top address i s the " t o " address and the bottom i s the "from" address; the move goes from low address t o high address swap two blocks of words; the swap goes from low address to high address  P.6. Zero address l o a d , s t o r e & save  These i n s t r u c t i o n s are zero address analogues address long. for  instructions  described  above.  of  the one  They a r e a l l one word  The bottom two b i t s of the word are " I " and "X" the  one  address  instructions  bits  as  ( b i t 1 i s " I " and b i t 0 i s  "X"). 8F00 8F10 8F20 8F30 8F4 0 8F50  l o a d 2 bytes to t o p o f the workspace II  n  ii II  ii it  ii it  II II  ii ii  ii it  it  ii  it  ii  it  it  ii  5  ti  3  "  the upper  ti  it  i n w r  byte o f a word »  "  «  (as a value from 0 to 255) 1 1  "  •«  «  n  «  11  The  P. I n s t r u c t i o n r e p e r t o i r e  ASP machine  8 F 6  0  8 P 7  0  s t o r e 2 bytes from the top of the workspace (pop work) •t H 11 II H it it ti it II ii » it II II g it ti it ti II ti it t i II •• g n ti ti ti it it i i t i II to the upper byte of a word ti ii it " » lower " " " " save 2 bytes from workspace to stack (no pop)  8 F 8 G 8 F 9 0 8 F A 0 8 F B 0 8 F C 0 8 F D 0  «i  4  ii  it  n  it  it  it  n  8 F E 0  ii  £  11  11  It  11  11  ii  8 F F 0  II  II II  g it ii ti II it to t h e upper byte o f a word " " lower " •'• " " e f f e c t i v e address to t o p of the  9 F 0 0  it  9 F 1 0  it  9 F 2 0  ti  P.7.  ti  workspace  Machine r e g i s t e r access  This group o f i n s t r u c t i o n s allows loaded  from or s t o r e d  keep the  terminology  descriptions,  note  to  be  to any o f the e i g h t machine r e g i s t e r s .  To  consistent that  the  the workspace t o p  with  word  the  other  instruction  " l o a d " means to t r a n s f e r a  value from a r e g i s t e r to the top of the workspace and s t o r e means t o t r a n s f e r a value a register.  Except f o r the  i n s t r u c t i o n s are provided are not intended 9F3 0 9F31 9F32 9F33 9F34 9F35 9F36 9F37 9F38 9F39 9F3A 9F3B 9F3C  108  the  from the top of the workspace to  index  register  transfers,  f o r t e s t and debugging purposes.  f o r general  word  use.  A l l a r e one word  s t o r e to the s t a t u s r e g i s t e r ii it it program counter ti II II stack iaase p o i n t e r tt tt ti stack frame p o i n t e r n ii it workspace top p o i n t e r it it it stack l i m i t p o i n t e r n it it index r e g i s t e r it 41 ti current i n s t r u c t i o n r e g i s t e r l o a d from the s t a t u s r e g i s t e r tt ti •i program counter it ti it stack base p o i n t e r it tt it stack frame p o i n t e r ti ii n workspace p o i n t e r  long.  these They  The  ASP  P. I n s t r u c t i o n  machine  .9*3 D  II II  II  it  it  ii  9P.3F  ti  11  II  9F3E  P.8-  Shif t  s t a c k l i m i t pointer inde x r e g i s t e r c u r r ent i n s t r u c t i o n r e g i s t e r  instructions  These  three  insructions  have the s h i f t count and The  b i t s have the s h i f t  9F40 9F60 9F80  0 i s l e f t and  word  operands.  instructions above  the  The  9FA4  9FA5 9Fa6  bottom  15.  zero-fill)  the  the  zero  They are  presented here have value  to  a l l one the  be s h i f t e d .  address  of  the  count i s l a r g e r  operations  word l o n g .  count  on  the  integer " " " " 11  "  The  for shift  workspace  a p o s i t i v e count i n d i c a t e s  than 16  I f the  addition subtraction multiplication division modulus (see the HISCH report f o r remainder ( d i f f e r e n c e between these absolute value  the) two)  a  absolute  i t i s assumed that  meant. 9FA0 9FA1 9Fa2 9FA3  and  instruction.  1 i s right.  l e f t s h i f t , a negative count i s a r i g h t s h i f t . value  workspace top  operations  These i n s t r u c t i o n s are single  the  count as a value from 0 t o  logical shift (end-off, arithmetic s h i f t rotation  P-.9 __ l o r d  operate on  d i r e c t i o n encoded i n  direction i s in bit 4,  four  109  repertoire  16  is  P. I n s t r u c t i o n r e p e r t o i r e  The ASP machine 9FA7 9FA8 9FA9 9 3? A A 9FAB 9FA 9FAD 9FAE 9FAF 9FB0  110  " negation " comparison (pop both operands) " comparison (pop only the l e f t operand) b i t w i s e AND " i n c l u s i v e OR " e x c l u s i v e OR " complement " logical shift arithmetic shift »' rotation 11  P.10- Real o p e r a t i o n s  Although allocated values. 9FC0 9FC 9FC 9FC 9FC 9FC 9FC 9FC 9FC  t h e i r format i s undefined,  for  zero  address  opcodes  instructions  to  a  have  been  operate on r e a l  They are a l l one word l o n g .  r e a l addition " subtraction " multiplication " division " a b s o l u t e value " negation " compare " convert i n t e g e r to r e a l " " r e a l to i n t e g e r  _____  instructions  There are many other miscellaneous i n s t r u c t i o n s i n the machine  repertoire.  They are c o l l e c t e d  ASP  together here and given  i n d i v i d u a l d e s c r i p t i o n s below. 9FF0  array s u b s c r i p t i n g T h i s i n s t r u c t i o n i s one word l o n g .  The bottom  four  bits  The  &SP  machine  are  P. I n s t r u c t i o n r e p e r t o i r e  "CDDD",  where "C"  i s a checking  b i t and  number o f dimensions i n the a r r a y l e s s one. bit  is  clear.  workspace  must  block c o n t a i n s  The  array.  2n+1  words.  The  The  first  the  element.  The  array  n  descriptor  word i n the  is  the  of  the This  are  the  pair.  the  The  last  next n elements of the workspace must be The  the  bottom argument The i n s t r u c t i o n ,  address of the s e l e c t e d element on the top  of  workspace.  normal r o u t i n e  call  T h i s i n s t r u c t i o n i s two the  first  words l o n g .  The  bottom f o u r  is  a  bits  word give the r e l a t i v e s t a t i c l e v e l of  c a l l e d r o u t i n e , 0 i s a son of the c a l l e r , 15  the  s i z e of a s i n g l e a r r a y  i n d i c e s , with the n*th on top.  leaves  of  top  pairs  i s the address of the s t a r t of the array-  &F00  it  bound and range (upper-lower*1) f o r each dimension.  in  the  "C"  arguments on  be a p o i n t e r to a d e s c r i p t o r block.  lower bound i s the f i r s t  word  the  at a l l i s done i f  T h i s i n s t r u c t i o n r e g u i r e s n+2  workspace f o r an n dimensional  lower  If  i s the  s e t each index i s checked to make sure t h a t i t i s  w i t h i n i t s proper range, no checking is  "DDD"  111  "global" level routine.  The  1 is a  the  brother,  second word of  the  i n s t r u c t i o n i s the absolute  address of the r o u t i n e  This  t h a t a l l parameters ( i n c l u d i n g  instruction  assumes  the 6 word l i n k a g e area) are on the  workspace-  entry.  It  uses  the  word a t o f f s e t 0 of the r o u t i n e prologue to decide  how  far  the s t a r t of the new  the  current  top  of  stack frame should  the workspace.  The  be  below  workspace p o i n t e r i s  The ASP machine  P. I n s t r u c t i o n r e p e r t o i r e  then incremented by the s i z e of the v a r i a b l e check  area  112 and  a  i s made to make sure t h a t there i s enough workspace  f o r the r o u t i n e . AP10  routine return T h i s i n s t r u c t i o n i s one word l o n g . r e t u r n from the c u r r e n t  AF20  dynamic r o u t i n e This  defined on  simply  causes  a  routine.  call  instruction  c o n t a i n the  It  i s one word l o n g .  relative  above.  level  The e n t r y  the top of the  of  I t s bottom f o u r b i t s  the c a l l e d  routine  as  point of t h e c a l l e d r o u t i n e i s  workspace  instead  of  inline  i n the  program space. AF30  d u p l i c a t e top of workspace This the  one word i n s t r u c t i o n d u p l i c a t e s values workspace.  I t s bottom two b i t s c o n t a i n  on the top o f the number  of  words to d u p l i c a t e l e s s one. AF80  range check T h i s i n s t r u c t i o n checks that the top word of the workspace (treated as a signed causing  a  fatal  "SS"  word forms. selects  instruction,  the  i s within a s p e c i f i e d  error i f i t i s n ' t .  value being cheked. three  integer)  The  instruction  I t does not pop t h e has  one,  two and  I t s bottom f o u r b i t s are "xxCC", where size.  Opcode  AF8Q  t h e second word c o n t a i n i n g  Both bounds must be between 0 and 255. the  range,  is a  two  word  the range bounds. The upper byte  of  second word i s the upper bound, the lower byte i s the  lower bound.  Opcode AF81 i s a  three  word  instruction.  The ASP machine The  P. I n s t r u c t i o n  second  word  Both bounds are t r e a t e d  Opcode  AF83  is  workspace.  113  i s the lower bound and the' t h i r d i s the  upper.  the  repertoire  as 16 b i t signed  integers.  a one word i n s t r u c t i o n , the bound a r e on  The t o p value i s the upper bound, the next  i s the lower. AF4Q  f u l l e x i t from ASP This  one  word  workspace. area  the ASP i n t e r n a l r e g i s t e r s .  to an  8  word  save  The next must be a P,  S,  F i r s t the ASP r e g i s t e r s PC, PS, SB, SF, HP, SL,  and CI are s t o r e d  i n the ASP save a r e a .  Next  the  HP  r e g i s t e r s are loaded from t h e i r save area.  F i n a l l y t h e HP  A r e g i s t e r i s loaded with the  the  a r e a , the B with the HP p o i n t e r the AF50  two arguments on the  to a 4 word save area f o r the HP r e g i s t e r s  X, and YIR  requires  The top must be a p o i n t e r  for  pointer  instruction  pointer  to  and c o n t r o l  ASP  save  i s r e t u r n e d to  HP i n s t r u c t i o n s e t .  i n l i n e e x i t from ASP T h i s i n s t r u c t i o n i s one word l o n g . instructions  to  puts  and  be i n t e r m i n g l e d i n a s i n g l e r o u t i n e .  pushes the ASP r e g i s t e r s top),  I t a l l o w s ASP  HP It  SL and IR on the workspace (IR on  the ASP PS i n t o the HP A, the ASP WP i n t o t h e  HP B ( a c t u a l l y B p o i n t s t o SL, i e . i t i s WP-1), the ASB SB into  the  HP  Y  and  the  ASP SF i n t o the HP X.  I t then  simply e x i t s to the HP i n s t r u c t i o n i n t e r p r e t e r so t h a t  i t  w i l l begin e x e c u t i o n of the next i n s t r u c t i o n i n seguence. , AF6 0  s u i c i d e e x i t from ASP The  one  word  s u i c i d e i n s t r u c t i o n i s intended to be used  The ASP machine  repertoire  114  f o r debugging and t o programably cause f a t a l e r r o r s -  Its  bottom  four  register AF70  P. I n s t r u c t i o n  interrupt  b i t s are p l a c e d i n the "EEEE" b i t s of the PS  and an e r r o r e x i t from ASP i s made. e x i t from ASP  T h i s i s a one word i n s t r u c t i o n , of  the  interface  ASP-HP i n t e r r u p t i s described  implementation of ASP.  provided to allow  interface. below  in  The f u n c t i o n the  section  testing of t h i s on  the  The  ASP  machine  Q. Implementation of ASP  Q. Implementation of  As  ASP  mentioned  implemented E-series  as  previously,  a  115  microprogram  computer.  the for  I t allows ASP  ASP a  machine  has  been  Hewlett-Packard  programs to be  21MX  run under the  BTE-2 o p e r a t i n g system.  To s t a r t an ASP HP*s  WCS  up and and and  r e g i s t e r s must be given i n i t i a l v a l u e s .  3 are l e f t  described normal  alone.  interface below.  routine  overflow. the  SL  Word  4  routine.  points The  Word  SL,  it  is  used  register  8  IB,  alone.  and  CI.  a 4 word HP save area.  of  the HP  registers  P,  of  The  word  checking  5  of  for  value of  Word 7 i s a b i t mask f o r B i t i masks out e r r o r code  HP  r e g i s t e r s PC,  PS,  SB,  X  SF,  A r e g i s t e r i s loaded with the B r e g i s t e r with the  address  and  Y  when  ASP  is  values  started.  of the HP i n s t r u c t i o n with o c t a l code 101611 w i l l  cause the ASP  a  stack  T h i s HP save area w i l l get the S,  an  An 8 word save area must be s e t up  values f o r the ASP  of  will  for  should be the same.  i s left  Words 2  start  Word 6 i s a l s o s e l f e x p l a n a t o r y , the i n i t i a l  address o f t h i s save area and the HP  Execution  the  Word 5 l a s the same purpose as frame;  with the i n i t i a l WP,  to  0  s t r u c t u r e of t h i s r o u t i n e i s  f a t a l e r r o r s t h a t are to be i g n o r e d . i.  Words  o f the g l o b a l stack frame are s e l f e x p l a n a t o r y .  interrupt  the  memory, the base of t h e g l o b a l stack frame must be s e t  the ASP  1  program the machine must be loaded i n t o  machine to be s t a r t e d .  The  be s t o r e d i n g l o b a l l o c a t i o n s 2 and  save  area  then  pointers  3 automatically.  If a  The  ASP machine  f a t a l error  Q. Implementation of ASP  i s deteced  using these save  Since  116  by ASP, a f u l l e x i t i s done a u t o m a t i c a l l y  areas.  ASP  has  no  I/O i n s t r u c t i o n s  i t i s necessary  a b l e to e x i t t o the HP i n s t r u c t i o n s e t t o perform I/O to r e - e n t e r ASP.  C o n t r o l must a l s o be a u t o m a t i c a l l y  and  then  surrendered  to the HP i n s t r u c t i o n s e t whenever  an  The  by the i n l i n e e x i t and e n t r y  former  c a p a b i l i t y i s provided  instructions.  The  schizophrenic  and  ASP  inline  interrupt  t o be  exit  i s d e s c r i b e d above.  lets  is  routines  be  The HP i n s t r u c t i o n  with  o c t a l code 101612 accomplishes the i n v e r s e o p e r a t i o n . interrupt  request  i s detected  while  detected.  ASP i s running,  When  a special  quick e x i t i s made to the HP i n s t r u c t i o n s e t t o allow i t handled.  The  PS,  SL  and  IB  registers  to  (IB on top)', the PC i s put i n t o the HP A r e g i s t e r  UP  the  ie.  i t i s SP-2).  same alone. entry  HP B r e g i s t e r  hardware  Typically,  The ASP SF and SB r e g i s t e r s happen t o be the  registers  instructions an i n t e r r u p t  and the  and  (B a c t u a l l y p o i n t s t o the PS value,  as  the  The HP P r e g i s t e r i s then point  be  a r e pushed onto t h e  workspace into  an  control  interface  HP X and Y, so they a r e l e f t loaded  with  the  interrupt  i s given t o the HP i n s t r u c t i o n s e t . routine  i s just  (to allow the i n t e r r u p t  a  few  HP  NOP  t o be caught) f o l l o w e d by  r e t u r n t o ASP, HP i n s t r u c t i o n  101613.  The li  ASP  B. Future  machine  Future  Like  work with  i s both  There are two  a  working  tool  and  a  ASP  that  research.  An e x c e l l e n t p r o j e c t would be to take the ASP and  research  main areas of f u t u r e work with  seem well s u i t e d t o M.Sc.  revise  117  ASP  WISCH, ASP  vehicle.  work with ASP  machine  p o l i s h i t i n t o a b e t t e r k e r n e l machine f o r a v a r i e t y  of languages, e s p e c i a l l y languages of l o c a l i n t e r e s t to UBC as  BCPL,  allow  in  C,  PASCAL and  inter-lingual  project  could  these  actually  ZED.  routine  Properly calls  languages used.  to  This  computer  p l a c e the belongs,  such  designed, i t c o u l d even  with  no  overhead.  This  b e n e f i t from the l a r g e body of e x i s t i n g programs analyze new  in  design  the  of  subservient  machine produced  would  language  could  features  fullest  sense.  are  a l s o be extended  memory management, making  computer to  what  machine  c o n t a i n i n s t r u c t i o n s f o r l / O and "real"  and  it  architecture  be  of  a  Such a p r o j e c t would where  it  really  the a c u t a l needs of programmers. likely  to  considerable  The  practical  value.  Another to study specific  how  project, to  which f i t s  best  instructions.  instructions maintainance,  for  string  message  provide For  w e l l with the f i r s t , would more  sophisticated,  WISCH  this  manipulation, passing  i n s t r u c t i o n s could be designed as  and  set  process  optional  be  language  might  include  operations,  heap  control.  These  extentions  to  the  The ASP machine k e r n e l machine mentioned above.  B. Future work with ASP  118  119  Bibliography  1- Atwood, J . ». , e t - a l - P r o j e c t SUE s t a t u s r e p o r t Technical r e p o r t CSRG-11, Computer Systems l e s e a r c h Group, University of Toronto ( A p r i l 1972). 2- Brinch Hansen, P. Structured Communications of the ACM, V o l . 15, 574-578.  No.  multiprogramming. 7 (July 1972),  pp.  3. B r i n c h Hansen, P. The programming language Concurrent Pascal. IEEE T r a n s a c t i o n s on Software E n g i n e e r i n g . V o l . 1, No. 2 (June 1975), pp. 199-207. 4. Brinch Hansen, P. Experience with modular concurrent programming. IEEE T r a n s a c t i o n s on Software E n g i n e e r i n g , V o l . SE-3, No. 2 (March 1977), pp. ,156-159. Corbato, F. J . PL/1 as a t o o l f o r system programming. Datamation, V o l . 15, No. 5 (May 1969) , pp. €8-76. 5. Hart ma nn, A. A Concurrent P a s c a l Compiler f o r Minicomputers. S p r i n g e r - V e r l a g , B e r l i n , (1977). 6. Hoare, C. A. R. Towards a theory of p a r a l l e l programming. Operating Systems Techniques, ed. C. A- R. Hoare and R. H. Perrot. Academic P r e s s , New York (1972). 7. Hoare, C. A. R. Monitors: An o p e r a t i n g system concept. Communications of the ACM, V o l . 17, No. 197 4), pp. 549-557.  structuring 10 (October  8. Hoare, C. A. R. P a r a l l e l Programming: An axiomatic approach. Computer Languages, V c l . 1 (1975) , pp. , 151-160. 9. Jensen, K. and W i r t h , N. PASCAL S p r i n g e r - V e r l a g , B e r l i n (1974).  User  Manual and Report.  10. Kahn, K. A s m a l l - s c a l l operating system f o u n d a t i o n f o r microprocessor applications. Proceedings of the IEEE, V o l . 6€>, No. 2 (February 1978), pp. 209-215.~ 11. Lampson, B. W., e t . a l . Report on the programming language EUCLID. S i g p l a n N o t i c e s , V o l . 12, No. 2 (February 1977). 12. L i s k o v , B. The design of the Venus o p e r a t i n g system. Communications of the ACM, V o l . 15, No. 3 (March 1972), pp. 144-149. 13. Ran d e l l , B., ed. Springer-Verlag, Berlin  The Origins (1973).  of  Digital  Computers.  14. R i c h a r d , F. and Ledgard, H. F. A reminder f o r language designers. Sigplan Notices, V o l - 12, No. 12 (December 1977), pp. 73-82.  B i b l i o g r a phy  120  15- S i l b e r s c h a t z , A., et- a l . Extending Concurrent P a s c a l to allow dynamic resource management. IEEE T r a n s a c t i o n s on Software E n g i n e e r i n g , V o l . SE-3, No. 3 (May 1.977), pp. 210-217. 16. Sorensen, S. M. and Stanstrup, J . PLATON r e f e r e n c e manual. Report R-75-58, Regional EDP Center, U n i v e r s i t y o f Aarhus ( J u l y 1975) . 17. Sorensen, S. M. and S t a n s t r u p , J . PLATON - Design and implementation on RC 3500. Report RECAU-77-80-R, Regional EDP Center, U n i v e r s i t y o f Aarhus (May 1977). 18- S t a n s t r u p , J . , and Sorensen, S. M. PLATON - A high level language f o r systems programming. Report R-75-59, l e g i o n a l EDP Center, U n i v e r s i t y o f Aariius (May 1975). 19. Stoy, J . E. and Strachey, C. OS6 An experimental operating system f o r a s m a l l computerPart 1; General p r i n c i p l e s and s t r u c t u r e . Computer J o u r n a l , V o l - 15, No.2 ( A p r i l 1972), pp. 117-124. 20. Tannenbaum, A. I m p l i c a t i o n s of s t r u c t u r e d programming ;for machine a r c h i t e c t u r e . Communications o f the ACM, V o l . 21, No. 3 (March 1978), pp. 2 37-24621- H h i t a k e r , fl. A. The U- S. Department of Defense common high order language effort. S i g p l a n N o t i c e s , V o l . 13, No. 2 (February 1978) , pp. 19-29. 22. Wirth, N. MODULA: A language f o r modular multiprogramming. E i d g e n o s s i s c h e Technische Hochschule, Z u r i c h (March 1976). 23. Wirth, N. The use o f MODULA and Design and implementation of MODULA. E i d g e n o s s i s c h e Technische Hochschule, Z u r i c h ( J u l y 1976) . 24. Yasumura, M. Evolution of loop statements. N o t i c e s , V o l . 12, No. 9 (September 1977), pp. 124-129.  Sigplan  Appendix 1. The  Why WISCH with a C?  word  WISCH  comes  from  121 the name Wlhelm SCHickard, a  German astromomer who b u i l t a c a l c u l a t i n g machine i n the 162G*s.  Unfortunately  the  l o n g a f t e r i t was f i n i s h e d and  no  copies  machine  Kepler  in  was destroyed by f i r e not  S c h i c k a r d died  during  of h i s machine were ever made.  e x i s t e n c e comes from a d e s c r i p t i o n  early  the  Plague  Evidence  of i t s  and drawings sent t o Johannes  1624 (at which time B l a i s e P a s c a l was one year o l d ) .  

Cite

Citation Scheme:

        

Citations by CSL (citeproc-js)

Usage Statistics

Share

Embed

Customize your widget with the following options, then copy and paste the code below into the HTML of your page to embed this item in your website.
                        
                            <div id="ubcOpenCollectionsWidgetDisplay">
                            <script id="ubcOpenCollectionsWidget"
                            src="{[{embed.src}]}"
                            data-item="{[{embed.item}]}"
                            data-collection="{[{embed.collection}]}"
                            data-metadata="{[{embed.showMetadata}]}"
                            data-width="{[{embed.width}]}"
                            async >
                            </script>
                            </div>
                        
                    
IIIF logo Our image viewer uses the IIIF 2.0 standard. To load this item in other compatible viewers, use this url:
http://iiif.library.ubc.ca/presentation/dsp.831.1-0051808/manifest

Comment

Related Items