Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Pascal (programming language)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{short description|Programming language}} {{other uses|Pascal (disambiguation)}} {{Infobox programming language | name = Pascal | logo = | paradigm = {{hlist |[[Imperative programming|Imperative]] |[[Structured programming|structured]]}} | family = [[Niklaus Wirth|Wirth]] Pascal | designer = [[Niklaus Wirth]] | released = {{Start date and age|1970}} | latest release version = | latest release date = | typing = {{hlist |[[Static typing|Static]] |[[Strong and weak typing|strong]] |[[type system#Type safety and memory safety|safe]]}} | scope = [[Scope (computer science)|Lexical]] | implementations = {{hlist |[[Berkeley Software Distribution|BSD]] | [[CDC 6000]] |[[Delphi (software)|Embarcadero Delphi]] |[[ICT 1900 series|ICL 1900]] |[[Pascal-P]] |[[PDP-11]] |[[PDP-10]] |[[IBM System/370]] |[[VSI Pascal]] |[[Free Pascal]] |[[GNU Pascal]]}} | dialects = {{hlist |[[Delphi (software)|Delphi]] |[[Turbo Pascal]] |[[UCSD Pascal]]}} | influenced by = {{startflatlist}} * [[ALGOL W]] * [[Simula]] 67 {{endflatlist}} | influenced = {{startflatlist}} * [[Ada (programming language)|Ada]] * [[C/AL]] * [[C Sharp (programming language)|C#]] * [[Component Pascal]] * [[Go (programming language)|Go]] * [[Java (programming language)|Java]]<ref>{{cite web| url=http://java.sun.com/docs/white/delegates.html |title=About Microsoft's "Delegates" |archive-url=https://web.archive.org/web/20120627043929/http://java.sun.com/docs/white/delegates.html |archive-date=2012-06-27 |quote=We looked very carefully at Delphi [[Object Pascal]] and built a working prototype of bound method references in order to understand their interaction with the Java programming language and its APIs ... Our conclusion was that bound method references are unnecessary and detrimental to the language. This decision was made in consultation with Borland International, who had previous experience with bound method references in Delphi [[Object Pascal]].}}</ref><ref>{{cite web |url=http://www.fscript.org/prof/javapassport.pdf |quote=The project went ahead under the name "green" and the language was based on an old model of [[UCSD Pascal]], which makes it possible to generate interpretive code |title=History of Java |work=Java Application Servers Report |author=TechMetrix Research |date=1999 |url-status=dead |archive-url=https://web.archive.org/web/20101229090912/http://www.fscript.org/prof/javapassport.pdf |archive-date=2010-12-29 |access-date=2009-10-16 }}</ref><ref>{{cite web|url=http://queue.acm.org/detail.cfm?id=1017013|title=A Conversation with James Gosling – ACM Queue|access-date=11 August 2015|url-status=live|archive-url=https://web.archive.org/web/20150716194245/http://queue.acm.org/detail.cfm?id=1017013|archive-date=16 July 2015}}</ref> * [[Modula]]{{\}}[[Modula-2|-2]]{{\}}[[Modula-3|-3]] * [[Oberon (programming language)|Oberon]]{{\}}[[Oberon-2|-2]] * [[Object Pascal]] * [[Oxygene (programming language)|Oxygene]] * [[Microsoft Power Fx|Power Fx]] * [[Seed7]] * [[Standard ML]] * [[VHDL]] * [[Structured text]] {{endflatlist}} | operating system = | license = | website = | file_ext = .pas | wikibooks = Pascal Programming }} '''Pascal''' is an [[Imperative programming|imperative]] and [[Procedural programming|procedural]] [[programming language]], designed by [[Niklaus Wirth]] as a small, efficient language intended to encourage good programming practices using [[structured programming]] and [[data structure|data structuring]]. It is named after French mathematician, philosopher and physicist [[Blaise Pascal]].{{efn|In an issue of ''[[Electronics (magazine)|Electronics]]'' in 1978, Wirth explained why he named the language after Blaise Pascal: "Actually, I am neither capable of fully understanding his philosophy nor of appreciating his religious exaltations. Pascal, however, was (perhaps one of) the first to invent and construct [[Pascal's calculator|a device]] that we now classify as a digital computer."<ref>{{cite magazine |last=Wirth |first=Niklaus |author-link=Niklaus Wirth |date=1978-12-21 |title=Obeisance to Pascal, inventor |magazine=[[Electronics (magazine)|Electronics]] |publisher=Dan McMillan |editor1-first=Kemp |editor1-last=Anderson |department=Readers' comments |issn=0013-5070 |url=https://www.worldradiohistory.com/Archive-Electronics/70s/78/Electronics-1978-12-21.pdf |access-date=2024-08-13 |archive-url=https://web.archive.org/web/20240520045053/https://www.worldradiohistory.com/Archive-Electronics/70s/78/Electronics-1978-12-21.pdf |archive-date=2024-05-20 |url-status=live |page=6}}</ref>}} Pascal was developed on the pattern of the [[ALGOL 60]] language. Wirth was involved in the process to improve the language as part of the [[ALGOL X]] efforts and proposed a version named [[ALGOL W]]. This was not accepted, and the ALGOL X process bogged down. In 1968, Wirth decided to abandon the ALGOL X process and further improve ALGOL W, releasing this as Pascal in 1970. On top of ALGOL's [[variable (computer science)|scalar]]s and [[array (data type)|arrays]], Pascal enables defining complex datatypes and building dynamic and recursive data structures such as [[list (abstract data type)|list]]s, [[tree (data structure)|tree]]s and [[graph (abstract data type)|graph]]s. Pascal has [[strong and weak typing|strong typing]] on all objects, which means that one type of data cannot be converted to or interpreted as another without explicit conversions. Unlike C (and also unlike most other languages in the [[C-family]]), Pascal allows [[nested procedure]] definitions to any level of depth, and also allows most kinds of definitions and declarations inside [[subroutines]] (procedures and functions). A program is thus syntactically similar to a single procedure or function. This is similar to the block structure of ALGOL 60, but restricted from arbitrary block statements to just procedures and functions. Pascal became very successful in the 1970s, notably on the burgeoning [[minicomputer]] market. [[Compiler]]s were also available for many [[microcomputer]]s as the field emerged in the late 1970s. It was widely used as a teaching language in [[university]]-level programming courses in the 1980s, and also used in production settings for writing commercial software during the same period. It was displaced by the [[C (programming language)|C programming language]] during the late 1980s and early 1990s as [[UNIX]]-based systems became popular, and especially with the release of [[C++]]. A derivative named [[Object Pascal]] designed for [[object-oriented programming]] was developed in 1985. This was used by [[Apple Inc.|Apple Computer]] (for the [[Apple Lisa|Lisa]] and [[Mac (computer)|Macintosh]] machines) and [[Borland]] in the late 1980s and later developed into [[Delphi (software)|Delphi]] on the [[Microsoft Windows]] platform. Extensions to the Pascal concepts led to the languages [[Modula-2]] and [[Oberon (programming language)|Oberon]], both developed by Wirth. ==History== ===Earlier efforts=== Much of the history of [[computer language]] design during the 1960s can be traced to the [[ALGOL 60]] language. ALGOL was developed during the 1950s with the explicit goal of being able to clearly describe [[algorithm]]s. It included a number of features for [[structured programming]] that remain common in languages to this day. Shortly after its introduction, in 1962 Wirth began working on his dissertation with Helmut Weber on the [[Euler (programming language)|Euler programming language]]. Euler was based on ALGOL's syntax and many concepts but was not a derivative. Its primary goal was to add dynamic lists and types, allowing it to be used in roles similar to [[Lisp (programming language)|Lisp]]. The language was published in 1965. By this time, a number of problems in ALGOL had been identified, notably the lack of a standardized [[String (computer science)|string]] system. The group tasked with maintaining the language had begun the [[ALGOL X]] process to identify improvements, calling for submissions. Wirth and [[Tony Hoare]] submitted a conservative set of modifications to add strings and clean up some of the syntax. These were considered too minor to be worth using as the new standard ALGOL, so Wirth wrote a compiler for the language, which became named [[ALGOL W]]. The ALGOL X efforts would go on to choose a much more complex language, [[ALGOL 68]]. The complexity of this language led to considerable difficulty producing high-performance compilers, and it was not widely used in the industry. This left an opening for newer languages. ===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 book |last1=Wirth |first1=N. |chapter=Recollections about the development of Pascal |title=History of programming languages---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> The [[typesetting]] system [[TeX]] by [[Donald Knuth]] was written in [[WEB]], the original [[literate programming]] system, based on [[Digital Equipment Corporation|DEC]] [[PDP-10]] Pascal. Successful commercial applications like [[Adobe Photoshop]]<ref>https://www.computerhistory.org/atchm/adobe-photoshop-source-code/ {{Webarchive|url=https://web.archive.org/web/20140507131754/http://www.computerhistory.org/atchm/adobe-photoshop-source-code/ |date=2014-05-07}}, Adobe Photoshop Source Code</ref> were written in [[Macintosh Programmer's Workshop]] Pascal, while applications like [[Total Commander]], [[Skype]]<ref>{{cite web |url=https://www.embarcadero.com/products/rad-studio/application-showcase|title=RAD Studio Application Showcase|date=2021-10-29}}</ref> and [[Macromedia Captivate]] were written in Delphi ([[Object Pascal]]). [[Apollo Computer]] used Pascal as the systems programming language for its operating systems beginning in 1980. Variants of Pascal have also been used for everything from research projects to [[PC game]]s and [[embedded system]]s. Newer Pascal compilers exist which are widely used.<ref>[http://www.tiobe.com/index.php/content/paperinfo/tpci/ tiobe.com] {{webarchive|url=https://web.archive.org/web/20120315012717/http://www.tiobe.com/index.php/content/paperinfo/tpci |date=2012-03-15}}, Programming Community Index for January 2011.</ref> ===Dialects=== Wirth's example compiler meant to propagate the language, the Pascal-P system, used a subset of the language designed to be the minimal subset of the language that could compile itself. The idea was that this could allow bootstrapping the compiler, which would then be extended to full Pascal language status. This was done with several compilers, but one notable exception was UCSD Pascal, which was based on Pascal-P2. It kept the subset status of the language based on the idea that this would run better on the new (then) microprocessors with limited memory. UCSD also converted the Pascal-P2 interpreter into a "byte machine", again, because it would be a better fit for byte oriented microprocessors. UCSD Pascal formed the basis of many systems, including Apple Pascal. Borland Pascal was not based on the UCSD codebase, but arrived during the popular period of UCSD and matched many of its features. This started the line that ended with Delphi Pascal and the compatible Open Source compiler FPC/Lazarus. The ISO standard for Pascal, ISO 7185, was published in 1983 and was widely implemented and used on mainframes, minicomputers and IBM-PCs and compatibles from 16 bits to 32 bits. The two dialects of Pascal most in use towards the end of the 20th century and up until today are the ISO 7185 standard version and the Delphi/Turbo Pascal versions (of which the two Borland versions are mostly compatible with each other). The source for much of the early history on Pascal can be found in the Pascal User's Group newsletters at: [https://www.standardpascal.org/pug.html Pascal Users Group Newsletters]. ===Object Pascal=== During work on the Lisa, [[Larry Tesler]] began corresponding with Wirth on the idea of adding object-oriented extensions to the language, to make Pascal a [[Programming paradigm|multi-paradigm programming language]]. This led initially to [[Clascal]], introduced in 1983. As the Lisa program faded and was replaced by the Macintosh, a further version was created and named [[Object Pascal]]. This was introduced on the Mac in 1985 as part of the [[MacApp]] [[application framework]], and became Apple's main development language into the early 1990s. The Object Pascal extensions were added to [[Turbo Pascal]] with the release of version 5.5 in 1989.<ref>{{cite web|title=Antique Software: Turbo Pascal v5.5|url=http://edn.embarcadero.com/article/20803|access-date=2018-05-17|archive-date=2010-11-24|archive-url=https://web.archive.org/web/20101124090934/http://edn.embarcadero.com/article/20803|url-status=dead}}</ref> Over the years, Object Pascal became the basis of the [[Delphi (software)|Delphi]] system for [[Microsoft Windows]], which is still used for developing Windows applications, and can [[cross-compile]] code to other systems. [[Free Pascal]] is an open source, cross-platform alternative with its own graphical [[integrated development environment|IDE]] called [[Lazarus (IDE)|Lazarus]]. ==Implementations== ===Early compilers=== The first Pascal [[compiler]] was designed in [[Zürich]] for the [[CDC 6000 series]] [[mainframe computer]] family. [[Niklaus Wirth]] reports that a first attempt to implement it in [[Fortran|FORTRAN 66]] in 1969 was unsuccessful due to FORTRAN 66's inadequacy to express complex data structures. The second attempt was implemented in a C-like language (Scallop by Max Engeli) and then translated by hand (by R. Schild) to Pascal itself for boot-strapping.<ref>[https://www.inf.ethz.ch/personal/wirth/Miscellaneous/ComputersAndComputing.pdf Computers and Computing. A Personal Perspective.] {{webarchive|url=https://web.archive.org/web/20170510101203/https://www.inf.ethz.ch/personal/wirth/Miscellaneous/ComputersAndComputing.pdf |date=2017-05-10}} by Niklaus Wirth</ref> It was operational by mid-1970. Many Pascal compilers since have been similarly [[Self-hosting (compilers)|self-hosting]], that is, the compiler is itself written in Pascal, and the compiler is usually capable of recompiling itself when new features are added to the language, or when the compiler is to be [[porting|ported]] to a new environment. The [[GNU Pascal]] compiler is one notable exception, being written in C. The first successful port of the CDC Pascal compiler to another mainframe was completed by Welsh and Quinn at the [[Queen's University of Belfast]] (QUB) in 1972. The target was the [[International Computers Limited]] (ICL) [[ICT 1900 series|1900 series]]. This compiler, in turn, was the parent of the Pascal compiler for the Information Computer Systems (ICS) [[Multum]] minicomputer. The Multum port was developed – with a view to using Pascal as a systems programming language – by Findlay, Cupples, Cavouras and Davis, working at the Department of Computing Science in [[Glasgow University]]. It is thought that Multum Pascal, which was completed in the summer of 1973, may have been the first [[16-bit computing|16-bit]] implementation. A completely new compiler was completed by Welsh et al. at QUB in 1977. It offered a source-language diagnostic feature (incorporating profiling, tracing and type-aware formatted postmortem dumps) that was implemented by Findlay and Watt at Glasgow University. This implementation was ported in 1980 to the [[ICL 2900]] series by a team based at [[Southampton University]] and Glasgow University. The Standard Pascal Model Implementation was also based on this compiler, having been adapted, by Welsh and Hay at [[Manchester University]] in 1984, to check rigorously for conformity to the BSI 6192/ISO 7185 Standard and to generate code for a portable abstract machine. The first Pascal [[compiler]] written in North America was constructed at the [[University of Illinois at Urbana–Champaign|University of Illinois]] under [[Donald B. Gillies#Later career|Donald B. Gillies]] for the [[PDP-11]] and generated native machine code. Microsoft had Pascal compilers for IBM PCs, see [[Microsoft Pascal]]. ==={{anchor|Pascal-P}}The Pascal-P system=== To propagate the language rapidly, a compiler ''porting kit'' was created in Zürich that included a compiler that generated so called [[p-code machine|p-code]] for a ''virtual'' stack machine, i.e., code that lends itself to reasonably efficient interpretation, along with an interpreter for that code – the ''Pascal-P'' system. The P-system compilers were named Pascal-P1, Pascal-P2, Pascal-P3, and Pascal-P4. Pascal-P1 was the first version, and Pascal-P4 was the last to come from Zürich. The version termed Pascal-P1 was coined after the fact for the many different sources for Pascal-P that existed. The compiler was redesigned to enhance [[software portability|portability]], and issued as Pascal-P2. This code was later enhanced to become Pascal-P3, with an intermediate code [[backward compatible]] with Pascal-P2, and Pascal-P4, which was not backward compatible. The Pascal-P4 compiler–interpreter can still be run and compiled on systems compatible with original Pascal (as can Pascal-P2). However, it only accepts a subset of the Pascal language. Pascal-P5, created outside the Zürich group, accepts the full Pascal language and includes ISO 7185 compatibility. Pascal-P6 is a follow on to Pascal-P5 that along with other features, aims to be a compiler for specific CPUs, including AMD64. [[UCSD Pascal]] branched off Pascal-P2, where [[Kenneth Bowles]] used it to create the [[Interpreter (computing)|interpretive]] UCSD p-System. It was one of three operating systems available at the launch of the original [[IBM Personal Computer]].<ref>[http://www.cbi.umn.edu/oh/pdf/oh392jb.pdf cbi.umn.edu], "An Interview with John Brackett and Doug Ross"{{dead link |date=March 2018 |bot=InternetArchiveBot |fix-attempted=yes}}, p15, Charles Babbage Institute, 2004</ref> UCSD Pascal used an intermediate code based on byte values, and thus was one of the earliest ''[[bytecode]] compilers''. [[Apple Pascal]] was released in 1979 for the Apple II and [[Apple III]] computer systems. It was an implementation of, or largely based on, UCSD Pascal. Pascal-P1 through Pascal-P4 were not, but rather based on the [[CDC 6600]] 60-bit word length. A compiler based on the Pascal-P4 compiler, which created native binary [[OS/360 Object File Format|object files]], was released for the [[IBM System/370]] [[mainframe computer]] by the [[Australian Atomic Energy Commission]]; it was named the ''AAEC Pascal 8000 Compiler'' after the abbreviation of the name of the commission.<ref>{{cite report |url=http://www.iaea.org/inis/collection/NCLCollectionStore/_Public/10/477/10477561.pdf |date=1977 |title=Australian Atomic Energy Commission Research Establishment, Lucas Heights, Nuclear Science and Technology Branch Report, Divisional Research |page=22 |website=International Atomic Energy Agency (IEAE)}}</ref> ===Object Pascal and Turbo Pascal=== Apple Computer created its own Lisa Pascal for the Lisa Workshop in 1982, and ported the compiler to the Apple Macintosh and [[Macintosh Programmer's Workshop|MPW]] in 1985. In 1985 [[Larry Tesler]], in consultation with Niklaus Wirth, defined Object Pascal and these extensions were incorporated in both the Lisa Pascal and Mac Pascal compilers. In the 1980s, [[Anders Hejlsberg]] wrote the Blue Label Pascal compiler for the [[Nascom]]-2. A reimplementation of this compiler for the [[IBM PC]] was marketed under the names Compas Pascal and PolyPascal before it was acquired by [[Borland]] and renamed ''Turbo Pascal''. [[Turbo Pascal]] became hugely popular, thanks to an aggressive pricing strategy, having one of the first full-screen IDEs, and very fast turnaround time (just seconds to compile, link, and run). It was written and highly optimized entirely in [[assembly language]], making it [[Memory footprint|smaller]] and faster than much of the competition. In 1986, Anders ported Turbo Pascal to the Macintosh and incorporated Apple's Object Pascal extensions into Turbo Pascal. These extensions were then added back into the PC version of Turbo Pascal for version 5.5. At the same time [[Microsoft]] also implemented the Object Pascal compiler.<ref>Jon Udell, Crash of the Object-Oriented Pascals, BYTE, July, 1989.</ref><ref>M. I. Trofimov, The End of Pascal?, BYTE, March, 1990, p. 36.</ref> Turbo Pascal 5.5 had a large influence on the Pascal community, which began concentrating mainly on the IBM PC in the late 1980s. Many PC hobbyists in search of a structured replacement for BASIC used this product. It also began to be adopted by professional developers. Around the same time a number of concepts were imported from [[C (programming language)|C]] to let Pascal programmers use the C-based [[application programming interface]] (API) of [[Microsoft Windows]] directly. These extensions included null-terminated [[String (computer science)|string]]s, [[pointer arithmetic]], [[function pointer]]s, an address-of operator, and unsafe [[type conversion|typecasts]]. Turbo Pascal and other derivatives with ''unit'' or ''module'' structures are [[modular programming]] languages. However, it does not provide a nested module concept or qualified import and export of specific symbols. ==={{anchor|Pascal-SC|Pascal-XSC}}Other variants=== [[Super Pascal]] adds non-numeric labels, a return statement and expressions as names of types. TMT Pascal was the first [[Borland]]-compatible compiler for [[32-bit computing|32-bit]] [[MS-DOS]] compatible [[protected mode]], [[OS/2]], and [[Win32]]. It extends the language with function and [[operator overloading]]. The universities of [[University of Wisconsin–Madison|Wisconsin–Madison]], [[University of Zurich|Zürich]], [[Karlsruhe Institute of Technology|Karlsruhe]], and [[University of Wuppertal|Wuppertal]] developed the ''Pascal-SC''<ref>{{cite journal |last1=Rall |first1=L. B. |date=1987 |title=An introduction to the scientific computing language Pascal-SC |journal=Computers |volume=14 |pages=53–69 |doi=10.1016/0898-1221(87)90181-7|doi-access=}}</ref><ref name="Cadmus_1986">{{cite journal |title=Cadmus jetzt mit Kulisch-Arithmetik - Uni Karlsruhe gibt Pascal-Compiler nach München |trans-title=Cadmus now comes with Kulisch arithmetic - University Karlsruhe delivers Pascal compiler to Munich |author=PI |date=1986-08-29 |journal=[[Computerwoche]] |publisher=[[IDG Business Media GmbH]] |language=de |location=Munich – Karlsruhe, Germany |url=http://www.computerwoche.de/a/uni-karlsruhe-gibt-pascal-compiler-nach-muenchen-cadmus-jetzt-mit-kulisch-arithmetik,1165749 |access-date=2016-05-30 |url-status=dead |archive-url=https://web.archive.org/web/20160530220339/http://www.computerwoche.de/a/uni-karlsruhe-gibt-pascal-compiler-nach-muenchen-cadmus-jetzt-mit-kulisch-arithmetik,1165749 |archive-date=2016-05-30}}</ref> and ''Pascal-XSC''<ref>{{cite web |url=http://www.rz.uni-karlsruhe.de/~iam/html/language/pxsc.html |title=Pascal-XSC: Pascal for Extended Scientific Computing |url-status=dead |archive-url=https://web.archive.org/web/20140105102206/http://www.rz.uni-karlsruhe.de/~iam/html/language/pxsc.html |archive-date=2014-01-05}}</ref><ref>{{cite web |url=http://www.xsc.de/ |title=XSC Software |access-date=11 August 2015 |url-status=dead |archive-url=https://web.archive.org/web/20151101160306/http://www.xsc.de/ |archive-date=1 November 2015}}</ref><ref>{{cite web |url=http://www2.math.uni-wuppertal.de/wrswt/xsc/pxsc_download.html |title=Universitaet Wuppertal: Wissenschaftliches Rechnen / Softwaretechnologie |access-date=11 August 2015 |url-status=dead |archive-url=https://web.archive.org/web/20151106022857/http://www2.math.uni-wuppertal.de/wrswt/xsc/pxsc_download.html |archive-date=6 November 2015}}</ref> (''[[Extensions for Scientific Computation]]'') compilers, aimed at programming numerical computations. Development for Pascal-SC started in 1978 supporting ISO 7185 Pascal level 0, but level 2 support was added at a later stage.<ref name="Wallis_1990">{{cite book |title=Improving Floating-Point Programming |editor-first=Peter J. L. |editor-last=Wallis |author-first1=Lothar |author-last1=Bamberger |author-first2=James H. |author-last2=Davenport |author-first3=Hans-Christoph |author-last3=Fischer |author-first4=Jan |author-last4=Kok |author-first5=Günter |author-last5=Schumacher |author-first6=Christian |author-last6=Ullrich |author-first7=Peter J. L. |author-last7=Wallis |author-first8=Dik T. |author-last8=Winter |author-first9=Jürgen |author-last9=Wolff von Gudenberg |date=1990 |edition=1st |publisher=[[John Wiley & Sons Ltd.]] |location=Bath, United Kingdom |isbn=0-471-92437-7 <!--|ISBN=978-0-471-92437-1 -->}}</ref> Pascal-SC originally targeted the [[Z80]] processor, but was later rewritten for DOS ([[x86]]) and [[Motorola 68000|68000]]. Pascal-XSC has at various times been ported to Unix (Linux, [[SunOS]], [[HP-UX]], [[IBM AIX|AIX]]) and Microsoft/IBM (DOS with [[EMX (programming environment)|EMX]], OS/2, [[Windows]]) operating systems. It operates by generating intermediate C source code which is then compiled to a native executable. Some of the Pascal-SC language extensions have been adopted by [[GNU Pascal]]. Pascal Sol was designed around 1983 by a French team to implement a [[Unix-like]] system named Sol. It was standard Pascal level-1 (with parameterized array bounds) but the definition allowed alternative keywords and predefined identifiers in French and the language included a few extensions to ease system programming (e.g. an equivalent to lseek).<ref>Michel Gien, "The SOL Operating System", in Usenix Summer '83 Conference, Toronto, ON, (July 1983), pp. 75–78</ref> The Sol team later on moved to the [[ChorusOS]] project to design a [[distributed operating system]].<ref>{{Cite web|url=http://www.cs.berkeley.edu/~prabal/resources/osprelim/RAA+92.pdf|archiveurl=https://web.archive.org/web/20150207194433/http://www.cs.berkeley.edu/~prabal/resources/osprelim/RAA+92.pdf|url-status=dead|title=Overview of the CHORUS Distributed Operating Systems|year=1991|work=Chorus systems|via=cs.berkeley.edu|archivedate=February 7, 2015}}</ref> [[IP Pascal]] is an implementation of the Pascal programming language using [[Micropolis (company)|Micropolis]] DOS, but was moved rapidly to [[CP/M-80]] running on the Z80. It was moved to the [[80386]] machine types in 1994, and exists today as [[Windows XP]] and Linux implementations. In 2008, the system was brought up to a new level and the resulting language termed "Pascaline" (after [[Pascal's calculator]]). It includes objects, [[namespace]] controls, [[dynamic array]]s, and many other extensions, and generally features the same functionality and type protection as [[C Sharp (programming language)|C#]]. It is the only such implementation that is also compatible with the original Pascal implementation, which is standardized as ISO 7185. ==Language constructs== Pascal, in its original form, is a purely [[procedural language]] and includes the traditional array of [[ALGOL]]-like control structures with reserved words such as <code>if</code>, <code>then</code>, <code>else</code>, <code>while</code>, <code>for</code>, and <code>case</code>, ranging on a single statement or a <code>begin</code>-<code>end</code> statements block. Pascal also has data structuring constructs not included in the original [[ALGOL 60]] [[type system|types]], like [[Record (computer science)|record]]s, variants, [[pointer (computer programming)|pointer]]s, [[enumerated type|enumeration]]s, and [[set (computer science)|set]]s and procedure pointers. Such constructs were in part inherited or inspired from [[Simula]] 67, [[ALGOL 68]], [[Niklaus Wirth]]'s own [[ALGOL W]] and suggestions by [[C. A. R. Hoare]]. Pascal programs start with the <code>program</code> [[keyword (computer programming)|keyword]] with a list of external [[file descriptor]]s as parameters<ref name="iso/iec 7185:1990 6.10">[http://www.moorecad.com/standardpascal/iso7185.pdf Pascal ISO 7185:1990] {{webarchive|url=https://web.archive.org/web/20120617105237/http://www.moorecad.com/standardpascal/iso7185.pdf |date=2012-06-17}} 6.10</ref> (not required in Turbo Pascal etc.); then follows the main [[block (programming)|block]] bracketed by the <code>begin</code> and <code>end</code> keywords. [[Semicolon]]s separate [[Statement (programming)|statements]], and the [[full stop]] (i.e., a period) ends the whole program (or ''unit''). [[Letter case]] is ignored in Pascal source. Here is an example of the source code in use for a very simple [["Hello, World!" program]]: :<syntaxhighlight lang="pascal"> program HelloWorld(output); begin WriteLn('Hello, World!') {No ";" is required after the last statement of a block - adding one adds a "null statement" to the program, which is ignored by the compiler.} end. </syntaxhighlight> ===Data types=== A Type Declaration in Pascal is used to define a range of values which a variable of that type is capable of storing. It also defines a set of operations that are permissible to be performed on variables of that type. The predefined types are: {| class="wikitable" |- ! Data type ! Type of values which the variable is capable of storing |- | [[integer (computer science)|integer]] | integer (whole) numbers |- | [[floating-point arithmetic|real]] | floating-point numbers |- | [[Boolean type|Boolean]] | the values True or False |- | [[character (computing)|char]] | a single character from an ordered character set |- | [[set (computer science)|set]] | equivalent to an array of [[Boolean type|Boolean]] values |- | [[Array data type|array]] | a countable group of any of the preceding data types, of 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]] | a sequence or "string" of characters is declared as a "packed array of char" with a starting index of 1. These can be assigned string constants and individual characters can be accessed as elements of the array. |} 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> (using [[Rounding#Rounding_half_away_from_zero|rounding half away from zero]]) 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 :<syntaxhighlight lang="pascal"> type byte = 0..255; signed_byte = -128..127; string = packed array[1..255] of char; </syntaxhighlight> Often-used types like byte and string are already defined in many implementations. Normally the system will use a [[Word (computer architecture)|word]] to store the data. For instance, the {{code|byte}} type may be stored in a machine integer - 32 bits perhaps - rather than an [[8-bit computing|8-bit]] value. Pascal does not contain language elements that allow the basic storage types to be defined more granularly. This capability was included in a number of Pascal extensions and follow-on languages, while others, like [[Modula-2]], expanded the built-in set to cover most machine data types like 16-bit integers. The {{code|packed}} keyword tells the compiler to use the most efficient method of storage for the structured data types: sets, arrays and records, rather than using one [[Word (computer architecture)|word]] for each element. Packing may slow access on machines that do not offer easy access to parts of a word. ===Subrange types=== Subranges of any [[ordinal data type]] (any simple type except real) can also be made: :<syntaxhighlight lang="pascal"> var x : 1..10; y : 'a'..'z'; </syntaxhighlight> ===Set types=== In contrast with other programming languages from its time, Pascal supports a set type:<ref name="Mandell1987">{{cite book |first=Steven L. |last=Mandell |title=Pascal Programming Today |url=https://archive.org/details/turbopascalprogr00mand |url-access=registration |year=1987 |publisher=West Publishing Company |isbn=978-0-314-33935-5}}</ref> :<syntaxhighlight lang="pascal"> var Set1 : set of 1..10; Set2 : set of 'a'..'z'; </syntaxhighlight> A set is a fundamental concept for modern mathematics, and they may be used in many algorithms. Such a feature is useful and may be faster than an equivalent construct in a language that does not support sets. For example, for many Pascal compilers: :<syntaxhighlight lang="pascal"> if i in [5..10] then ... </syntaxhighlight> executes faster than: :<syntaxhighlight lang="pascal"> if (i > 4) and (i < 11) then ... </syntaxhighlight> Sets of non-contiguous values can be particularly useful, in terms of both performance and readability: :<syntaxhighlight lang="pascal"> if i in [0..3, 7, 9, 12..15] then ... </syntaxhighlight> For these examples, which involve sets over small domains, the improved performance is usually achieved by the compiler representing set variables as [[bit vector]]s. The set [[Operator (programming)|operators]] can then be implemented efficiently as bitwise machine code operations. ===Record types=== An example of a Pascal record type: :<syntaxhighlight lang="pascal"> type car = record length: integer; width: integer end; </syntaxhighlight> An example of a variant record type: :<syntaxhighlight lang="pascal"> type Shape = (Circle, Square, Triangle); Dimensions = record case Figure: Shape of Circle: (Diameter: real); Square: (Width: real); Triangle: (Side: real; Angle1, Angle2: 0..360) end; </syntaxhighlight> Variant records allow several fields of the record to overlap each other to save space. ===Type declarations=== Types can be defined from other types using type declarations: :<syntaxhighlight lang="pascal"> type x = integer; y = x; ... </syntaxhighlight> Further, complex types can be constructed from simple types: :<syntaxhighlight lang="pascal"> type a = array[1..10] of integer; b = record x : integer; y : char {extra semicolon not strictly required} 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> ===File type=== :<syntaxhighlight lang="pascal"> type a = file of integer; b = record x : integer; y : char end; c = file of b; </syntaxhighlight> As shown in the example above, Pascal [[Computer file|files]] are sequences of components. Every file has a buffer variable which is denoted by ''f^''. The procedures ''get'' (for reading) and ''put'' (for writing) move the buffer variable to the next element. Read is introduced such that ''read(f, x)'' is the same as ''x := f^; get(f);''. Write is introduced such that ''write(f, x)'' is the same as ''f^ := x; put(f);'' The type {{code|text}} is predefined as file of char. While the buffer variable could be used for inspecting the next character to be used (check for a digit before reading an integer), this leads to serious problems with interactive programs in early implementations, but was solved later with the "lazy I/O" concept, which waits until the file buffer variable is actually accessed before performing file operations. ===Pointer types=== Pascal supports the use of [[pointer (computer programming)|pointer]]s: :<syntaxhighlight lang="pascal"> type pNode = ^Node; Node = record a : integer; b : char; c : pNode end; var NodePtr : pNode; IntPtr : ^integer; </syntaxhighlight> Here the variable ''NodePtr'' is a pointer to the data type ''Node'', a record. Pointers can be used before they are declared. This is a [[forward declaration]], an exception to the rule that things must be declared before they are used. To create a new record and assign the value ''10'' and character ''A'' to the fields ''a'' and ''b'' in the record, and to initialise the pointer ''c'' to the [[null pointer]] ("NIL" in Pascal), the statements would be: :<syntaxhighlight lang="pascal"> new(NodePtr); ... NodePtr^.a := 10; NodePtr^.b := 'A'; NodePtr^.c := nil; ... </syntaxhighlight> This could also be done using the <code>with</code> statement, as follows: <syntaxhighlight lang="pascal"> new(NodePtr); ... with NodePtr^ do begin a := 10; b := 'A'; c := nil end; ... </syntaxhighlight> Inside of the scope of the ''with'' statement, a and b refer to the subfields of the record pointer ''NodePtr'' and not to the record Node or the pointer type pNode. [[Linked list]]s, [[Stack (abstract data type)|stacks]] and [[Queue (abstract data type)|queues]] can be created by including a pointer type field (c) in the record. Unlike many languages that feature pointers, Pascal only allows pointers to reference dynamically created variables that are anonymous, and does not allow them to reference standard static or local variables. Pointers also must have an associated type, and a pointer to one type is not compatible with a pointer to another type (e.g. a pointer to a char is not compatible with a pointer to an integer). This helps eliminate the type security issues inherent with other pointer implementations, particularly those used for [[PL/I]] or [[C (Programming Language)|C]]. It also removes some risks caused by [[dangling pointers]], but the ability to dynamically deallocate referenced space by using the ''dispose'' function (which has the same effect as the ''free'' library function found in [[C (programming language)|C]]) means that the risk of dangling pointers has not been eliminated<ref name="Hoare.Sneeringer.Welsh.1977">J. Welsh, W. J. Sneeringer, and C. A. R. Hoare, "Ambiguities and Insecurities in Pascal", ''Software: Practice and Experience 7'', pp. 685–696 (1977)</ref> as it has in languages such as Java and C#, which provide [[Garbage collection (computer science)|automatic garbage collection]] (but which do not eliminate the related problem of [[memory leak]]s). Some of these restrictions can be lifted in newer dialects. ===Control structures=== Pascal is a [[structured programming]] language, meaning that the flow of control is structured into standard [[Statement (programming)|statements]], usually without '[[goto (command)|goto]]' commands. :<syntaxhighlight lang="pascal"> while a <> b do WriteLn('Waiting'); if a > b then WriteLn('Condition met') {no semicolon allowed before else} else WriteLn('Condition not met'); for i := 1 to 10 do {no semicolon here as it would detach the next statement} WriteLn('Iteration: ', i); repeat a := a + 1 until a = 10; case i of 0 : Write('zero'); 1 : Write('one'); 2 : Write('two'); 3,4,5,6,7,8,9,10: Write('?') end; </syntaxhighlight> ===Procedures and functions=== Pascal structures programs into procedures and functions. Generally, a procedure is used for its side effects, whereas a function is used for its return value. :<syntaxhighlight lang="pascal"> program Printing(output); var i : integer; procedure PrintAnInteger(j : integer); begin ... end; function triple(x: integer): integer; begin triple := x * 3 end; begin { main program } ... PrintAnInteger(i); PrintAnInteger(triple(i)) end. </syntaxhighlight> Procedures and functions can be nested to any depth, and the 'program' construct is the logical outermost block. By default, parameters are passed by value. If 'var' precedes a parameter's name, it is passed by reference. Each procedure or function can have its own declarations of goto labels, constants, types, variables, and other procedures and functions, which must all be in that order. This ordering requirement was originally intended to allow efficient [[single-pass compilation]]. However, in some dialects (such as [[Delphi (software)|Delphi]]) the strict ordering requirement of declaration sections has been relaxed. ===Semicolons as statement separators=== Pascal adopted many language syntax features from the [[ALGOL]] language, including the use of a semicolon as a statement separator. This is in contrast to other languages, such as [[PL/I]] and [[C (programming language)|C]], which use the semicolon as a statement terminator. No semicolon is needed before the <code>end</code> keyword of a record type declaration, a block, or a ''case'' statement; before the <code>until</code> keyword of a repeat statement; and before the <code>else</code> keyword of an ''if'' statement. The presence of an extra semicolon was not permitted in early versions of Pascal. However, the addition of [[ALGOL]]-like empty statements in the 1973 ''Revised Report'' and later changes to the language in ISO 7185:1983 now allow for optional semicolons in most of these cases. A semicolon is still not permitted immediately before the <code>else</code> keyword in an ''if'' statement, because the <code>else</code> follows a single statement, not a statement sequence. In the case of nested ifs, a semicolon cannot be used to avoid the [[dangling else]] problem (where the inner if does not have an else, but the outer if does) by putatively terminating the nested if with a semicolon – this instead terminates both if clauses. Instead, an explicit <code>begin</code>...<code>end</code> block must be used.<ref>''Pascal,'' Nell Dale and Chip Weems, "Dangling Else", [https://books.google.com/books?id=5x2k4vWwn1wC&pg=PA160 p. 160–161] {{webarchive|url=https://web.archive.org/web/20170318223956/https://books.google.com/books?id=5x2k4vWwn1wC&pg=PA160 |date=2017-03-18}}</ref> ==Resources== ===Compilers and interpreters=== Several Pascal compilers and interpreters are available for general use: * [[Delphi (software)|Delphi]] is Embarcadero's (formerly Borland/CodeGear) flagship [[rapid application development]] (RAD) product. It uses the Object Pascal language (termed 'Delphi' by Borland), descended from Pascal, to create applications for [[Microsoft Windows|Windows]], [[macOS]], [[iOS]], and [[Android (operating system)|Android]]. The [[.NET]] support that existed from D8 through D2005, D2006, and D2007 has been terminated, and replaced by a new language (Prism, which is rebranded Oxygene, see below) that is not fully backward compatible. In recent years [[Unicode]] support and [[Generic programming|generics]] were [[Generic programming#In Delphi|added]] (D2009, D2010, Delphi XE). * [[Free Pascal]] is a [[Cross-platform software|cross-platform]] compiler written in [[Object Pascal]] (and is [[Self-hosting (compilers)|self-hosting]]). It is aimed at providing a convenient and powerful compiler, both able to compile legacy applications and to be the means to develop new ones. It is distributed under the [[GNU General Public License]] (GNU GPL), while packages and runtime [[Library (computing)|library]] come under a modified [[GNU Lesser General Public License]] (GNU LGPL). In addition to compatibility modes for [[Turbo Pascal]], Delphi, and Mac Pascal, it has its own procedural and object-oriented syntax modes with support for extended features such as [[operator overloading]]. It supports many platforms and operating systems. Current versions also feature an ISO mode. * [[Turbo51]] is a free Pascal compiler for the [[Intel 8051]] family of microcontrollers, with [[Turbo Pascal]] 7 syntax. * [[Oxygene (programming language)|Oxygene]] (formerly named ''Chrome'') is an Object Pascal compiler for the [[.NET]] and [[Mono (software)|Mono]] platforms. It was created and is sold by [[RemObjects Software]], and sold for a while by Embarcadero as the backend compiler of Prism. * [[Kylix (software)|Kylix]] was a descendant of [[Delphi (software)|Delphi]], with support for the [[Linux]] operating system and an improved object library. It is no longer supported. Compiler and IDE are available now for non-commercial use. * [[GNU Pascal]] Compiler (GPC) is the Pascal compiler of the [[GNU Compiler Collection]] (GCC). The compiler is written in C, the runtime library mostly in Pascal. Distributed under the [[GNU General Public License]], it runs on many platforms and operating systems. It supports the ANSI/ISO standard languages and has partial Turbo Pascal dialect support. One of the more notable omissions is the absence of a fully Turbo Pascal-compatible (short)string type. Support for Borland Delphi and other language variants is quite limited. There is some support for Mac-pascal, however. * [[Virtual Pascal]] was created by Vitaly Miryanov in 1995 as a native OS/2 compiler compatible with Borland Pascal syntax. Then, it had been commercially developed by fPrint, adding Win32 support, and in 2000 it became freeware. Today it can compile for Win32, OS/2, and Linux, and is mostly compatible with Borland Pascal and Delphi. Development was canceled on April 4, 2005. * [[Pascal-P4]] compiler, the basis for many subsequent Pascal-implemented-in-Pascal compilers. It implements a subset of full Pascal. * [[Pascal-P5]] compiler is an ISO 7185 (full Pascal) adaption of Pascal-P4. * Pascal-P6 compiler is an extended version of Pascal adaption of Pascal-P5 according to the Pascaline language specification. * Smart Mobile Studio is a Pascal to [[HTML5]]/[[JavaScript]] compiler * [[Turbo Pascal]] was the dominant Pascal compiler for PCs during the 1980s and early 1990s, popular both because of its powerful extensions and extremely short compilation times. Turbo Pascal was compactly written and could compile, run, and debug all from memory without accessing disk. Slow [[floppy disk drive]]s were common for programmers at the time, further magnifying Turbo Pascal's speed advantage. Currently, older versions of Turbo Pascal (up to 5.5) are available for free download from Borland's site. * [[IP Pascal]] implements the language "Pascaline" (named after [[Pascal's calculator]]), which is a highly extended Pascal compatible with original Pascal according to ISO 7185. It features modules with namespace control, including parallel tasking modules with semaphores, objects, dynamic arrays of any dimensions that are allocated at runtime, overloads, overrides, and many other extensions. IP Pascal has a built-in portability library that is custom tailored to the Pascal language. For example, a standard text output application from 1970's original Pascal can be recompiled to work in a window and even have graphical constructs added. * Pascal-XT was created by [[Siemens]] for their [[mainframe computer|mainframe]] operating systems [[BS2000]] and [[SINIX]]. * PocketStudio is a Pascal subset compiler and RAD tool for [[Palm OS]] and MC68xxx processors with some of its own extensions to assist interfacing with the Palm OS [[application programming interface|API]]. It resembles Delphi and Lazarus with a visual form designer, an object inspector and a [[source code editor]]. * MIDletPascal – A Pascal compiler and IDE that generates small and fast Java bytecode specifically designed to create software for mobiles. * Vector Pascal is a language for [[SIMD]] instruction sets such as the [[MMX (instruction set)|MMX]] and the [[AMD]] [[3DNow!|3d Now]], supporting all [[Intel]] and AMD processors, and [[Sony]]'s [[PlayStation 2]] [[Emotion Engine]]. * Morfik Pascal allows the development of [[Web application]]s entirely written in Object Pascal (both server and browser side). * WDSibyl – Visual Development Environment and Pascal compiler for Win32 and OS/2. * PP Compiler, a compiler for Palm OS that runs directly on the handheld computer. * CDC 6000 Pascal compiler is the source code for the first (CDC 6000) Pascal compiler. * {{anchor|[[Pascal-S]]}}Pascal-S<ref>"Pascal-S: A Subset and Its Implementation", N. Wirth in Pascal – The Language and Its Implementation, by D.W. Barron, Wiley 1979.</ref> * AmigaPascal is a free Pascal compiler for [[Amiga]] systems. * VSI Pascal for OpenVMS (formerly HP Pascal for OpenVMS, Compaq Pascal, DEC Pascal, VAX Pascal and originally VAX-11 Pascal<ref>{{Cite web|url=http://www.bitsavers.org/pdf/dec/vax/lang/pascal/AA-H485A-TE_VAX-11_PASCAL_V1.0_Users_Guide_Nov79.pdf|title=VAX-11 Pascal V1.0 User's Guide}}</ref>) is a Pascal compiler that runs on [[OpenVMS]] systems.<ref name="vsi-spd" /> It was also supported under [[Tru64]].<ref>{{cite web|url=http://www.pascal-central.com/interview1.html|title=Interview with a Pascal Architect - Compaq Pascal|access-date=2022-05-28|archive-date=2021-10-19|archive-url=https://web.archive.org/web/20211019203732/http://pascal-central.com/interview1.html|url-status=dead}}</ref><ref>{{cite web|url=http://h30266.www3.hpe.com/masterindex/spd/spd_00049c78.txt|title=Compaq Pascal Version 5.8 for Tru64 UNIX Software Product Description|access-date=2022-05-28|archive-date=2020-07-25|archive-url=https://web.archive.org/web/20200725235351/http://h30266.www3.hpe.com/masterindex/spd/spd_00049c78.txt|url-status=dead}}</ref> VSI Pascal for OpenVMS is compatible with ISO/IEC 7185:1990 Pascal as well some of ISO/IEC 10206:1990 Extended Pascal, and also includes its own extensions.<ref name="vsi-spd">{{cite web|url=https://vmssoftware.com/docs/VSI_Pascal_spd.pdf|title=VSI Pascal for OpenVMS Software Product Description|publisher=VSI|date=2017|access-date=2022-02-07|archive-date=2021-04-18|archive-url=https://web.archive.org/web/20210418211644/https://vmssoftware.com/docs/VSI_Pascal_spd.pdf|url-status=dead}}</ref> The compiler [[Compiler#Front end|frontend]] is implemented in [[BLISS]].<ref name="ecube">{{cite web|url=http://blog.ecubesystems.com/vsis-john-reagan-interview-on-llvm/|archive-url=https://web.archive.org/web/20200812025318/http://blog.ecubesystems.com/vsis-john-reagan-interview-on-llvm/|title=VSI's John Reagan Interview on GEM vs. LLVM for X86/64|website=eCube Systems|date=2019-03-12|archive-date=2020-08-12|access-date=2022-02-07}}</ref> * Stony Brook Pascal+ was a 16-bit (later 32-bit) optimizing compiler for DOS and OS/2, marketed as a direct replacement for Turbo Pascal, but producing code that executed at least twice as fast. ===IDEs=== * [[Dev-Pascal]] is a Pascal [[integrated development environment|IDE]] that was designed in Borland [[Object Pascal|Delphi]] and which supports Free Pascal and GNU Pascal as backends. * [[Lazarus (software)|Lazarus]] is a free Delphi-like visual cross-platform IDE for [[rapid application development]] (RAD). Based on [[Free Pascal]], Lazarus is available for numerous platforms including [[Linux]], [[FreeBSD]], [[macOS]] and [[Microsoft Windows]]. * Fire (macOS) and Water (Windows) for the [[Oxygene (programming language)|Oxygene]] and the Elements Compiler ===Libraries=== *WOL Library for creating GUI applications with the Free Pascal Compiler. ==Standards== ===ISO/IEC 7185:1990 Pascal=== In 1983, the language was standardized in the international standard IEC/ISO 7185<ref>{{cite book|title=ISO/IEC 7185:1990 Pascal|url=http://www.pascal-central.com/docs/iso7185.pdf|access-date=16 September 2014|url-status=dead|archive-url=https://web.archive.org/web/20160127044422/http://pascal-central.com/docs/iso7185.pdf|archive-date=27 January 2016}}</ref> and several local country-specific standards, including the American ANSI/IEEE770X3.97-1983, and ISO 7185:1983. These two standards differed only in that the ISO standard included a "level 1" extension for conformant arrays (an array where the boundaries of the array are not known until run time), where ANSI did not allow for this extension to the original (Wirth version) language. In 1989, ISO 7185 was revised (ISO 7185:1990) to correct various errors and ambiguities found in the original document. The ISO 7185 was stated to be a clarification of Wirth's 1974 language as detailed by the User Manual and Report [Jensen and Wirth], but was also notable for adding "Conformant Array Parameters" as a level 1 to the standard, level 0 being Pascal without conformant arrays. This addition was made at the request of [[C. A. R. Hoare]], and with the approval of Niklaus Wirth. The precipitating cause was that Hoare wanted to create a Pascal version of the [[NAG Numerical Libraries|(NAG) Numerical Algorithms Library]], which had originally been written in FORTRAN, and found that it was not possible to do so without an extension that would allow array parameters of varying size. Similar considerations motivated the inclusion in ISO 7185 of the facility to specify the parameter types of procedural and functional parameters. Niklaus Wirth himself referred to the 1974 language as "the Standard", for example, to differentiate it from the machine specific features of the [[CDC 6000]] compiler. This language was documented in ''The Pascal Report'',<ref>{{cite book|last1=Wirth|first1=Niklaus|title=The Programming Language Pascal (Revised Report)|date=July 1973|publisher=ETH Zürich|doi=10.3929/ethz-a-000814158}}</ref> the second part of the "Pascal users manual and report". On the large machines (mainframes and minicomputers) Pascal originated on, the standards were generally followed. On the [[IBM Personal Computer|IBM PC]], they were not. On IBM PCs, the Borland standards Turbo Pascal and Delphi have the greatest number of users. Thus, it is typically important to understand whether a particular implementation corresponds to the original Pascal language, or a Borland dialect of it. The IBM PC versions of the language began to differ with the advent of UCSD Pascal, an interpreted implementation that featured several extensions to the language, along with several omissions and changes. Many UCSD language features survive today, including in Borland's dialect. ===ISO/IEC 10206:1990 Extended Pascal=== {{Expand section|date=February 2018}} In 1990, an extended Pascal standard was created as ISO/IEC 10206,<ref>{{cite book|title=Extended Pascal: ISO/IEC 10206:1990|url=http://www.dcs.gla.ac.uk/~wpc/reports/compilers/compilerindex/iso10206.ps|access-date=16 September 2014|url-status=dead|archive-url=https://web.archive.org/web/20160327025949/http://www.dcs.gla.ac.uk/%7Ewpc/reports/compilers/compilerindex/iso10206.ps|archive-date=2016-03-27}}</ref> which is identical in technical content<ref name="ISO/ANSI identical">{{cite web|title=Language standards: Pascal, Extended Pascal, Fortan|url=http://www.prosperosoftware.com/std.html|access-date=16 September 2014|ref=identical|archive-url=https://web.archive.org/web/20140714024231/http://www.prosperosoftware.com/std.html|archive-date=2014-07-14|url-status=dead}}</ref> to IEEE/ANSI 770X3.160-1989<ref>{{cite book|doi=10.1109/IEEESTD.1990.101061|isbn=978-0-7381-4247-0|date=1990 |title=IEEE/ANSI Standard for the Programming Language Extended Pascal}}</ref> As of 2019, Support of Extended Pascal in [[FreePascal]] Compiler is planned.<ref>{{Cite web|url=https://wiki.freepascal.org/Extended_Pascal|title=Extended Pascal - Free Pascal wiki|website=wiki.freepascal.org}}</ref> <!-- WHAT FOLLOW APPEARS FACTUALLY WRONG AND IS COMMENTED OUT FOR FUTURE REFERENCE In 1993, the ANSI standard was replaced by the ANSI organization with a "pointer" to the ISO 7185:1990 standard, effectively ending its status as a different standard. --> ===Variations=== Niklaus Wirth's Zürich version of Pascal was issued outside [[ETH Zürich|ETH]] in two basic forms: the CDC 6000 compiler source, and a porting kit called Pascal-P system. The Pascal-P compiler left out several features of the full language that were not required to bootstrap the compiler. For example, procedures and functions used as parameters, undiscriminated variant records, packing, dispose, interprocedural gotos and other features of the full compiler were omitted. [[UCSD Pascal]], under Professor [[Kenneth Bowles]], was based on the Pascal-P2 kit, and consequently shared several of the Pascal-P language restrictions. UCSD Pascal was later adopted as Apple Pascal, and continued through several versions there. Although UCSD Pascal actually expanded the subset Pascal in the Pascal-P kit by adding back standard Pascal constructs, it was still not a complete standard installation of Pascal. In the early 1990s, [[Alan Burns (professor)|Alan Burns]] and Geoff Davies developed Pascal-FC, an extension to Pl/0 (from the Niklaus' book ''Algorithms + Data Structures = Programs''). Several constructs were added to use Pascal-FC as a teaching tool for Concurrent Programming (such as semaphores, monitors, channels, remote-invocation and resources). To be able to demonstrate concurrency, the compiler output (a kind of [[p-code machine|P-code]]) could then be executed on a virtual machine. This virtual machine not only simulated a normal – fair – environment, but could also simulate extreme conditions (unfair mode). ====Borland-like Pascal compilers==== [[Borland]]'s [[Turbo Pascal]], written by [[Anders Hejlsberg]], was written in assembly language independent of UCSD and the Zürich compilers. However, it adopted much of the same subset and extensions as the UCSD compiler. This is probably because the UCSD system was the most common Pascal system suitable for developing applications on the resource-limited microprocessor systems available at that time. The [[shrink-wrapped]] Turbo Pascal version 3 and later incarnations, including Borland's [[Object Pascal]] and [[Delphi (software)|Delphi]] and non-Borland near-compatibles became popular with programmers including shareware authors, and so the SWAG library of Pascal code features a large amount of code written with such versions as Delphi in mind. Software products ([[compiler]]s, and IDE/[[Rapid Application Development]] (RAD)) in this category: * [[Turbo Pascal]] – "TURBO.EXE" up to version 7, and Turbo Pascal for Windows ("TPW") and [[Turbo Pascal#Apple Macintosh|Turbo Pascal for Macintosh]]. * Pure Pascal and HiSPeed Pascal 2 Pascal language Environment for the [[Atari ST]] range of computers. * [[Turbo Pascal|Borland Pascal 7]] – A professional version of Turbo Pascal line which targeted both DOS and Windows. * [[Object Pascal]] – an extension of the Pascal language that was developed at [[Apple Computer]] by a team led by [[Larry Tesler]] in consultation with [[Niklaus Wirth]], the inventor of Pascal; its features were added to Borland's [[Turbo Pascal#Apple Macintosh|Turbo Pascal for Macintosh]] and in 1989 for Turbo Pascal 5.5 for DOS. * [[Delphi (software)|Delphi]] – Object Pascal is essentially its underlying language. * [[Free Pascal]] compiler (FPC) – Free Pascal adopted the standard dialect of Borland Pascal programmers, Borland Turbo Pascal and, later, Delphi. * [[PascalABC.NET]] – a new generation Pascal programming language including compiler and IDE. * [[Kylix (software)|Borland Kylix]] is a compiler and IDE formerly sold by Borland, but later discontinued. It is a [[Linux]] version of the [[Delphi (software)|Borland Delphi]] software development environment and [[C++Builder]]. * [[Lazarus (IDE)|Lazarus]] – similar to Kylix in function, is a free cross-platform visual IDE for RAD using the Free Pascal compiler, which supports dialects of [[Object Pascal]] to varying degrees. * [[Virtual Pascal]] – VP2/1 is a fully Borland Pascal– and Borland Delphi–compatible 32-bit Pascal compiler for OS/2 and Windows 32 (with a Linux version "on the way").<ref>{{cite web |title=Virtual Pascal for OS/2 |url=http://www.pascal-central.com/vpascal.html |access-date=3 April 2016 |url-status=dead |archive-url=https://web.archive.org/web/20110830023208/http://pascal-central.com/vpascal.html |archive-date=30 August 2011 }}</ref> * Sybil is an open source Delphi-like IDE and compiler; implementations include: ** WDSibyl<ref>{{cite web |url=http://www.wdsibyl.org/ |title=WDSibyl: Visual Development Environment |author=Wolfgang |date=October 15, 2020 |website=WDSibyl.org |access-date=2020-04-20 |url-status=live |archive-url=https://web.archive.org/web/20200212174135/https://www.wdsibyl.org/ |archive-date=2020-02-12}}</ref> for [[Microsoft Windows]] and [[OS/2]], a commercial Borland Pascal compatible environment released by a company named Speedsoft that was later developed into a Delphi-like [[rapid application development]] (RAD) environment named Sybil and then open sourced under the GPL when that company closed down; ** Open Sybil, which is an ongoing project, an [[Open-source software|open source]] tool for OS/2 and eCS that was originally based on Speedsoft's WDsybl Sibyl Portable Component Classes (SPCC) and Sibyl Visual Development Tool (SVDE) sources, but now its core is [[IBM System Object Model]] (SOM), WPS and [[OpenDoc]].<ref>{{cite web |title=netlabs.org – Project: Open Sibyl |url=http://sibyl.netlabs.org/en/site/index.xml |access-date=3 April 2016 |url-status=dead |archive-url=https://web.archive.org/web/20160304132432/http://sibyl.netlabs.org/en/site/index.xml |archive-date=4 March 2016}}</ref> ===List of related standards=== * [[International Organization for Standardization|ISO]] 8651-2:1988 ''Information processing systems – Computer graphics – Graphical Kernel System (GKS) language bindings – Part 2: Pascal'' ==Reception== Pascal generated a wide variety of responses in the computing community, both critical and complimentary. ===Early criticism=== Wirth's initial definition of the language was widely criticized. In particular, [[Nico Habermann]] commented in his "Critical Comments on the Programming Language Pascal" (1973) that many of its constructs were poorly defined, in particular for [[Data type|data types]], [[Range (computer programming)|ranges]], [[Record (computer science)|structures]], and [[goto]].<ref>{{Cite journal |last=Habermann |first=A. N. |date=1973 |title=Critical comments on the programming language Pascal |url=http://dx.doi.org/10.1007/bf00288652 |journal=Acta Informatica |volume=3 |issue=1 |pages=47–57 |doi=10.1007/bf00288652 |issn=0001-5903}} ([https://kilthub.cmu.edu/articles/Critical_comments_on_the_programming_language_PASCAL/6604568/files/12094973.pdf full text of technical report])</ref> Later, [[Brian Kernighan]], who popularized the [[C (programming language)|C language]], outlined his criticisms of Pascal in 1981 in his article "Why Pascal is Not My Favorite Programming Language".<ref>Brian W. Kernighan (1981). [http://www.lysator.liu.se/c/bwk-on-pascal.html "Why Pascal is Not My Favorite Programming Language"]. {{webarchive |url=https://web.archive.org/web/20090428163341/https://www.princeton.edu/~mike/unixhistory |date=2009-04-28}}</ref> The most serious problem Kernighan described was that array sizes and string lengths were part of the type, so it was not possible to write a function that would accept variable-length arrays or even strings as parameters. This made it unfeasible to write, for example, a sorting library. Kernighan also criticized the unpredictable order of evaluation of Boolean expressions, poor library support, and lack of [[static variable]]s, and raised a number of smaller issues. Also, he stated that the language did not provide any simple constructs to "escape" (knowingly and forcibly ignore) restrictions and limitations. More general complaints from other sources<ref name="Hoare.Sneeringer.Welsh.1977"/><ref>{{cite journal |last1=Lecarme |first1=O. |last2=Desjardins |first2=P. |title=More comments on the programming language Pascal |journal=Acta Informatica |date=1975 |volume=4 |issue=3 |pages=231–243 |doi=10.1007/BF00288728}}</ref> noted that the scope of declarations was not clearly defined in the original language definition, which sometimes had serious consequences when using [[forward declaration]]s to define pointer types, or when record declarations led to [[Recursive data type|mutual recursion]], or when an identifier may or may not have been used in an enumeration list. Another difficulty was that, like [[ALGOL 60]], the language did not allow procedures or functions passed as parameters to predefine the expected type of their parameters. ===Rising popularity in the 1970s and 1980s=== In the two decades after 1975, Pascal gained increasing attention and became a major programming language for important platforms (including Apple II, Apple III, Apple Lisa, Commodore systems, Z-80-based machines and IBM PC) due to the availability of UCSD Pascal and Turbo Pascal.<ref>{{cite web |last1=Crespo |first1=Diego |title=Pascal: The language that almost took over the world part 1 |url=https://www.deusinmachina.net/p/pascal-the-language-that-almost-took?utm_source=publication-search |website=www.deusinmachina.net |access-date=4 January 2025 |language=en}}</ref> Despite initial criticisms, Pascal continued to evolve, and most of Kernighan's points do not apply to versions of the language which were enhanced to be suitable for commercial product development, such as Borland's [[Turbo Pascal]]. As Kernighan predicted in his article, most of the extensions to fix these issues were incompatible from compiler to compiler. Since the early 1990s, however, most of the varieties seem condensed into two categories: ISO and Borland-like. Extended Pascal addresses many of these early criticisms. It supports variable-length strings, variable initialization, separate compilation, short-circuit Boolean operators, and default (<code>otherwise</code>) clauses for case statements.<ref>{{Cite web |url=http://pascal-central.com/ppl/chapter3.html#Extended |title=Extended Pascal |url-status=dead |archive-url=https://web.archive.org/web/20151018023934/http://www.pascal-central.com/ppl/chapter3.html |archive-date=2015-10-18 |access-date=2015-10-17 }}</ref> Some of the problems arising from the differences in the implementations of Pascal were later partly solved by the advent of Free Pascal, which supports several dialects with mode directives.<ref>{{cite web |last1=Crespo |first1=Diego |title=Pascal: The language that almost took over the world part 2 |url=https://www.deusinmachina.net/p/pascal-the-language-that-almost-took-56a?utm_source=publication-search |website=www.deusinmachina.net |access-date=4 January 2025 |language=en}}</ref> ==Notes== {{notelist}} ==See also== {{Portal|Computer programming}} * [[Ada (programming language)]] * [[Concurrent Pascal]] * [[Comparison of Pascal and Delphi]] * [[Comparison of Pascal and C]] * [[Modula-2]] * [[Oberon (programming language)]] * [[Object Pascal]] * [[PascalCase]] * [[Standard ML]] ==References== {{Reflist|30em}} ==Further reading== {{Commons category}} {{Wikibooks|Pascal}} * Niklaus Wirth: ''The Programming Language Pascal''. 35–63, Acta Informatica, Volume 1, 1971. * 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. * N. Wirth, and A. I. Wasserman, ed: ''Programming Language Design''. IEEE Computer Society Press, 1980 * D. W. Barron (Ed.): ''Pascal – The Language and its Implementation''. John Wiley 1981, {{ISBN|0-471-27835-1}} * Peter Grogono: ''Programming in Pascal'', Revised Edition, Addison-Wesley, 1980 * Richard S. Forsyth: ''Pascal in Work and Play'', Chapman and Hall, 1982 * N. Wirth, M. Broy, ed, and E. Denert, ed: [http://www.swissdelphicenter.ch/en/niklauswirth.php ''Pascal and its Successors''] in ''Software Pioneers: Contributions to Software Engineering.'' Springer-Verlag, 2002, {{ISBN|3-540-43081-4}} * N. Wirth: [http://portal.acm.org/citation.cfm?id=155378 ''Recollections about the Development of Pascal''.] ACM SIGPLAN Notices, Volume 28, No 3, March 1993. {{Pascal programming language family}} {{Wirth}} {{ISO standards}} {{Programming languages}} {{Authority control}} {{Portal bar|Computer programming}} [[Category:Pascal (programming language)| ]] [[Category:Academic programming languages]] [[Category:Systems programming languages]] [[Category:Educational programming languages]] [[Category:High-level programming languages]] [[Category:Programming languages created in 1970]] [[Category:Programming languages with an ISO standard]] [[Category:1970 software]] <!-- Hidden categories below --> [[Category:Articles with example Pascal code]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Anchor
(
edit
)
Template:Authority control
(
edit
)
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite report
(
edit
)
Template:Cite web
(
edit
)
Template:Code
(
edit
)
Template:Commons category
(
edit
)
Template:Dead link
(
edit
)
Template:Efn
(
edit
)
Template:Expand section
(
edit
)
Template:ISBN
(
edit
)
Template:ISO standards
(
edit
)
Template:Infobox programming language
(
edit
)
Template:Notelist
(
edit
)
Template:Other uses
(
edit
)
Template:Pascal programming language family
(
edit
)
Template:Portal
(
edit
)
Template:Portal bar
(
edit
)
Template:Programming languages
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Sister project
(
edit
)
Template:Webarchive
(
edit
)
Template:Wikibooks
(
edit
)
Template:Wirth
(
edit
)