Pascal (programming language): Difference between revisions

Content deleted Content added
Citation bot (talk | contribs)
Altered journal. Added isbn. | Use this bot. Report bugs. | Suggested by Neko-chan | #UCB_webform 46/500
+cat.
 
(8 intermediate revisions by 4 users not shown)
Line 63:
 
===Pascal===
Pascal was influenced by the ALGOL W efforts, with the explicit goals of teaching programming in a [[structured programming|structured fashion]] and for the development of system software.<ref>{{Cite book|chapter-url=https://link.springer.com/chapter/10.1007/10722581_1|doi = 10.1007/10722581_1|chapter = The Development of Procedural Programming Languages Personal Contributions and Perspectives|title = Modular Programming Languages|series = Lecture Notes in Computer Science|year = 2000|last1 = Wirth|first1 = Niklaus|volume = 1897|pages = 1–10|isbn = 978-3-540-67958-5}}</ref> A generation of students used Pascal as an introductory language in undergraduate courses. Other goals included providing a reliable and efficient tool for writing large programs,<ref>{{cite journal |last1=Wirth |first1=N. |title=The Programming Language Pascal |journal=Acta Informatica |date=1971 |volume=1 |issue=1 |pages=35–63 |doi=10.1007/BF00264291|hdl=20.500.11850/68712 |hdl-access=free }}</ref> and bridging the canyon between scientific and commercial programming, as represented by the then-widespread languages Fortran and COBOL, with a general-purpose language.<ref>{{cite journalbook |last1=Wirth |first1=N. |titlechapter=Recollections about the development of Pascal |journaltitle=History of Programmingprogramming Languageslanguages---II |date=January 1996 |pages=97–120 |doi=10.1145/234286.1057812|isbn=0-201-89502-1 }}</ref>
 
One of the early successes for the language was the introduction of [[UCSD Pascal]], a version that ran on a custom [[operating system]] that could be ported to different platforms. A key platform was the [[Apple II]], where it saw widespread use as [[Apple Pascal]]. This led to Pascal becoming the primary [[high-level language]] used for development in the [[Apple Lisa]], and later, the [[Mac (computer)|Macintosh]]. Parts of the original [[Classic Mac OS|Macintosh operating system]] were hand-translated into [[Motorola 68000]] [[assembly language]] from the Pascal [[source code]].<ref>Hertzfeld, Andy. "[http://www.folklore.org/StoryView.py?project=Macintosh&story=Hungarian.txt&topic=Software%20Design&sortOrder=Sort%20by%20Date&detail=medium Hungarian folklore.org] {{webarchive|url=https://web.archive.org/web/20151118082558/http://www.folklore.org/StoryView.py?project=Macintosh&story=Hungarian.txt&topic=Software%20Design&sortOrder=Sort%20by%20Date&detail=medium |date=2015-11-18}}: Macintosh Stories. Retrieved 2012-03-06.</ref>
Line 173:
|-
| [[Array data type|array]]
| a countable group of any of the preceding data types, orof records, or of other arrays
|-
| [[Record (computer science)|record]]
| A collection of any of the preceding data types or of other records
|-
| [[string (computer science)|string]]
Line 182:
|}
 
The range of values allowed for the basic types (except Boolean) is implementation defined. Functions are provided for some data conversions. For conversion of <code>real</code> to <code>integer</code>, the following functions are available: <code>round</code> (whichusing rounds[[Rounding#Rounding_half_away_from_zero|rounding tohalf integeraway usingfrom [[banker's roundingzero]]) and <code>trunc</code> (rounds towards zero).
 
The programmer has the freedom to define other commonly used data types (e.g. byte, string, etc.) in terms of the predefined types using Pascal's type declaration facility, for example
Line 284:
end;
c = file of a;
</syntaxhighlight>
 
Further, complex types can be constructed from other complex types recursively:
 
:<syntaxhighlight lang="pascal">
const
Jack = 11;
Queen = 12;
King = 13;
Ace = 14;
 
type
valueType = 2..Ace;
suitType = club, diamond, heart, spade;
 
cardType = record
suit: suitType;
value: valueType;
end;
 
deckType = array [1..52] of cardType;
 
person = record
surname: packed array [1..20] of char;
age: integer;
end;
 
table = record
hands: array [1..3] of deckType;
players: array [1..4] of person;
end;
</syntaxhighlight>
 
Line 539 ⟶ 570:
* C. A. R. Hoare: "Notes on data structuring". In O.-J. Dahl, E. W. Dijkstra and C. A. R. Hoare, editors, ''Structured Programming'', pages 83–174. Academic Press, 1972.
* C. A. R. Hoare, Niklaus Wirth: ''An Axiomatic Definition of the Programming Language Pascal''. 335–355, Acta Informatica, Volume 2, 1973.
* Kathleen Jensen and Niklaus Wirth: ''[https://web.archive.org/web/20050314152247/http://www.cs.inf.ethz.ch/~wirth/books/Pascal/ Pascal – User Manual and Report]''. Springer-Verlag, 1974, 1985, 1990, 1991, {{ISBN|0-387-97649-3}} and {{ISBN|3-540-97649-3}}.
* Niklaus Wirth: ''[[Algorithms + Data Structures = Programs]]''. Prentice-Hall, 1975, {{ISBN|0-13-022418-9}}.
* Niklaus Wirth: ''An assessment of the programming language Pascal''. 23–30 ACM SIGPLAN Notices Volume 10, Issue 6, June 1975.
Line 566 ⟶ 597:
<!-- Hidden categories below -->
[[Category:Articles with example Pascal code]]
[[Category:Compiled programming languages]]