Turing (programming language)

Turing (programming language)

Turing is a Pascal-like programming language developed in 1982 by Ric Holt and James Cordy, then of University of Toronto, Canada. Turing is a descendant of Euclid, Pascal and SP/k that features a clean syntax and precise machine-independent semantics.

Named after British computer scientist Alan Turing, Turing is used primarily as a teaching language at the high school and university level. Two other versions exist, Object-Oriented Turing and Turing Plus, a systems programming variant. In September 2001, "Object Oriented Turing" was renamed "Turing" and the original Turing was renamed "Classic Turing". Turing is available from Holt Software Associates in Toronto. Versions for Microsoft Windows, Linux and Apple Macintosh are available. Turing is still widely used in high schools in Ontario as an introduction to programming.

In November 2007, Turing, which was previously a commercialized programming language, became freeware [ [http://compsci.ca/blog/download-turing-411/ Download Turing 4.1.1 ] ] . It is currently available for download from the Holt Software website free of charge for personal, commercial, and educational use.

Syntax

Turing is designed to have a very lightweight, readable, intuitive syntax. Here is the entire Hello World! program in Turing with syntax highlighting:

put "Hello World!"

Turing avoids semicolons and braces, using explicit end markers for most language constructs instead, and allows declarations anywhere. Here is a complete program defining and using the traditional recursive function to calculate a factorial.

% Accepts a number and calculates its factorial function factorial (n: int) : real if n = 0 then result 1 else result n * factorial (n - 1) end if end factorial var n : int loop put "Please input an integer :" .. get n exit when n >= 0 put "Input must be a non-negative integer." end loop put "The factorial of ", n, " is ", factorial (n)

Turing is particularly convenient for handling text strings - for example, here is a Turing program to conjugate regular French 'er' verbs.

% Program to conjugate regular French verbs loop put "Please give me a regular French 'er' verb" var infinitive : string get infinitive put "Thanks, here is the present conjugation" var root := infinitive (1 .. *-2) put "The root of this verb is '", root, "'" if infinitive (* -1 .. *) = "er" then if root (1) = "a" or root (1) = "e" or root (1) = "i" or root (1) = "o" or root (1) = "u" then put "J'" + root + "e" else put "Je " + root + "e" end if put "Tu " + root + "es" put "Il ou elle " + root + "e" if root (*) = "g" then put "Nous " + root + "eons" else put "Nous " + root + "ons" end if put "Vous " + root + "ez" put "Ils ou elles " + root + "ent" elsif infinitive (* -1 .. *) = "ir" then put "I'm too tired to do an 'ir' verb" else put "I don't like the looks of this verb" end if exit when infinitive = "arreter" end loop

This is an example of a simple game in Turing.

setscreen ("msdos") const WAIT := 125 const NUMBER_OF_ASTERISKS := 10 const LEFT_ARROW := chr (203) const RIGHT_ARROW := chr (205) const HOME := chr (199) const END := chr (207) const BLOCKER_ROW := 24 var Asterisk_Column, Start, Finish : int var Asterisk_Row := 2 const BLOCKER := chr (220) + chr (220) + chr (220) + chr (220) + chr (220) const BLANK_BLOCKER := " " var Key : string (1) var Key_Code : int var Blocker_Column := 38 var Blocker_Row := 24 setscreen ("noecho,nocursor") put "Move the blocker with the , , & keys." delay (5000) locate (Blocker_Row, Blocker_Column) put BLOCKER randomize clock (Start) for Asterisk : 1 .. NUMBER_OF_ASTERISKS locate (1, 1) put "Asterisk #", Asterisk Asterisk_Column := Rand.Int (2, 79) loop locate (Asterisk_Row, Asterisk_Column) put "*" .. delay (WAIT) if hasch then getch (Key) locate (Blocker_Row, Blocker_Column) put BLANK_BLOCKER if Key = RIGHT_ARROW then Blocker_Column += 2 elsif Key = LEFT_ARROW then Blocker_Column -= 2 elsif Key = HOME then Blocker_Column := 2 elsif Key = END then Blocker_Column := 75 end if if Blocker_Column > 75 then Blocker_Column := 75 elsif Blocker_Column < 2 then Blocker_Column := 2 end if locate (Blocker_Row, Blocker_Column) put BLOCKER end if locate (Asterisk_Row, Asterisk_Column) put " " Asterisk_Row += 1 if Asterisk_Row > 24 then Asterisk_Row := 2 end if if Asterisk_Column >= Blocker_Column and Asterisk_Column <= Blocker_Column + 4 and Asterisk_Row = 24 then sound (1000, 100) exit elsif Asterisk_Row = 24 and (Asterisk_Column < Blocker_Column or Asterisk_Column > Blocker_Column + 4) then sound (100, 100) end if end loop end for clock (Finish) cls put "TIME: ", (Finish - Start) / 1000, " Seconds."

Open Implementations

Currently, there are two open source alternative implementations of Turing, TPlus, a native compiler for the concurrent systems programming language variant Turing Plus, and OpenT, a new system currently under development. Open sourcing of the original complete Turing implementation from Holt Software is also currently underway.

TPlus

TPlus is an open-source implementation of original (non-OO) Turing with systems programming extensions developed at the University of Toronto and ported to Linux, Solaris and Mac OS X at Queen's University in the late 1990s. TPlus implements Turing+ (Turing Plus), a concurrent systems programming language based the original Turing programming language. Some, but not all, of the features of Turing Plus were eventually subsumed into the present Object-Oriented Turing language. Turing Plus extends original Turing with processes and monitors (as specified by C.A.R. Hoare) as well as language constructs needed for systems programming such as binary input-output, separate compilation, variables at absolute addresses, type converters and other features.

OpenT

OpenT is an open-source language, compiler, and IDE being developed by the members of the dTeam of Computer Science Canada. It shares many similarities with Turing, and is fully backwards compatible with it. OpenT was originally begun to avoid the proprietary nature of Turing, although the original complete Holt Software Turing implementation is currently being transferred to open source.

upport

There is a lack of support for Turing on the internet due to its narrow range of users (mostly Ontario high school students). There are, however, a few websites that offer support and tutorials.
* [http://www.compsci.ca/ Computer Science Canada] - This page features tutorials, games, programs, message boards and the option for visitors to post their turing related programs on the site.

References

* [http://doi.acm.org/10.1145/53580.53581 Richard C. Holt and James R. Cordy, "The Turing Programming Language", Communications of the ACM 31,12 (December 1988)]
* [http://portal.acm.org/citation.cfm?id=36662&dl=GUIDE&coll=GUIDE&CFID=290560&CFTOKEN=72766146# Richard C. Holt , Philip A. Matthews , J. Alan Rosselet , James R. Cordy, The Turing programming language: design and definition, Prentice-Hall, Inc., 1987]

ee also

*Euclid (programming language)
*Turing Plus (programming language)
*Object-Oriented Turing
* TXL

External links

* [http://www.compsci.ca/ Forum for Turing Help, Tutorials, & Source Code]


Wikimedia Foundation. 2010.

Игры ⚽ Нужен реферат?

Look at other dictionaries:

  • Turing Plus (programming language) — Turing+ (Turing Plus) is a concurrent systems programming language based the Turing programming language designed by James Cordy and Ric Holt, then at the University of Toronto, in 1987. Some, but not all, of the features of Turing Plus were… …   Wikipedia

  • Programming language — lists Alphabetical Categorical Chronological Generational A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that… …   Wikipedia

  • Programming language theory — (commonly known as PLT) is a branch of computer science that deals with the design, implementation, analysis, characterization, and classification of programming languages and programming language features. It is a multi disciplinary field, both… …   Wikipedia

  • TXL (programming language) — Infobox programming language name = TXL logo = paradigm = Pattern matching and Term rewriting designer = Charles Halpern Hamu and James Cordy developer = Charles Halpern Hamu and James CordyTXL is a special purpose programming language originally …   Wikipedia

  • Euclid (programming language) — Euclid is an imperative programming language for writing verifiable programs. It was designed by Butler Lampson and associates at the Xerox PARC lab in the mid 1970s. The implementation was led by Ric Holt at the University of Toronto and James… …   Wikipedia

  • Concurrent Euclid (programming language) — Concurrent Euclid (ConEuc) is a concurrent descendant of the Euclid programming language designed by James Cordy and Ric Holt, then at the University of Toronto, in 1980. ConEuc was designed for concurrent, high performance, highly reliable… …   Wikipedia

  • Esoteric programming language — An esoteric programming language (sometimes shortened to esolang) is a programming language designed as a test of the boundaries of computer programming language design, as a proof of concept, or as a joke. There is usually no intention of the… …   Wikipedia

  • APL (programming language) — APL Paradigm(s) array, functional, structured, modular Appeared in 1964 Designed by Kenneth E. Iverson Developer Kenneth E. Iverson …   Wikipedia

  • Lisp (programming language) — Infobox programming language name = Lisp paradigm = multi paradigm: functional, procedural, reflective generation = 3GL year = 1958 designer = John McCarthy developer = Steve Russell, Timothy P. Hart, and Mike Levin latest release version =… …   Wikipedia

  • Ada (programming language) — For other uses of Ada or ADA, see Ada (disambiguation). Ada Paradigm(s) Multi paradigm Appeared in 1980 Designed by MIL STD 1815/Ada 83: Jean Ichbiah Ada 95: Tucker Taft Ada 2005: Tucker Taft Stable release …   Wikipedia

Share the article and excerpts

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