Sabtu, 17 Januari 2009

Pascal

Pascal Programming Language

Pascal is an influential imperative and procedural programming language, designed in 1968/9 and published in 1970 by Niklaus Wirth as a small and efficient language intended to encourage good programming practices using structured programming and data structuring.


History

Pascal is based on the ALGOL programming language and named in honor of the French mathematician and philosopher Blaise Pascal. Wirth subsequently developed the Modula-2 and Oberon, languages similar to Pascal. Before, and leading up to Pascal, Wirth developed the language Euler, followed by Algol-W.

Initially, Pascal was largely, but not exclusively, intended to teach students structured programming. Generations of students have "cut their teeth" on Pascal as an introductory language in undergraduate courses. Variants of Pascal have also frequently been used for everything from research projects to PC games and embedded systems. Newer Pascal compilers exist which are widely used.

Pascal was the primary high-level language used for development in the Apple Lisa, and in the early years of the Mac; parts of the original Macintosh operating system were hand-translated into Motorola 68000 assembly language from the Pascal sources. The popular typesetting system TeX by Donald E. Knuth was written in WEB, the original literate programming system, based on DEC PDP-10 Pascal, while an application like Total Commander was written in Delphi (i.e. Object Pascal).

Areas of use

Pascal is used to develop applications in a number of different areas. Some of them are listed below:

* Accounting
* Business
* Commerce
* Education
* Law
* Medicine
* Research
* Science


The Advantages

-Debugging is easier. If the procedure is well written, it will do one and only one thing, making it easier to check
-Lower maintenance cost. If you have the same code spread along your code, you have to remember where it is located and fix or at least cut and paste it several times
-You can reuse the code. For example, you may place your procedures in a library and later use it in another program.
-Greater understanding. Since the procedure is well defined and documented, someone interested won't have to scroll through the whole source in order to find the code he/she wants
-Easier tuning. Performance usually comes from changing small pieces of code. With procedures these pieces are naturally separated and side-effects from changing variables or code are less likely to happen.

The Disadvantages
-Not as popular as C – so not as many compilers.
-A bit wordy – it was originally intended as a teaching language.
-Not as flexible as C.


The Syntax

while a <> b do writeln('Waiting');



if a > b then writeln('Condition met')

else writeln('Condition not met');



for i := 1 to 10 do writeln('Iteration: ', i:1);



repeat

a := a + 1

until a = 10;



case i of

0: write('zero');

1: write('one');

2: write('two')

end;

Tidak ada komentar:

Posting Komentar