60 likes | 213 Views
PL/I. Designed by IBM Designed to replace Fortran, COBOL, LISP, and system applications of assembly language Compiled Imperative. Syntax. A program is a sequence of expressions Expressions can be: Statements Definitions Functions Subroutines Comments are surrounded by /* */
E N D
PL/I Designed by IBM Designed to replace Fortran, COBOL, LISP, and system applications of assembly language Compiled Imperative
Syntax • A program is a sequence of expressions • Expressions can be: • Statements • Definitions • Functions • Subroutines • Comments are surrounded by /* */ • Supports Block-Structures DO; <statements> END;
Data Types • Primitive types: FIXED, FIXED BIN, FLOAT, BIT, and COMPLEX values, also strings and labels • Declare variables by: DECLARE (<var>, <var>,…) <type>[(<precision>)] [<attributes>]…; • Variable names: • A-Z, $, @, #, _ • No reserved words • Data structures: Example: DECLARE 1 PERSON, 2 NAME CHAR(25), 2 BIRTH_DATE, 3 MONTH CHAR(9), 3 DAY FIXED(2), 3 YEAR FIXED(4);
Control Flow • GO TO statements • IF statements: IF <condition> THEN <statement>; ELSE <statement>; • DO statements: <label>: DO i=m1 TO m2 BY m3; <statement>; END <label>;
Functions • Can pass by value or reference by using BYVALUE or BYADDR <label>: PROC(<params>) RETURNS(<type>); <statements>; END <label> Example: EXP: PROC(I,J) RETURNS(FIXED BIN(31)); RETURN(I**J); END EXP;
Evaluation • GO TO statements and lack of reserved words greatly decreases the readability • Complexity from combining several languages and additional facilities made the writability of PL/I poor • It was fairly reliable since it could detect and handle several different types of exceptions and errors