We are still actively working on the spam issue.

Difference between revisions of "Pascal"

From InstallGentoo Wiki
Jump to: navigation, search
m (Installation)
m (Added links)
 
(6 intermediate revisions by 3 users not shown)
Line 4: Line 4:
 
Pascal was originally designed by Dr. Niklaus Wirth, and was first published in 1970. It began as an extension to ALGOL, a programming language which Dr. Wirth had also helped to design. The language is named after the famous 17th-century French mathematician and philosopher Blaise Pascal.
 
Pascal was originally designed by Dr. Niklaus Wirth, and was first published in 1970. It began as an extension to ALGOL, a programming language which Dr. Wirth had also helped to design. The language is named after the famous 17th-century French mathematician and philosopher Blaise Pascal.
  
In the 1970's and 80's, Pascal became very popular, particularly in the academic field. However, its popularity started to wane when many universities and businesses began using the newly created UNIX operating system, which was programmed in the C language. Many university classes and other users switched from Pascal to C to take advantage of the new system. Another major user of Pascal, Apple, would also eventually switch to C and Objective-C.
+
In the 1970's and 80's, Pascal became very popular, particularly in the academic field. However, its popularity started to wane when many universities and businesses began using the newly created [[UNIX]] operating system, which was programmed in the [[C]] language. Many university classes and other users switched from Pascal to [[C]] to take advantage of the new system. Another major user of Pascal, [[Apple Inc.|Apple]], would also eventually switch to [[C]] and [[Objective-C]].
  
 
The Pascal language has been extended many times by different groups. [http://edn.embarcadero.com/article/20803 Borland Turbo Pascal] is among the better known extensions, featuring one of the fastest compilers for PCs at the time. Turbo Pascal also popularized the usage of object oriented programming in the Pascal language.
 
The Pascal language has been extended many times by different groups. [http://edn.embarcadero.com/article/20803 Borland Turbo Pascal] is among the better known extensions, featuring one of the fastest compilers for PCs at the time. Turbo Pascal also popularized the usage of object oriented programming in the Pascal language.
Line 22: Line 22:
  
 
== Installation ==
 
== Installation ==
 +
=== Compiler ===
 
Free Pascal is probably the easiest to install and use, with or without the Lazarus IDE. You can find an easy installer for most platforms at the [http://sourceforge.net/projects/freepascal/files/ Free Pascal SourceForge page]. You can also install it through your GNU/Linux or BSD package manager.
 
Free Pascal is probably the easiest to install and use, with or without the Lazarus IDE. You can find an easy installer for most platforms at the [http://sourceforge.net/projects/freepascal/files/ Free Pascal SourceForge page]. You can also install it through your GNU/Linux or BSD package manager.
  
 
After the compiler is installed, you can type <code>fpc myprogram.pas</code> in your terminal to compile the source file <code>myprogram.pas</code>. By default, the resulting binary would be called <code>myprogram</code> (or <code>myprogram.exe</code> on Windows). Then you can run the program by typing <code>./myprogram</code> (or simply <code>myprogram</code> on Windows).
 
After the compiler is installed, you can type <code>fpc myprogram.pas</code> in your terminal to compile the source file <code>myprogram.pas</code>. By default, the resulting binary would be called <code>myprogram</code> (or <code>myprogram.exe</code> on Windows). Then you can run the program by typing <code>./myprogram</code> (or simply <code>myprogram</code> on Windows).
 +
 +
=== Package Manager ===
 +
 +
The Free Pascal installation also includes the [http://wiki.freepascal.org/fppkg fppkg] package manager. You can use it to install extra libraries not included as part of the standard installation (such as the [http://fpgui.sourceforge.net/ fpGUI] framework)
 +
 +
== Tutorial ==
 +
The following tutorial covers concepts mostly universal among Pascal dialects:
 +
 +
[http://www.taoyue.com/tutorials/pascal/ Pascal Tutorial]
 +
 +
An edited version of this tutorial for Free Pascal, which adds lessons on concepts specific to Object Pascal and object-oriented programming, is hosted at the project's wiki:
 +
 +
[http://wiki.freepascal.org/Object_Pascal_Tutorial Object Pascal Tutorial]
 +
 +
If you prefer printed materials or more traditionally formatted learning resources, a list of [[Programming_Books#Pascal|Pascal Books]] is available on this wiki.
  
 
== Examples ==
 
== Examples ==
Line 65: Line 81:
  
 
== Further reading ==
 
== Further reading ==
[[Programming_Books#Pascal|Pascal Books]]
+
* [[Programming_Books#Pascal|Pascal books]] <!-- This could be a template -->
 
+
* [[Wikipedia:Pascal_%28programming_language%29]]
[http://en.wikipedia.org/wiki/Pascal_%28programming_language%29 Wikipedia article on Pascal]
+
* [http://pascal-central.com/docs/iso7185.pdf ISO-7185 Standard Pascal]
 
+
* [http://pascal-central.com/docs/iso10206.pdf ISO-10206 Extended Pascal]
[http://pascal-central.com/docs/iso7185.pdf ISO-7185 Standard Pascal]
 
 
 
[http://pascal-central.com/docs/iso10206.pdf ISO-10206 Extended Pascal]
 
 
 
[http://wiki.freepascal.org/Object_Pascal_Tutorial Free Pascal Tutorial]
 
  
  
 
[[Category:Programming languages]]
 
[[Category:Programming languages]]
 +
[[Category:Terms]]

Latest revision as of 13:35, 21 February 2020

Pascal.png

Pascal is a highly-structured, strongly-typed programming language.

Pascal was originally designed by Dr. Niklaus Wirth, and was first published in 1970. It began as an extension to ALGOL, a programming language which Dr. Wirth had also helped to design. The language is named after the famous 17th-century French mathematician and philosopher Blaise Pascal.

In the 1970's and 80's, Pascal became very popular, particularly in the academic field. However, its popularity started to wane when many universities and businesses began using the newly created UNIX operating system, which was programmed in the C language. Many university classes and other users switched from Pascal to C to take advantage of the new system. Another major user of Pascal, Apple, would also eventually switch to C and Objective-C.

The Pascal language has been extended many times by different groups. Borland Turbo Pascal is among the better known extensions, featuring one of the fastest compilers for PCs at the time. Turbo Pascal also popularized the usage of object oriented programming in the Pascal language.

Modern implementations

Delphi

Embarcadero Delphi is a proprietary IDE which uses a dialect of Object Pascal, a much more developed object oriented dialect than that used in Borland Turbo Pascal.

Free Pascal

Free Pascal is a free and open source implementation which supports a wide variety of platforms. It features its own Object Pascal dialect similar to that of Delphi, as well as Delphi, Turbo, and Mac Pascal compatibility. The project also develops two IDEs: the text-based FreeVision IDE, and the Delphi-like Lazarus IDE.

GNU Pascal

GNU Pascal is another free and open source Pascal implementation, maintained as part of the GNU project and built upon GCC. It focuses more on supporting the ISO Pascal standards, with several features from ISO Standard and Extended Pascal which other modern Pascal dialects like Free Pascal and Delphi do not support.

The Dev-Pascal IDE supports the GNU Pascal dialect.

Installation

Compiler

Free Pascal is probably the easiest to install and use, with or without the Lazarus IDE. You can find an easy installer for most platforms at the Free Pascal SourceForge page. You can also install it through your GNU/Linux or BSD package manager.

After the compiler is installed, you can type fpc myprogram.pas in your terminal to compile the source file myprogram.pas. By default, the resulting binary would be called myprogram (or myprogram.exe on Windows). Then you can run the program by typing ./myprogram (or simply myprogram on Windows).

Package Manager

The Free Pascal installation also includes the fppkg package manager. You can use it to install extra libraries not included as part of the standard installation (such as the fpGUI framework)

Tutorial

The following tutorial covers concepts mostly universal among Pascal dialects:

Pascal Tutorial

An edited version of this tutorial for Free Pascal, which adds lessons on concepts specific to Object Pascal and object-oriented programming, is hosted at the project's wiki:

Object Pascal Tutorial

If you prefer printed materials or more traditionally formatted learning resources, a list of Pascal Books is available on this wiki.

Examples

Hello World

program Hello;
begin
  Writeln('Hello World!')
end.

Bottles of Beer

program BottlesOfBeer;

function Count(Bottles: Integer): string;
begin
  case Bottles of
    0: Count := 'No more bottles';
    1: Count := '1 bottle';
  else
    WriteStr(Count, Bottles, ' bottles')
  end
end;

var
  Bottles: Integer;
begin
  for Bottles := 99 downto 1 do
  begin
    Writeln(Count(Bottles), ' of beer on the wall');
    Writeln(Count(Bottles), ' of beer');
    Writeln('Take one down, pass it around');
    Writeln(Count(Bottles - 1), ' of beer on the wall');
    Writeln
  end
end.

Further reading