Cool (programming language)

Cool (programming language)
COOL
Paradigm(s) object oriented
Appeared in 1996
Designed by Alexander Aiken
Developer Alexander Aiken
Typing discipline static, strong
Dialects Cool 2004, Cool 2005, Cool 2006, Cool 2007, Cool 2008, unCool
Influenced by Sather164, Java, ML, Pascal

Cool, an acronym for Classroom Object Oriented Language, is a computer programming language designed by Alexander Aiken for use in an undergraduate compiler course project. While small enough for a one term project, Cool still has many of the features of modern programming languages, including objects, automatic memory management, strong static typing and simple reflection.

The reference Cool compiler is written in C++, built fully on public domain tools. It generates code for a MIPS simulator, SPIM. Thus, the language should port easily to other platforms. It has been used for teaching compilers at many institutions (such as the University of California at Berkeley, where it was first used) and the software is stable.

Other lecturers such as John Tang Boyland (author of the Sather164 language, precursor of Cool) and Allan Jost have developed some dialects of Cool to be used in their own classes.

This language is unrelated to the COOL language included in CLIPS.

Features

As the primary purpose of Cool is instruction, it lacks many of the features common to other, more general programming languages. For instance, the language supports less than comparisons but not greater than. The syntax is very much stripped down, and the "standard library" contains only a few basic classes. Separate compilation is not supported, though the compiler does support multiple source files as input. Every Cool program must define a class Main which must have a no-args constructor in which execution flow begins. Namespaces are not supported.

A simple Cool program for computing factorial follows:

class Main : IO is
  Main() begin
    out_string("Enter an integer greater-than or equal-to 0: ");

    let input: Integer := in_int(); in
      if input < 0 then
        out_string("ERROR: Number must be greater-than or equal-to 0\n")
      else
        out_string("The factorial of ").out_int(input);
        out_string(" is ").out_int(factorial(input))
      fi
    end
  end;

  factorial(num: Integer): Integer := if num = 0 then 1 else num + factorial(num - 1) fi;
end;

The syntax used in this sample comes out of Cool 2008, a dialect of Cool developed by John Tang Boyland. Other dialects of Cool may have markedly different syntax.

References

External links


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • Racket (programming language) — Racket Paradigm(s) Multi paradigm: Functional, Procedural, Modular, Object oriented, Reflective, Meta Appeared in 1994 Developer …   Wikipedia

  • Fortress (programming language) — infobox programming language name = Fortress paradigm = year = designer = developer = Sun Microsystems latest release version = 1.0 latest release date = April 2008 latest test version = latest test date = typing = implementations = dialects =… …   Wikipedia

  • C Sharp (programming language) — The correct title of this article is C# (programming language). The substitution or omission of the # sign is because of technical restrictions. C# Paradigm(s) multi paradigm: structured, imperative …   Wikipedia

  • Object-oriented programming language — An object oriented programming language (also called an OO language ) is one that allows or encourages, to some degree, object oriented programming techniques such as encapsulation, inheritance, modularity, and polymorphism. Simula (1967) is… …   Wikipedia

  • Text Executive Programming Language — In 1979, Honeywell Information Systems announced a new programming language for their time sharing service named TEX, an acronym for the Text Executive processor. TEX was a first generation scripting language, developed around the time of AWK and …   Wikipedia

  • Cool — refers to a moderately low temperature. Alternatively, cool or COOL may refer to: Cool (aesthetic), an aesthetic of attitude, behavior, and style Cool (African aesthetic), an aesthetic standard in artistic expression and physical appearance Cool… …   Wikipedia

  • language — /lang gwij/, n. 1. a body of words and the systems for their use common to a people who are of the same community or nation, the same geographical area, or the same cultural tradition: the two languages of Belgium; a Bantu language; the French… …   Universalium

  • Cool Money — Directed by Gary Burns Produced by Aaron Barnett Written by Marvin J. Wolf (story) Shelley Evans (teleplay) Starring James Marsters …   Wikipedia

  • Cool Dimension: Innocent Assassin — Directed by Yoshikazu Ishii Starring Yoko Mitsuya …   Wikipedia

  • List of programming languages — Programming language lists Alphabetical Categorical Chronological Generational The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and historical ones, in… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”