COMAL

From Wikipedia, the free encyclopedia
(Redirected from COMAL programming language)
COMAL
ParadigmStructured
Designed byBørge R. Christensen, Benedict Løfstedt
First appeared1975
Typing disciplineStrong
Influenced by
BASIC, Pascal

COMAL (Common Algorithmic Language) is a computer programming language developed in Denmark by Børge R. Christensen and Benedict Løfstedt and originally released in 1975. It was based on the BASIC programming language, adding multi-line statements and well-defined subroutines among other additions.

COMAL was originally written for minicomputers, but was small enough to run on early microcomputers as well. It is one of the few structured programming languages that were available for and comfortably usable on 8-bit home computers.

"COMAL Kernel Syntax & Semantics" contains the formal definition of the language.[1] Further extensions are common to many implementations.[2][3][4]

History[edit]

Minicomputer versions[edit]

COMAL was originally developed in Denmark by mathematics teacher Børge R. Christensen. The school in which he taught had received a Data General Nova 1200 minicomputer in 1972, with the expectation that the school would begin to teach computer science. Christensen, who had taken a short course on the subject at university, was expected to lead the program and to maintain the computer system.[5]

The NOVA was supplied with Data General Extended BASIC, and Christensen quickly became frustrated with the way in which the unstructured language led students to write low-quality code that was difficult to read and thus mark.[5] While complaining about these problems to computer scientist Benedict Løfstedt, Løfstedt encouraged Christensen to read Systematic Programming, the then-new book on programming language design by Niklaus Wirth, the creator of Pascal. Christensen was impressed, but found that he could not use Pascal directly, as it lacked the interactive shell that made BASIC so easy for students to develop with.[6]

Over the next six months Christensen and Løfstedt corresponded by mail to design an alternative to BASIC which retained its interactive elements but added structured elements from Pascal.[6] By 1974, the language's definition was complete but Christensen was unsuccessful in attracting interest from software firms in developing an implementation. Over the next six months he worked with two of his students, to whom he had taught NOVA 1200 machine language, to write an implementation themselves. One of the first things added was the ability to use eight-character variable names, up from the typical one or two.[6] Later additions in the first version included multi-line IF...THEN...ELSE...ENDIF statements, and the PROC...ENDPROC definitions and the EXECUTE statement to call them.[7]

The first proof-of-concept implementation (running a five-line loop) was ready on 5 August 1974, and the first release (on paper tape) was ready in February 1975. Development costs had been around US$300. Only now did the system (which had previously used an internal Danish name) pick up the name COMAL, for Common Algorithmic Language, inspired by ALGOL, with which Christensen had been experimenting.[7] The first release was therefore named COMAL 75. Christensen subsequently wrote a textbook on the language which evolved into Beginning COMAL.[8]

Microcomputer versions[edit]

In 1978, Christensen began to adapt COMAL such that it would run on microcomputers, which were becoming available. He was worried that without such an implementation he would be required to teach and use BASIC again as Danish schools acquired the new machines. By 1980, a version of COMAL developed in conjunction with a college group was able to run on the Zilog Z80, and thus COMAL 80 was released.[7]

Around the same time, a Danish firm introduced the Comet, a very capable microcomputer for the time, which would be the first machine to run a version of what would look like the later COMAL releases. Christensen subsequently stepped back from COMAL development around 1980-81, which was handed over to groups including UniComal,[9] started by Mogens Kjaer, who had written to Christensen with critiques of COMAL and subsequently ported it to the Commodore PET for release 0.14. At this time, Danish schools insisted that COMAL be available on any microcomputer they purchased.[8]

In the early 1980s, Apple Computer won a contract to supply Apple II computers running CP/M and COMAL to Irish secondary schools.[10] It was popular for education[11] and some textbooks were locally written.[12][13]

In 1984, Acornsoft released a COMAL implementation, by David Christensen, Jim Warwick and David Evers, for their 8-bit BBC Micro and Acorn Electron computers (with a manual by Paul Christensen and Roy Thornton[14])

Between 1984-1987, TeleNova, a subsidiary of the industrial arm of the Swedish Telecoms system, manufactured a desktop PC called "Compis" for the educational sector. An enhanced version of COMAL was supplied as the standard programming language for this PC. Versions were created for both CP/M-86 and MS-DOS. The latter version is available for Windows XP. The (Swedish) reference manual is ISBN 91-24-40022-X.

In 1990, Thomas Lundy and Rory O'Sullivan produced the definitive text on COMAL Programming.[13] They matched and compared COMAL with BBC Structured Basic.

As of 2016, COMAL is still actively in use as an educational programming language. Some high schools in the United Kingdom continue to use it to teach the subject of computing.[15]

Description[edit]

