1 / 21

PASCAL

PASCAL . HISTORY OF PASCAL. Developed by Niklaus Wirth a member of the International Federation of Information Processing(IFIP) To provide features that were lacking in other languages of the time

dionne
Download Presentation

PASCAL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PASCAL

  2. HISTORY OF PASCAL Developed by Niklaus Wirth a member of the International Federation of Information Processing(IFIP) To provide features that were lacking in other languages of the time Pascal was named after the mathmaticianBlaisePasca , descendent from ALGOL 60 which Wirth helped develop. Pascal draws programming components from ALGOL 68, ALGOL –W. Original Published definition for the Pascal language appeared in 1971 with latter revisions published in 1973. Designed to teach programming techniques and topics to college students from the late 1960’s to the late 1980’s.

  3. TURBO PASCAL • Is a software development system that includes a compiler and an Integrated Development Environment(IDE) for the Pascal programming language running MS-DOS . • Developed by Borland while the original cheap and widely known version was sold as TURBO PASCAL. • Borland released three old versions of Turbo Pascal free of charge because of their historical interest versions 1.0, 3.02, 5.5 for MS-DOS , Macintosh

  4. Brief Description • Wirth’s intention was to create an efficient language(regarding both compilation speed and generated code) based on structured programming. • Pascal has important features included records, enumerations, subranges, dynamically allocated variables with associated pointers, and sets. • Pascal has a strong typing on all objects – meaning that one type of data cannot be converted or interpreted as another without explicit conversion • Other Languages that influenced Pascal’s development were COBOL, SIMULA 67, ALGOL-W • Pascal like many programming languages allows nested procedure definitions to any level of depth, allows most kinds of definitions and declaration inside procedures and functions.

  5. Implementations • The first Pascal compiler was designed in Zurich for the CDC 6000 seriesmainframe computer family. Niklaus Wirth reports that a first attempt to implement it in Fortran in 1969 was unsuccessful due to Fortran's inadequacy to express complex data structures. • The second attempt was formulated in the Pascal language itself and was operational by mid-1970. Many Pascal compilers since have been similarly 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 ported to a new environment. The GNU Pascal compiler is one notable exception, being written in C.

  6. Language Constructs • Included the traditional array of Algol like control structures with reserved words such as if,then,else,while, for. • Hello World Program ProgramHelloWorld(output); begin writeln('Hello, world!') end.

  7. Data Types

  8. Scalar Types • Pascal's scalar types are real, integer, character, boolean and enumerations, a new type constructor introduced with Pascal:

  9. Subrange Types • Subranges of any ordinal type (any simple type except real) can be made:

  10. Set Types • A set is a fundamental concept for modern mathematics, and they may be used in a great many algorithms. Such a feature is highly useful and may be faster than an equivalent construct in a language that does not support sets. For example, for many Pascal compilers: ifiin [5..10] then executes faster than if(i>4) and (i<11) then

  11. Type Declarations • Types can be defined from other types using type declarations: type x = Integer; y = x; ... • Further, complex types can be constructed from simple types: type a = Array [1..10] ofInteger; b = record x: Integer; y: Char end; c = Fileof a;

  12. File Type • As shown in the example above, Pascalfiles 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 text is predefined as file of char. While the buffer variable could be used to inspect the next character that would be used (check for a digit before reading an integer), this concept lead to serious problems with interactive programs with early implementations, but was solved later with the "lazy I/O" concept. • In Jensen & Wirth Pascal, strings are represented as packed arrays of chars; they therefore have fixed length and are usually space-padded. Some dialects have a custom string type.

  13. Pointer Types • Pascal supports the use of pointers: type a = ^b; b = record a: Integer; b: Char; c: a end; var pointertob: a;

  14. Control Structures • Pascal is a structured programming language, meaning that the flow of control is structured into standard statements, ideally without 'go to' commands.

  15. Procedures and Functions • Procedures and functions can nest to any depth, and the 'program' construct is the logical outermost block. • 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 the strict ordering requirement of declaration sections is not required.

  16. Semicolon as Statement Separators • Pascal adopted many language syntax features from the ALGOL language, including the use of a semicolon as a statement separator. no semicolon is needed before the end keyword of a record type declaration, a block, or a case statement; before theuntil keyword of a repeat statement; and before the else keyword of an if statement. (* skip blanks *)whileGetChar() = ' ' do; ifalarm then; begin; SendMayday; EjectPilot; end;

  17. Compilers and Interpreters • Delphi is CodeGear's (formerly Borland) flagship RAD (Rapid Application Development) product. • Free Pascal is a multi-platform compiler written in Pascal (it is Self-hosting). It is aimed at providing a convenient and powerful compiler, both able to compile legacy applications and to be the means of developing new ones. • Lazarus is a Delphi-like visual cross-platform IDE for RAD (Rapid Application Development). Based on FreePascal, Lazarus is available for numerous platforms including Linux, FreeBSD, Mac OS XandMicrosoft Windows. • Pascal (programming language) - Wikipedia, the free encyclopedia

  18. Object Pascal • Branch of object-oriented derivatives of Pascal mostly known as the primary programming language of Delphi • Pascal compilers run very fast while producing highly optimized code

More Related