( )
| . |
| : | |
|---|---|
| : | |
| (): | |
| : | |
| : |
, , (. Type safety) |
| : |
CDC 6000, ICT 1900, Pascal-P, PDP-11, PDP-10, IBM System/370, HP, Free Pascal, GNU |
| : | |
| : | |
| : |
|
|
[]
19681969 -68. 1970 , , .
[]
[] UCSD Pascal
1978 - (, ) UCSD p-System, p-, , .[6], , , , , -, . .
[] Object Pascal
1986 Apple Computer , Object Pascal. , .
[] Turbo Pascal Object Pascal
1989 Borland Turbo Pascal 5.5 ( Borland Pascal). Object Pascal Apple, Turbo Pascal 5.5 Object Pascal Apple .
, Borland, Microsoft - .[7][8] .
Borland Object Pascal Borland, , Delphi, .
[] Object Pascal
Free Pascal GNU Pascal, , ( GNU Pascal 20 , 10 , Free Pascal , Turbo Pascal ( ), Delphi .
, Delphi 2003, Net, Delphi .
Free Pascal, GNU Pascal TMT Pascal .
, PascalABC.NET, . Object Pascal Microsoft .NET, : , , , , , , , .
[]
() . . . , , , , , .
, : , , -, , . . « »[9] ( 1980-, -2, , , ). ISO- 1982 , , , .
, . , 1970- ( , ), . 1980- . . - « ».
, , Turbo Pascal Borland, DOS ( 5.5) Windows Delphi, .
, Turbo Pascal DOS Delphi Windows, - .
[]
1970 , , , . 1974 (Kathleen Jensen).[10] , ISO ANSI. , : Unextended Pascal (), Extended Pascal (), Object-Oriented Extensions to Pascal (- ).
| / | |||
|---|---|---|---|
| Pascal Standard | . , | 1974 | |
| Pascal Standard | ISO 7185:1983 ANSI/IEEE 770X3.97:1983 |
1982 | |
| Unextended Pascal | ISO 7185:1990 | 1989 | |
| Extended Pascal | ANSI/IEEE 770X3.160:1989 | 1989 | |
| ISO/IEC 10206 | 1991 | ||
| Object-Oriented Extensions to Pascal |
- | ANSI/X3-TR-13:1994 | 1993 |
- Extended Pascal , .
. ; UCSD Pascal, Object Pascal Apple, Turbo Pascal Borland ( Apple) . .
[]
, , if, then, else, while, for, . . , , -60, , , , , . -67, -68, AlgolW .
(Free Pascal) , .
[] Hello world
program ( ), ; , , , , . begin end. , , . .
, :
program p; begin end.
.
, «Hello, World!»:
program HelloWorld(output); begin writeln('Hello, World!') { } end.
[]
: (real), (integer), (char), (boolean) ( , ).
:
| Byte | 0..255 | 1 | |
| ShortInt | 128..127 | 1 | |
| SmallInt | 32768..32767 | 2 | |
| Word | 0..65535 | 2 | |
| Integer | -32768..32767 | 2 | |
| Cardinal | =LongWord | 4 | |
| LongWord | 0..4294967295 | 4 | |
| LongInt | 2147483648..2147483647 | 4 | |
| Int64 | 9223372036854775808..9223372036854775807 | 8 | |
| QWord | 0..18446744073709551615 | 8 |
:
| Real/Double | ??? | 8 | |
| Real48 | ??? | 11-12 | 6 |
| Single | 1.5E-45..3.4E38 | 7-8 | 4 |
| Extended | 1.9E-4932..1.1E4932 | 19-20 | 10 |
| Comp | 2E64+1..2E63-1 | 19-20 | 8 |
| Currency | 922337203685477.5808..922337203685477.5807 | 19-20 | 8 |
var { } r: Real; { } i: Integer; { } c: Char; { - } b: Boolean; { } s: String; { } t: Text; { } e: (apple, pear, banana, orange, lemon); { - }
Pascal (byte, shortint, word, integer, longint ) . :
: not, and, or, xor. , () , () .
(ordinal), ( ), (boolean), (char), -.
(), ord. , , .
:
var x: 1..10; y: 'a'..'z'; z: pear..orange;
inc, dec, succ, pred, ord, (= > < => <= <>), case, for ( ), , -.
, - , boolean char .
, :
var set1: set of 1..10; set2: set of 'a'..'z'; set3: set of pear..orange;
, .
. , . , :
if i in [5..10] then { } ...
,
if (i>4) and (i<11) then { } ...
, ( ):
var { } d:set of char; begin { } d:=['a','b']; ...
; , .
[11] string, (+) (> < = <> >= <=). . , , .
string [n] string 1970-1990- array [0..n] of char (n 80 UCSD Pascal 255 Turbo/Borland Pascal), , 255 . Delphi FreePascal String AnsiString, , 2 . , Delphi Free Pascal string WideString, 16- UCS-2, .
:
type { } x = Integer; y = x; ...
, :
type { } a = Array [1..10] of Integer; { } b = record { } x: Integer; y: Char; end; c = File of a; { }
, .
, . - , f^. get ( ) put ( ) . , read(f, x) , get(f); x:=f^. , , write(f, x) , f^ := x; put(f). text file of char (, ), - -.
file. - , blockread blockwrite ( UCSD).
[]
type a = ^b; b = record x: Integer; y: Char; z: a; end; var pointer_to_b:a;
pointer_to_b b, . , . , , , . , , , , (. : nil).
( : ^).
10 A a b , :
new(pointer_to_b); { } pointer_to_b^.x := 10; { } pointer_to_b^.y := 'A'; pointer_to_b^.z := nil; ... dispose(pointer_to_b); { - }
with, :
new(pointer_to_b); with pointer_to_b^ do begin x := 10; y := 'A'; z := nil end; ... dispose(pointer_to_b);
[]
type myfunc=function:string; function func1:string; begin func1:='func N 1' end; function func2:string; begin func2:='func N 2' end; var fun:myfunc; begin fun:=@func1; writeln(fun) { func1} end.
[]
, , , GOTO.
while a <> b do { } writeln(''); if a > b then { } writeln(' ') else { else- - } writeln(' '); for i := 1 to 10 do { } writeln(' №', i:1); for i in [1..10] do { } writeln(' №', i:1); { 2.4.0 } with a do { With - } begin l:=1; k:=2; p:=-3; end; repeat { } a := a + 1 until a = 10; case i of { } 0: write(''); 1: write(''); 2: write('') else write(' ') { else- - } end;
while, for, if, case . , , .
Turbo Pascal , , -, :
assign(inp,'text.txt'); {$I-} { IO checking- - } { ( , )} reset(inp); {$I+} { IO checking } if IOresult=0 then begin { ioresult(<>0 -) } ... close(inp); end else writeln('file not found')
, C/C++ ($ifdef, $define, $include), .
[]
:
( procedure function, , , ), , ;.
program mine(output); var i : integer; procedure print(var j: integer); function next(k: integer): integer; begin next := k + 1 end; begin writeln(': ', j); j := next(j) end; begin i := 1; while i <= 10 do print(i) end.
, , . , , .
, , , (, , ), /, . , .
/ forward, , / , .
, - , .
[]
, #include : , , , {$INCLUDE ""}, , . , , , . , .
( UCSD Pascal) . : , , , program , , , , , , , , .
[]
:
unit UnitName1; interface ... implementation ... begin { -, } ... end.
:
unit UnitName2; interface ... implementation ... initialization ... finalization .... end.
, UNIT, . , , , , . : , .
, INTERFACE , . (, , , ), . : , . , , . , . , , . , , , , .
IMPLEMENTATION. , , , , , , . , , , . , , . , , , , ( ), , , . , .
BEGIN. , . , , . . , , Delphi, ( ) INITIALIZATION FINALIZATION. , . , , , , , . , , , .
END .
[]
, , . , USES, , . , INTERFACE, .
, , , . ( IMPLEMENTATION), , , . , . , .
, . , . , , , . «<_>.<_>».
, . ( ), . , , , , .
[]
, , . , , . , .
- ( ), , , . , . , , .
- . , . ( ), , . , , .
[]
: , , . , . , , .
, ( , , ), , . , , , , .
, , , , , . , . , , .
[] -
| . |
- () , , , .
. .
- , , , ( ) - , , , .
Object Pascal object, record, ( ). .
, procedure constructor destructor. , ++- , , ( , Destroy, -).
, , ( virtual ). ( TP virtual ; Delphi FreePascal message, dynamic), VMT ( FreePascal ).
Delphi, FPC , , private, protected, public, published ( public):
type TbasicO = object procedure writeByte (b:byte); virtual; abstract; end; TtextO =object (TbasicO) { TbasicO, writeByte} procedure writeS (s: string); {..} end; TfileO = object (TbasicO) { - } constructor init (n: string); procedure writeByte (b: byte); virtual; destructor closefile; private f: file of byte; end; basicO = ^TbasicO; textO = ^TtextO; fileO = ^TfileO; constructor TfileO.init (n: string); begin assign (f, n); rewrite (f) end; destructor TfileO.closefile; begin close (f) end; procedure TfileO.writeByte (b: byte); begin write (f, b) end; procedure TtextO.writeS (s: string); var i: integer; begin for i:=1 to length(s) do writeByte (ord(s[i])) end; {..} var f: fileO; begin new (f, init('tstobj.txt')); { } textO(f)^.writeS ('text string'); dispose (f, closefile) { } end.
Delphi class ( object- ) (interface) .
( class) TObject, IUnknown. , class, .
Delphi COM Microsoft.
(Class) (Object) / , Create, , Destroy ( ). object , nil , TObject free, nil Destroy. :
q1 := t1.create(9); { (t1 - ) } writeln (q1.InstanceSize); { } q1.Free; { } q1 := nil; { free }
ObjectPascal/Delphi/FreePascal (property), ( ) , :
type TMyObj=class(TObject) FProp:integer; procedure SetProp(AValue:integer); property MyProp:integer read FProp write SetProp; end; procedure TMyObj.SetProp(AValue:integer); begin FProp:=AValue; Writeln('Somebody has changed MyProp!'); end; var MyObj:TMyObj; begin MyObj:=TMyObj.Create; MyObj.FProp:=5; MyObj.MyProp:=MyObj.MyProp+6; end.
( MyObj.FProp) , , , ; , , , . , , .
, : , , , , , «» . , , ,
MyObj.SetProp(MyObj.GetProp+6);
MyObj.GetProp .
, , , .
, «»: , , , var-.
[] .
[]
- White Paper. About Microsofts «Delegates», java.sun.com
- History of Java, Java Application Servers Report TechMetrix Research, 1999
- A Conversation with James Gosling
- TIOBE (.)
- «The guiding idea was to construct a genuine successor of Pascal meeting the requirements of system engineering, yet also to satisfy my teachers urge to present a systematic, consistent, appealing, and teachable framework for professional programming.» Wirth N. Modula-2 and Oberon (HOPL III)
- Wirth N. Recollections about the development of Pascal (HOPL II), 3.3
- Jon Udell, Crash of the Object-Oriented Pascals, BYTE, July, 1989.
- M. I. Trofimov, The End of Pascal?, BYTE, March, 1990, p. 36.
- Why Pascal is Not My Favorite Programming Language
- PASCAL: User Manual and Report ISO Pascal Standard Kathleen Jensen and Niklaus Wirth, 4th edition, Springer Verlag New York, Inc. 1974, 1985, 1991
- ISO 7185 Pascal
[]
- ., . . . .: , 1982. . 151.
- . + = . .: , 1985. . 406.
- . . .: , 1982. . 384.
- . . : . .: , 1989. . 128. ISBN 5-256-00311-9
- .. Delphi 6. Object Pascal. .: -, 2001. . 528. ISBN 5-94157-112-7
- . . (Pascal). . .: , 2005. . 576. ISBN 5-8459-0935-X
- .. Windows: 2- . . . .: , 1993.
[]
- Open Directory Project (dmoz).
- ,
- , Turbo Pascal
- progopedia.ru
| Pascal | |||||||
|---|---|---|---|---|---|---|---|
|
|
|||||||
| IDE | |||||||
|
(.) |
|||||||
| IDE () | |
|---|---|
| /C++ | |
| Java | |
| PHP |
Aptana Studio with PHP plugin Delphi for PHP (RadPHP) Eclipse PDT Zend Studio NuSphere PhpED PHP Expert Editor phpStorm Dreamviewer |
| Python | |
| ActionScript | |
| Ruby | |