COMAL was created as a mixture of the prevalent educational programming languages of the time, BASIC, Pascal, and, at least in the Commodore and Compis versions, the turtle graphics of Logo. The language was meant to introduce structured programming elements in an environment where BASIC would normally be used.

In early versions, the primary additions to the language were block versions of IF...THEN, and the PROC construct. In most previous versions of BASIC, the only block construct was the FOR...NEXT loop. For instance:

10 FOR I=1 TO 10
20 PRINT I
30 J=J+1
40 NEXT I

This example performs a loop ten times, and performs two instructions every time through the loop. In contrast, almost every other instruction in BASIC, or statement, has to be accomplished on a single line. This can make multi-line statements difficult to perform on an all-or-nothing basis. For instance, if a program desires to run three instructions if a particular value is greater than 10, the typical solution is:

10 IF A<=10 THEN 50
20 PRINT "A IS GREATER THAN 10"
30 A=A+10
40 PRINT "A IS NOW ";A
50 PRINT "RETURNING TO OUR REGULARLY SCHEDULED PROGRAMMING"

This sort of construct hides the true intension of the program, the decision is based on the opposite logic of what the programmer actually wants to accomplish. Additionally, to understand what will happen in this case, the reader has to find line 50, which in real programs might be much further into the source code. This is one of the major reasons that BASIC programs are referred to as "spaghetti code", as to follow the logic one moves around the program as if following a series of random spaghetti noodles.

COMAL addresses this issue through the use of blocks. To accomplish this same series of instructions, in COMAL one would write:

10 IF A>10 THEN
20   PRINT "A IS GREATER THAN 10"
30   A=A+10
40   PRINT "A IS NOW ";A
50 ENDIF
60 PRINT "RETURNING TO OUR REGULARLY SCHEDULED PROGRAMMING"

In this case, the author writes the decision they are actually trying to accomplish, and the reader can follow the logic simply by looking for the ENDIF. This is aided by COMAL's use of leading spaces to visually indicate blocks.

Examples[edit]

  • "Hello, world!"
    PRINT "HELLO, WORLD!"
    
  • Conditions
    IF condition THEN
      instructions
    ENDIF
    
  • Loops
    FOR number:= 1 TO 1000 DO   
      PRINT number
    ENDFOR
    
  • Print statements with variables
    INPUT "What's your favourite number? " :nmr#
    PAGE
    PRINT "Your favourite number is " ; nmr#
    

Availability[edit]

COMAL was available for:

See also[edit]

References[edit]

  1. ^ Ryan, Kevin. "COMAL Kernel Syntax & Semantics" (PDF). Dansk Datahistorisk Forening. Retrieved 8 November 2017.
  2. ^ Bain, Richard; Lindsay, Len. "Common COMAL Definition and Tests". COMAL Today (24): 21–46. Retrieved 20 January 2020.
  3. ^ "Common COMAL -- Compatible keywords". COMAL Today (25): 28. Retrieved 20 January 2020.
  4. ^ "Common COMAL -- Keyword syntax and examples". COMAL Today (25): 29–33. Retrieved 20 January 2020.
  5. ^ a b Christensen 1985, p. 1.
  6. ^ a b c Christensen 1985, p. 2.
  7. ^ a b c Christensen 1985, p. 4.
  8. ^ a b Christensen, Børge (March 1985). "The Story of COMAL". COMAL Today (25): 1–10. Retrieved 4 September 2020.
  9. ^ a b "UniComal 3.11 IBM PC". Internet Archive. January 1992. Retrieved 1 April 2021.
  10. ^ Moynihan, Michael D. (8 August 1983). "COMAL coverage out of Ireland". InfoWorld. 5 (32): 30. Retrieved 15 November 2017.
  11. ^ Brady, Michael P. (May 1986). The Design of a First Course in Programming (thesis). Loughborough, Leicester, UK: Loughborough University of Technology. hdl:2134/10392. Retrieved 15 November 2017.
  12. ^ Kelly, John (1984). Foundations in Computer Studies with COMAL (Second ed.). Dublin, Ireland: The Educational Company. Retrieved 20 January 2020.
  13. ^ a b Lundy, Thomas; O'Sullivan, Rory (1990). Beginning structured programming in BASIC and COMAL. Dublin, Ireland: Gill and Macmillan. ISBN 978-0717116676.
  14. ^ Thornton, Roy; Christensen, Paul (1984). COMAL on the BBC Microcomputer and Acorn Electron SBD 19. Acornsoft. ISBN 978-0907876908.
  15. ^ Laine, Heather (12 February 2015). "Gracemount High School". LiveCode. Archived from the original on 29 March 2024. Retrieved 29 March 2024.

Further reading[edit]

External links[edit]