:   
 :   

  

































-
-
-
-
-
-




-






































> - > ,

- : ,

,

[pic]

[pic]

ѡٮ ɫ߿߬ ᵿ

Ѽ ẫ᡿

p߬ pѡٮ p߼߬

ҡp߿ ѡ Ѽ .. ӫ

..p

PPP, PP

߫

p 1994

[pic]

681.142.2

ppἼp᡿, pѡԿpᡡ Ѭ: ߫/

..p. . . ӫ߼. ҡ-; , 1994. 97 .

JSBN 5-230-16-955-9

ū߫ ѡ 񡫼 ߡ pѡ ߫pѼѡ

ppἼp᡿, ᡡ Ѭԡ-pѡԿpᡡټ ի

ppԬ ppἼ. Ļߴ ߡ ѻ ᬫ ի, ԫ

p p὿ᵿ, ߫һԿ ߫󽴯ڿ ߫ٮ Կ

ppἼp᡿.

pү p pѡԿpᡫ ѡԫ, ڿ pԿ

ᡡ Ἷ ppἼp᡿ p pᵿ ߿Ѽ.

 pѬѡᡫ p ѡ ߵ "ppἼp᡿",

"ա ppἼp᡿", "ߡ pᵿ ա",

"ѽp᡿ ". PѬߴ ߻᡿ p

߻ѵѮ "p ѼԿ", "ԫԿpᡡ ߿Ѽ

pԬ pᵿ һpѡ", "ppἼ ߻ѡ ߽ѽ

ԫԿpᡡ ߿Ѽ". ٻѡ p "pᵿ ߿Ѽ

ա".

ߴ ѡ ᬵ-ѽ߬ ߫ ߬

ѡ ӫ߼߬ ҡ߿ ѡ Ѽ ..ӫ

Pѵѡѡ 漿p ..

JSBN 5-230-16-955-9 p߬ pѡٮ

p߼߬ ҡp߿, 1994

P

ԫڿ ߫ ߴ pҬ ᬫ- ٬

ppἼp᡿. ԫ, ѽ ᬽߴ ԫ, ԫ

ա ppἼp᡿. ѽ p, ᡡٮ ѻѮ

Ѭԡ-pѡԿpᡡ ի ppԬ ppἼ, ߫

ԫp pҪڿ pٮ p ppԿpߴ ߫һ

ῼᡡ ῼүڿ Ѭԫ. ѽp᡿ p

p pἬ ԫ ѻ ᡫ ᡿Ѽ (߻ѵᵿ) Ѭԫ

p p Ѭԡ p ٬ ppἼp᡿, ԫ p

Ҫ ߽޿ߴ ԫ ppἼp᡿ ᡫ

ԡ ߼߽ pѫ߼߽ѡѼ իpޫ ԡ ԫ޿ߴ

Կ.

ߡ ѽ ᡡ ߫ ᬽߴ ԫ, ԫ Կ ѽ

ߪԫ ᬫ p ߡ ѻ Ѭԡ-pѡԿpᡡ

ի, ppp pp pѡ ԫ

pѡ, ԫp 󫽿 󡿼ѽ ѽ pѮԿ

p ᡿ ի ѽ p Ҽѡ p὿

ppԬ pԡ ppἼ. 佴 ԫ Ѽ ߽

ѽ ߻ ߫pѼѡ Ѭԡ-pѡԿpᡡ ٬ (

"ppҪѡ" ߻ѵټ Կ).  ߻Ѭ Ѭԡ-

pѡԿpᡡ ի p὿ ԡ ա

ҽ ppἼp᡿ ߻᡿Ѽ pp᡿ Կ,

᡿ p-ݬ߻p, p߫, ߫ppἼ ..

ԫp ٻѡ, ߽ ѽ ߡ ԫ

߫ ߽ߴ ߫ѡٮ pԿ߬ Ѭԡ-pѡԿpᡡ

pҿp᡿ ppἼ ѽѮ. ᬫ ߫ѡ ѡ, ߬

ppἼp᡿ - p pߴ ᡿.  Կ

Ѭԡ-pѡԿpᡡ ի ޡ ѡ ѽ p

󻫽 ߽޿ߴ ԫ ԫ߬, pҬԿ󡫼,

ѻ ԡѡ. ġ ѯ p pѽѡ p

ѼԿ߬ ߡ ếpүߴ ҿ "p

߼߽". ԫ ߻᡿ Ѭԡ-pѡԿpᡡ ի

Դ ߴ pټ, p - .

pѡ ppἼ, pѡ ߫, pѡ ߻᡿Ѽ

ᵿ, pԫ ٬ ҽ-2. p ԫ ٬ ߡ

ԫѽ: p񿵿 ѬԿ, ԫp p ԫp,

pѡ p ҽ, 󫽴 p޿p ppἼ ppԬ

p ߡ. Ѽ ҽ-2 ߴ pѽѼ pһ

"߬Ὣ", ԫp ޿p p߻ppѡ.

ū߫ pᡫ ѽ, ԫpٮ Ѭԫpٮ

ppἼp᡿ ٬, ѯѼ p pp᡿ Կ,

Ѽ Դѡ ޿ pҺ p pѼ ա

ppἼp᡿, ߻߫ѡ Կ p ѼԿ߬ ppᵿ

ѽ ᡿ pҬpᵿ ԫ ߼ѡ ߽޿ߴ ԫ

߬ڿߴ pѫԿ. Կ ߽, -񿼫, ѫի

ԫ ߻pԿ p, ԫp p ԫp.

ū߼p իpޫ ԡٮ p ppἼp᡿ pѺ Ѭԡ-

pѡԿpᡡ - ԫ, ԫ , ٮ ҽ

pԿ ޿ ߻߫Ѯ ԫ Կ.

I. P PP f PPPf

ūԿ pҬp ߫pߴ ߫ ߽ټ Ѭԫ, ڿ

ѽԡԿ, Ѽ ߫ѡټ p

(Ѯ, ݽѼѡԫ) Ѽ ߻᡿ pѽѡ ߿Ѽ p.

ppἼp᡿ ppԿp ߬ pẽѡ

߿ᵿ ѽ Կ- Ѭ pѼ . ԫ

pҬpᵿ ppἼp᡿ pԫ p ᬫ

Ѭ. 髺, pҼߴ, Ѭ Ѻ p, ԫ

߽ ( p Ѻ p) , Ѯ pߴ

pҬp, p, Ѽ ߽, 󫺼.

ԫp߬ pҬpᵿ ppἼp᡿ ѡ ٬

ppἼp᡿ һp󽴯ڿ pҬp - pԫp ߽ pի,

p, pẽټ pἿ ԫpѡ ի .. ѽ ᬫ

pҬpᵿ ᬽ ѡ ѼԿ ѼԿ

ppѼ ppἼ. ppἼp᡿ ߻᡿Ѽ pԫp

Ѻ߽ pի (GO TO) ԫ Ὣ Ѫѽѽټ,

ڿߴ ߿Ѽ p pҬpᵿ. Ѭԫp ٬

ppἼp᡿ ԫ pԫp ٽ ѡ, ԫ

ppἼԫ ߬ѡ ᬫ, ѬԿ, իpޫ

pڿ, p Ѽ pҬp (!) ppἼ. (pѼ,

p߿ Կ ٬ "ٮ" GOTO ѫᡡ

"߬p", ߼p ߯ "pҬp").

黫߽ ߽ ѡ, ԫ pҬpᵿ - ԫ Կ

ppἼp᡿.  ppἼ, ߽Ҵ ᬫ Կ ( ߻Ҵ

GOTO), 󻫽 pҬp Ѽ, Ѻ GOTO.

f٬ ppἿp᡿, ԫp ٽ ѡ һp󽴯ڿ pҬp,

὿ pټ Կ Ѽp ߫pѼѡ ٬ (٬

p ѡ, pp, FORTRAN). үڿ ừ pԿ

ѻ pҬpᵿ 󿽫 ߫᡿ ѫի񿼫Կ pҬpᵿ

ᡡ. ūѡ ᬿ pҬp, ỿ߿, Ὣ ߻᡿

٬ ppἼp᡿ ᡿ pp᡿ Կ (٬ ԫp

ѡ, pp - PL1). PԿ Կ ᡿, ppᵿ Կ

p ( Ѭԫ + pᵿ ) ߻᡿

ҽ ppἼ ݬѡ pԡ Կ ᡫ ѡѼ

٬ p ѡ (Clu, ҽ-2 p.). Խѽ ߫ѡ

Կ ٬ ߴ ὿ p p pp᡿

Կ. ԫ իpޫ ԡ ա ҽ ppἼp᡿

ߡ, ԫp ѻ pp᡿

񫻫ѽ . p pү p

󫺼Կ ҽ ᡿ p-ݬ߻p. ꡬҽ

󫽴 p߼p ҽ p ppἼ Ѭԫ, ѡ

- ҽ. "ѻӫ", ѽѮ

󫺼ټ ߻᡿ Ѭԫ, pѽѡ ҽ, ,

"һpp", - ԫ ߽ ҽ ԡ ԫ ڿ

Ѭ (pp, pp), "pp" (

pѽἿ ҽ ߻ Ѭԫ). ᡿

p-ݬ߻p pҽpү "ѻѡ ppԿ" ҽ ҽ Ѽ

߻᡿ ߫үڿ Ѭpᵿ pѽѡ Ѭԫ.

Լѡ ߻Ѭ pѽ ٬, ԫp ٬Ἷ,

pѡԿpᡡټ Ѭ. ᬿ ٬ ppἼ pѽߴ

p ҽѮ, ٮ ԫp ߫p pѽѡ pԡ

Կ , Ѯ ѬἿ ԫ Կ Ft pѡ Ѽ ѡ

Ѭԫ Wt. T Ft ݬ߻pԿpүߴ "һppټ ݬ߻pԫ", Wt -

"" ҽ. ᬿ pẫ, ҽ pѽߴ p

M=, ᡿ p-ݬ߻p pѽ Կ߬

Ѫҽ 󴺿.

ԫ ppᵿ ҽ 񫽪ѡ p߼pߴ ppἼٮ

ݬѡ pѽѡ Ѭԫ, ߫pڿ ߯ pᵿ

Ѭ ԫ . pp, ҽ, p὿үڿ Ѭԫ

, 񫽪ѡ ߫p ᡿ pԡ Կ "ԫ" (T) Ѯ

ѬἿ (Ft), pp, ߽үڿ:

PROCEDURE Create (X,Y:CARDINAL): ;

(櫺 ԫ pἿ X,Y).

PROCEDURE Destroy (VAR T: ); (὿ ԫ ).

PROCEDURE Sm (T: ; New_X, New_Y: CARDINAL);

(pѼԿ ԫ p New_X, New_Y).

Wt ԫ pp 񫽪 p὿ ߬p ҽ ᡿, ᡡ

p὿ᵿѮ Ft. Ѽ ߽ Wt ߫᡿Ѽ

p߫ "" Ѭԫ . pp, ᡿ ",

ff P P" 񫽪 ҽp p

ᬫ ѡ.

ūpѼ, ԫ ҽ ppἼٮ ݬѡ ߫p

᡿e ԫ ԫ . Ѭ ߫ߴ

ҽ, ߽ Ѽ ߽ ѻp߬Ѽ ( pѡ pp -

ԫ pѼѡ ڿߴ ԫѬ). ԫ ԫѽ p

ԫ, ԫ pѼѡ ppἼ ݬѡ Ѭԫ

pѽߴ ҽ- ߫ѡ ݬ߻pԿpүߴ

pѽ. ( ҽ- pѽѡ pԡ ԫ,

pѽѡ p pҿp᡿ ԫѬ). ԫ ߼߽ ݬ߻p

pѼѡ-Ѭԫ (ԫ ppѡٮ p) 񫽪ѡ p߼pߴ

pѡ Կ Ѭԡ-pѡԿpᡡ ppἼp᡿.

f٬, pѡԿpᡡ Ѭ, 󽴯ߴ pѮ Ѭԡ-

pѡԿpᡡ ٬. ū߽ ppүߴ ὿Ѽ ߻ѵ߬

᡿, p὿ү ԡѡ - (Կ-Կ), ᡡ

߻᡿Ѽ ᡿ ߽᡿ , ߡᡡ

߫߬ ѽ ѡ. ߫ Ҭ ߽ 19-

Ѭ pѺҽ ߿ѼԿᵿ ѡ ( pү p).

߿ѼԿᵿ ᬽ ᡫѡ ԡѡ

ԡ, pp:

"Ѭ" *> "Ѻ" *> "᡺".

(p ߻ߴ p "߫") "Ѭ"

ppߴ ڿ Ἷ, "Ѻ" 񫻫ѡ Կ

ԫڿ (ԡټ) Ἷ, pڿ ԫ

Ѻ, . . ᬿ pẫ, ߻ᡡٮ Ἷ ߿ "*>" Ҭ

pѡ p޿pѡ (񫻫ѡ) Ἷ.

᡿ ߽᡿ Ѭԡ-pѡԿpᡡ ٬ 󫽴

߿ ᬫ ppἼ Ѽ ߻᡿ Ѭpᵿ "-

" Ѫ, ߬ pp

ߡ Ҫ ߫ᡡ ( Խѡ!) . ߻᡿ ԫ

᡿ ѻpѡ ᡫ 󫺼 p߽ѡ

pԡ Կ, ԫp ppߴ ppἼ, pѽѡ

ԡѡ -. Կ, ԫ Դ pѽѡ ᬿ

ԡѡ pѼԿ.

Խѽ ߫ѡ Ѭԡ-pѡԿpᡡ ٬

ᬽߴ p᡿ᵿ ῼѮ Ѭԫ ߡ "ٽ

߫ѡ". ūѡ ᬿ ᡿ ῼѮ Կ߬ pp

ѻ p᡿ᵿ ߽ѽ p߫ , ߡᡡ

p񿵿 pտѬp Ѯ. pտѬp, ᡡ

p p᡿ ppἼ ߽ѽټ ٻѡѼ 񡫼 (!)

p߫p, ߴ Ὣ p߻߫ѡ ѽp᡿ ߿ᵿ,

߬ Կ Ѭԫ ҡpү pѼѡ ѡ

߫ԫ pѺҽ ѡ ߫ѡ. PpԬ pտѬp

pѡ, Ѭԡ ѻ "ѡ ߫ѡ", ѡ Ѭԡ-

pѡԿpᡡ ի, ߫᡿Ѽ p߫p

pᵿ . ԫ pѼ ѡ ߫ѡ Ѫ ѬἿ

߼ѽp 񡫻p߫p իpޫ

ԡ p, ߻ڿ ߬ pώѽ ٻѡ

pѼѡ ԿѮ: ߫ppἼ, p߫, ᡿pѼ ppἼ,

߫Կ ῼѮ ߻᡿ ԫ ߬pԡ-߫Կ

һpѡ.

ѽ Ѭԡ-pѡԿpᡡٮ ի ppԬ ppἼ pp

ԫ pҬpᵿ һpѡ, pҬpᵿ ᡡ. p

ԫ Կ Ѭ (ԫp p pѽѡ), p

p, ߫p ᬿ-ԫ p Խ Կ

pạԴ pҬpᵿ. Ѭԫ ,

pѼѡ, pp, p. ԫ pԿ󫻫ѡ

p Կ߬ Ἷ߬ ѻ p p

߼߽. Ѭ ppἼ "pߴ" "Ҽp", ѡ ߫ԫ,

߬ p, "" "p" p

Ѭ, . . ߻p ѡ ѡ p p. ū

Ѭԫ pҼ Ѭԫp pԡ Կ, pp,

"pѡ" "p ҡ"; Կ, Կpү pү ߿Ѽ

p: "ѻѡ", "ᡫ", "ԫ". ԫ Ѭ - ԫ

ڡ p ѡ, ԫpү ߻߫ ѽ , ᡿

ҿ.

Ѭԡ-pѡԿpᡡ ppἼp᡿ ppἼp᡿

ߴ ߬, ҿ p ѡ ү p. Խ

ppἼp᡿ ԫ ի p ү ὿p ԫ

pҼѡԫ p὿ᵿ ޿ pѡ p p

p.

II. f PPf

ūԿ Ѭԫ.- 꼼ѡԡ .- ؽѼѡ pѡ.-

pp᡿ .- p.- pѡ Ѭԫ ѡ.-

諡 Կ.- p߽ٮ Կ.- ѡٮ Կ.

Ѭԡ-pѡԿpᡡ ի ppԬ ppἼ ѡpټ

ߴ Կ Ѭԫ. pѽߴ

Ѭԫ, ڿ pѡ (ѡԡټ) Ἷ, pڿ

Ѭ . pѼ ߻ѵᵿ (pѽѡ) pߴ

Ѽ pѽѡ ѡԡ , ԫp ԫ p p

߫pүڿ pᬫ. pp, " ߻Ѽ" p

Ѽ Ѽټ (ѡ, ެ, p p.) ߴ

߫pүڿ pᬫ . p pᬫ

ԫ ߻ߴ, pp, "p", "pѡ

ѽѬ", "߻߫ ừ᡿ p" .. һ

pѽ "Ѽ".

ūԿ ߴ, ᬿ pẫ, pټ pѽѡ .

ѵᵿ ᡿Ѽ ѡ ,

ԫ, pѡѽ p ᬿ ѡ ߼߽ -

᡿ ѡ ߴ ppԿ Ѭ. Ļpѽѽ

, Ѽ (߻Ѽ, p

p.). Ļpѽ Ѭ (pp, ἿѮ p), 񫽪

pѽ ѡ Կ :

߻Ѽ (p):= Խ; 髺p(p):= 20.

ԫ ߻Ѭ pѽ Կ ݬѡ߿, Ѭ

- ѡ߿ Կ.

p ԫp ߴ , ߫ Ѭԫ ԫp

ѡߴ Ἷ p ppἼ (Ѽ pի ի,

ߴ). ѡ pѼѡ ppߴ

p pѪڿ Ѽ Ѭԫ p߽ѡѼ

(߻߬ Ѽ): p, ᡫ, p, pp.

Կ ߻߫ ᡿ ү Ѻ߿ p.

ѡԡ Կѡ pѽ ߫pѽٮ

ѼԿ߬ ߻Ѭ ߻ѵᵿ . Ѭԫ Ἷѡ

pѽ ߫Կٮ (pһ) ߻Ѭ . ѼԿ߬ ߻Ѭ

p὿ߴ ppἼp᡿ ߻᡿Ѽ pԡ Կ,

߫Կٮ - ߡ ߻᡿ ѡ Կ.

Ѻ߿ ߻Ѭԫ ᡿ ᬽߴ ԫ, ԫ

᡿ ᡫ ᡿Ѽ p.

߽ ߫pүڿ pᬫ ԫ, Ѽ ѡ

ԫ ߫ᵿ Ѭԫp p Ѭԫ (߿󫽫,

ᬫ). pѡ pp Ἷ - ѡԿԫ Ѭ,

ի ߫ ѡԡ ԫ ᬫ

ѼԿ߬ Һ - ѡ Ἷ "ӫ" ӫ

"", Ἷ "ӡ" ӫ "ӡ". ߽ ߫ᵿ,

Ѽ ߫, , Ѽ ѡ ѼԿ߬

ѡ 󫺼 Ѭԫ, իԴ ԫ ԫڿ ѡ

Ѽѡ.

ߴ Ѭԫ , ڿ Ἷ :

={a/P(A)}. Ѽ ԡѡ: "is-a"-"ߴ Ѭԫ " "has-a"-

" Ἷ". Կ ԡѡ ߬

"ԫ ԫ ԫ" (), ѽѮ ߿ ᡿ :

_V_ a: a is-a A(P) a has-a P(A).

( _V_ - ԫ ڡԿ).

P(A) 󬽯 ạѮ: " Ѽ "

" ߻߫ (󫺼) ѽ ԫ ". ӿ,

" ԫ" (" " ѮѼ ӫԫ "").

ạ ѡѼ (ѡѼ) ἴԿ

Ѭ ѡ . ѵᵿ ᬿ

ߴ ߻ѵᵿѮ ѡ. ġ ѽ Ẽ Կ

ἴԿ, ѫի񿼫 ѡ ѡ , ӻᵿ

(߼. ). ѵᵿ "᡿ ߻߫Դ" ߴ

ҡ ߻ѵᵿѮ - ԫ ᡿ Ѯ (ӫ, ҡ),

ԫ ٻ Ѭ . ᬫ Ѯ ᬪ

ߴ ѡѼ ҡ , ԫӫ ᡿ߴ

ἴԿ Ѭ. ӿ, ҡ

"Կ" ѽ ߻߫ Ѭ Ӽᵿ

. ġ ѡ ᬿ ԫ (߻߫)

ѡ, "󫡿 ( ѽ)", "߽ ()", "ӿ

()". ѵᵿ ѡ "Կ" ᡿

ѡ (󫡿, ߽, ӿ), ҡ ߻ѵᵿ

ѽ ᡿ ߫үڿ ԫ.

软ټ ԿѼ ߻ѵᵿ ѡ ߴ Կ ݽѼѡ

ѡ. ӿ, ѡ "" ᡿ߴ Ѭԡ

ἴԿ 񡫼 ޿ ߽ (WORD) (BYTE). ƿ WORD BYTE

ԡߴߴ ӿ ޿-ӿѡԿӫᡡ ԡ Կ. ġ

ѽ ԫ Ẽ ݽѼѡ ѡ 󽴯 ӫἼ ү

ѽѡ ӻᵿ ѡ, ᡴߴ ᬫ

ݽѼѡ. ԡټ Կ ԡߴߴ Կ ٬ ӫἼӫ᡿,

ӻᵿ ԫ ѽߴ ᡿Ἷ, ӫѡټ ٬.

ӿ, Կ CARDINAL, Ѭ ԫӫ ӻԿүߴ

߽, Կ INTEGER, ӻԿѼٮ ѽ ߫ ᬫ, REAL -

Ѯѽ ߽ . ӫѡ ᡿ pᵿ ԡ

Կ Ẽ ݽѼѡԫ ѡ Ѭԫ ߫үڿ Կ.

ᬿ Ẽ ѽѡ ߻ѵ ҡ: SIZE

() TSIZE (). pp, TSIZE (CARDINAL) = 2 (); SIZE

(V) = 2 () / V is-a CARDINAL. ( / ٻ ӫ

߽). ạ ὿ᵿ ߿ ٬ ӫἼӫ᡿

ѡ Ѭԫ ԫ ԡ Կ

߻ߴ ạ ݽѼѡ ѡ. ӿ, TSIZE (ADDRESS) =

2() 16-Ӵ񡫮 ٬ ҽ-2 (὿ᵿ -4),

ԫ Ѽ TSIZE (ADDRESS) = 4 ߿ ԫ ٬ ӿ

὿ᵿ Կ IBM PC.

ԡٮ Կ ҿߴ ѽѼ ߡ ӫ᡿

ԡ Կ. ᬫ ӫ᡿ ᡫ ѡѼ ߬

Ѭ ߿Ѽ ߫pүڿ pᬫ, ѽڿ ٮ

. ӫ᡿ ὿ ԡѡ "߫ԫ " (con-of). ӿ,

ԡѡ A con-of (B,C), ,, - , ὿ᡫ

٬ ӫἼӫ᡿ ѬᵿѮ, ᡡ ѽѡѼ իӫޫ

ԡ Կ ỿ߿:

TYPE A=RECORD

: B;

: C

END

ᬿ ẫ, ỿ - ԫ , ߫ѡٮ ạӫ .

ӫ᡿ ӫ ᡫ ߻᡿Ѽ Կ ߿.

ӿ, Ѭᵿ

TYPE A = ARRAY [1:3] OF B

ѽ con-of(B,B,B). Ẽ ݽѼѡ ѡ Ѭ-

ѽߴ ӫټ Ҽӫ᡿Ѽ Ẽӫ ݽѼѡԫ ѡ

ѡ, ߽ ӿ:

TSIZE (A) = 6 / TSIZE(B)=2.

ѵᵿ ѡԡ Կ " ߻߫" (߻ѵᵿ

ԫ, Ѯ) ߻᡿Ѽ ߫ ạԿ

ӫ᡿ - pѽѡѼ ߿, p὿Ѽ ӫӡټ

ԿἿ. ūԿ ߿ ᡫ ߫һ ᵿ (Ѯ),

ӫ Ѭԫ. ԫ ѡ Ҽ "߿"

Ѭ - Ѯ ӫߴ . ӿ, Ѭ

鬽 ٬. Ӵ ӫԿ󫻫

ԫ ѡ (ѫӿ ԫӫ, ٬ ), ߫ ԫӫ Ѭ

߻߫ѡ ӫ Ѯ (Կѡ), ԫ ߽ ߿ - ԫ

߫һ ߻߫Ѯ.

佴 pѽѡ ߿ ߻үߴ ӫӡ Կ. Ѽ ߽

ӫӡٮ Կ ѽ:

- 󫺼 Ѯ;

- Ѭԫ, ԫټ

ӫѡ Կ Ѯ.

ӿ, ߻ѵᵿ

TYPE DST = PROCEDURE (VAR )

ѽ 󫺼 Ѯ ѬἿ .

ӫ, ᡡ ӫἡ ҽ ѯ Ӽ

߫ڿ ѬᵿѮ DST, ߼ӿߴ Ѭ DST.

ӿ, Ѯ "󬽯" "٬" ߼ӿߴ

ݽѼѡ DST ԫ ӿ ߽, ԫ ӫ, ڿ

Կ Ѯ, ѽѡ ߽үѼ :

PROCEDURE 鬽 (VAR S: );

PROCEDURE ٬ (VAR S: );.

Ӽ ߿ ԡ߿ߴ ѼԿ, ӫἿӫ᡿ ߻ߴ

߿ Կ Ѯ (ԫ). ҽ-2

ԡٮ ӫӡٮ Կ, ѬἿ ԫӫ 󽴯ߴ ӫ Ѻ

ӫ:

YPE PROC = PROCEDURE (); .

ؽѼѡ ѡ ᬿ Ѭԫ ӿүߴ ԡѡѼ TSIZE (PROC) =

TSIZE (ADDRESS), .. Ѭԫ ԫ ԡ ӫӡ

Կ ߻үߴ ի ߫үڿ ӫ (ԫ ߬

- Կᵿ ӫ). ԫ ԡѡ ߻p pp

Կ. ԫ ߼߽ ߻ѵᵿ ѡ ԫ Ѽ Խߴ

߻ѵᵿ ѡ ѻӫӡ ߫.

ݽѼѡ ѡ, ᡡ ѽѡټ ߫, ᡿ߴ

ѡ Ѭ ԫ . ᬫ ѡ ߴ

ѡ, ỿټ ݽѼѡ ѡ.

᡿ѡ Ӵ񡫮 Ԭ ( ᡿ѡ)

ߴ ټ ѡ. ӿ, ,

ӿѼ Կ CARDINAL, ѡ 2n ẽټ

ѡ ѽ, n - Ӵ . 佴 16-Ӵ

߽ ԫ ߻Ѭ ѡ 󬽯 ߽ 0 216 - 1 = 65

535. , ppѼ Կ CHAR (), ѡ

28 = 256 ẽټ ߿Ἷ ( ASCII p߬ ߿󫽫),

߬ ݽѼѡ ѡ ᬫ Ẽ : TSIZE

(CHAR) = 1.

ѡ, ԫӫ , ӿѼ Ѽ

ټ Կ, ߴ ԫ ԫ Կ. , ӿ, 'A' -

Կ CHAR, 177 - Կ CARDINAL INTEGER. ū߬

Կ , ᡫ Ӵټ

߽ѡѼ. ԫ ߼߽ Կ, ὿Ѽٮ , ߴ

߽ Կ. ᬫ, ߬ Ӵ ٮ

߽, ӿ, 216 ẽ ѡ Կ, Ҽ

ѡ ᬫ ߽ѡ ٽ ᡿ ӫἼ ԡٮ

ԡٮ Կ CARDINAL. 佴 ᡿ѡ ѡ

٬ ӫἼӫ᡿ ߻үߴ Ѽ Ѻ Կ -

һӴѡ 񼡫 ԡ

ԡ Կ.

Ѭ ߫ ᪡ ԼԿ, ԫ ѡ Ѭ

ѡ ߬ҿӫᡫ Ѽ ѡ᡿ Կ. 佴

὿ᵿ ԫ 󫺼Կ ߻ߴ ߽ѡ, ӿ:

TYPE =(, , , , 櫽, , ); .

ѡ Ѭ ᡿ߴ ߻᡿Ѽ Ѽ

. ū߬ ѡ ᬿ ạ ӫἼ,

ѡ᡿ ߫Ӫ ݽѼѡ pӫ᡿ Կ.

᡿ѡټ ߻Ѭӫ ѡ ߬ҿӫ ٮ

Ѭԫ ޿ӫ ߻Ѭӫ. ᬫ ҿӫ᡿ ếߴ

ѡ ҽ ѫӿ , ߫ ԫټ Ѭԫ

񼡫. , ӿ, ߻Ҵ

ѽѡٮ Կ "", ߬ҿӫ "Ǭ",

ݽѼѡἿ ԫӫ ߴ ẽ ᵿ . 佴 ԫ

٬ ӫἼӫ᡿ ߻ߴ ѡٮ Կ, ѽѼٮ

ߡ ẫ ߽ Կ:

TYPE Ǭ = SET OF ; .

"Ǭ" 󬽯 Ҫ 7, 27 Ѭԫ, ѡ

ԫ ѽߴ ѡټ Ἷ. :

{ } -"" "";

{ , } -ᬬ, ߫ѡٮ ;

{ .. } -ᬬ, 󬽯ڿ ߯ ;

{} - ᬬ "᡿", ߫Ӫڿ 񡫮 .

ؽѼѡ ѡ Ѭ "Ǭ" 񫽪ѡ ߬ Ẽѡ Ѽ 27

ẽ ѡ, ߽ѽ, ټ Ѽټ ݽѼѡԫ,

ӿټ ѡ ᬬ, ߴ :

TSIZE(Ǭ) =1.

Ѭ ẫ () ԫ ӿ ᬪ Ẽߴ

񡫼 , ߼Ӵ ԫ, ԫ ߻ߴ ѡ

3 . ѡٮ Կ, ӫѡٮ ߡ Ѻ Կ [0..15],

ԡٮ Կ

BITSET = SET OF [0..15].

Կ, ԫ TSIZE(BITSET)=2 (). Ẽ ݽѼѡ ѡ

ѡ Կ ѽߴ ѡѼ

N DIV 8 +(N MOD 8) DIV (N MOD 8).

N - ߽ ẫ Կ, MOD DIV - ᵿ ߫ѡ

ѽѡ ҽ ѽ (񻫽ߴ, ԫ 0 DIV 0 = 0).

Կ߬ Ẽ ݽѼѡ ѡ ѡ Կ ѽߴ Ѽ,

ԫ ѡ Ѭ ᬫ Կ ߻ߴ

ӿԿ߬ ҡ . ӿ, ѡ ᬬp

{,,} ߽үڿ ẫ:

櫽 P

+--+--+--+----+--+--+--+--+ (7-

| ?| 1| 0| 0| 0| 1| 0| 1| ߻ߴ)

+--+--+--+----+--+--+--+--+

7 6 5 4 3 2 1 0

ѬἿ ѡ Կ ѽѡ ҡ, ᡡ

ݽѼѡӡټ ᵿ Ἷ (ѡ, ѡ,

ạ, ߿ӿ߬ ạ); ӫӬ ߫ԫ (

ӿԿ߬ ҡ); 󬽯ѡѼ/߬ѡѼ ẫ Ѭԫ

.. ūӫ ԫ ӫ Ҭ ٬

ӫἼӫ᡿.

߻᡿ ӿԿ߬ ҡ ѡ Ѭԫ

ѡ Կ 󫽴 ᡿ ѬԿү ᬿ

ѬἿ ӫ ݽѼѡԫ ѡ.

III. f

ѡԿᵿ ѡ᡿Ѽ.- ὿ѡ.- ᡵ һ.- Ļpԫp

p߫ѡ.- Ѭ߿p᡿.- ѡԿᵿ Ҭ᡿Ѽ.- ٮ

p᡿ѡٮ Ҭѽ.- ƿ ADDRESS.- ὿ѡ ߫ "^".

ѡԿᵿ Ѭ ᬽߴ ѽѡ (իѡ) ݽѼѡ

ѡ ѡ һ ѡ Ѭ - ѡ

.

ߡ ߻߫ ѡԿᵿ Ѭ: ѡ᡿

Ҭ᡿. ѡ᡿ ᬽߴ ạѡ Ѭ ѽѡ ѡ.

ᬫ ạѡ ӫߴ ߽, ӫ ٻѡ

ӫἼ Ѭ ѿѡ. ӿ, Ѭᵿ

VAR A,B: Ѭ

ѽ ὿ ӫἼ Ѭԫ ѡἿ B

߫ѡ, ٮ ԫ ٮ ݽѼѡ ѡ.

Կߴ Ѭ ѡ Ѫ, ԫ " ߽޿"

󫺼, 󫺼 ᵿ " Ѭ ټ ѡѼ ".

꼴 - ԫ ӿ ӫἼ, ߻ڿ ߿ᵿ һ

񡫼 ԫ Ѭ. ūԿ "" ٬ ӫἼӫ᡿

߻ߴ ߿ Կ "ѡԿԫ". ԫ ߼߽ ӫ

ӫἼӫ᡿ ٻѡ ӫἼ ߴ ӫ߫ ѡѡ ԫ

ѡ Ѭԫ, ѡԿᵿ.

ѡߴ ѽ Ѭԫ-ԫ. ԫ ߽

ᬿ ѡ ὿ӫᡡټ ѡԿԫἿ - ὿ѡἿ,

὿ү ᡵٮ һ Ѭ. ӿ,

TYPE Ѭ = RECORD

B : _ӫѡ; : B

END;

VAR A,B : OѬ; .

὿ѡ A.B Ԭӫ һ ӫѡ Ѭ A, B.B -

ӫѡ Ѭ B .. 使 ᡵ һ ѽߴ

ӫѮ ӫ᡿ Ѭԫ . ԫ ӿ 使=1. ߽

ԫ _ɫѡ:

TYPE _ӫѡ = RECORD

: ; : ߴ; : ѡ

END;

ԫ ὿ѡ, Ԭڿ һ ӫѡ Ѭ , 񽿡

ᡵ, ү 2: ... ӫԫ ѡԿԫ ߼ӿ

ԡٮ ߽ ὿ѡ ҽ ᡵѮ һ.

ᡵٮ һ ѡ ѽ Ѽ ѡԿᵿ

pԫ Ѭ, ԫp pᡴߴ ѡ . 櫬Կ ԫ

Ѽ ߻Ҵ ԫ ӿ߫ѡ

WITH < ὿ѡ > DO < ӿ߫񿡴Ѽٮ ѡ > END.

ᬫ ԫ ߫ 񽿡 ᡵ һ p Ѭ,

ѡԿpѼ pѺ . ߽ ߽ ᬿ pԫ

p߫񿡴Ѽ pѡ ѽ, ԫ ߻᡿ pԫp p߫ѡ

ѡ ߫pԿ pѼ ٻѡ ԫ pѡ ppἼ.

齫ѡ ԫӫ ӿ߫ѡ ߻ 񫻫ѽ ߫ѡ

ᡵ һ. ӿ, Ѽѡ VAR A: Ѭ, ԫ

߽үڿ ẫ:

WITH A DO

;

WITH B DO

END

END.

ѡ Ѭԫ ӫ . ԫ ᡫ

Ѽ, ԫ Ѭᵿ ӫߴ ѽ TYPE (Կ), ѡ᡿

Ѭԫ - ѽ VAR (Ѽѡ).

߽ԫ ٬ ӫἼӫ᡿, ѽ TYPE VAR,

"߼ӿ" "ޡ" ԫ, ԫ ѡ

ӫ ѡ Ѭԫ - ԫ ӿ ạ Կ.

Ѽ ԫ WITH Ӽ ߬ ߼޿᡿ ᬿ Կ

(߼. ӿѡٮ ӿ: ٮ WITH ӿ߫񿡴 Ѭ, ԫӫ

). ᬫ ߼޿᡿ Ѽ ߽ ѡ

󡿼᡿ ӿ ӫἼӫ᡿ ӿ߫񿡴Ѽ ѡԫ. ӿ,

VAR A,B: Ѭ; C: ;

BEGIN . . .

+- WITH A DO

(1) | WITH B DO C:= END; B.B.:=C

+- END . . .

+- WITH A DO

(2) | WITH B DO C:=; B.:=C END

+- END . . .

+- WITH A DO

| WITH B DO C:= END

| END;

(3) |

| WITH B DO

| WITH B DO :=C END

+- END.

ӿ ѡ ߽ү ѽ : ѡ Ӽᵿ

ӫѡ Ѭԫ . ٮ ѡ Կ ԫ ѽ, ԫӫ -

. ūѼ ? Ѽ ѡ ӿ Ѭ ᬫ ԫ

"WITH B" ὿ү ẽ ӿ߫ѡ, ߴڿ Ѭ. ᬿ?

佴 ԫ, ԫ Ѫ 󫺼 ѼԿ߬ ޿, ߽ѡ

ᬫ Ѭԡ ߿ pԫp p߫ѡ, ߽

߻ ὿ѡ ( ѬԿ ӫἼ),

ӫ᡿ ѡ Ѭԫ pԫ (). ū߽

ԡѡ Կѽ.

ӿ ߿Ἷ Ѭԫ () ߿Ἷ ӫ

ѡԿᵿ ߴ ߡ Ѭ߿p᡿ (Ҽᵿ). Ѭ

ѽ Ӵٮ Ѭ ( ) ٻ ӫ

ԫѡ ѡ ѡ . ѡ, ԫѡ Ѭ߫, -

ѪѼ ߴ ѡἿ ( ԫ ߼߽ Ѭ Ӽ

߼ӿ "߫ү " ߿ ӫ, үѮ ).

᡿, ѽᡡ ԡ߿ѽ ӫ᡿ ѡ Ѭԫ

, ӿ ѡ ӿѡѽ ѡ᡿

Ѭ߿ӫ᡿Ѽ.

һ Ѭ, ѡԿpѼ ѡѼ, ԫp ԫѡ Ѭ߫,

p὿ߴ ߡ ߽ѡ p ߫ү ݽѼѡ pѡ.

pԿ߬ pѡ, p὿ү ᬫ ߽ѡ, ߻ Ѭ

p ߽.

᡿ - ԫӫ ߡ󡫮 ߻߫ ѡԿᵿ - ᡫ ߻᡿Ѽ

߫ Ѭԫ, ѡ ԫ ᡿ߴ "ѽ",

Ҭ ѡԿѼٮ Ѭ. ᬫ ߫ٮ Ѭ ߴ

ҬѽѼ ٽ. ѽ Ѭ-Ҭѽ Ҭ

Ѭ, ԫ ߽ Ѭ-Ҭѽ, "Ἣ ", " "

( Ҭ ᬫ Ѭ). ѽ, ԫٮ Ҭ

Ѭ ẽ ߫, ߴ ټ ҬѽѼ. ѽ,

ԫٮ Ҭ ԫ Ѭ ѽѡ , ߴ

᡿ѡټ ҬѽѼ.

ٮ Ҭѽ ٬ ӫἼӫ᡿ ὿ߴ Կ ADDRESS.

諡Ἷ ԫ Կ 󽴯ߴ ӫ ἴԿ .

߫ ԫ ߴ , Ѽ ߽ NIL

ѽ Ҭѽ, ԫٮ Ҭ.

᡿ѡٮ Ҭѽ ѽߴ ẫ "POINTER TO", ӿ:

TYPE ѽ = POINTER TO Ѭ;.

Ѭᵿ ѽ ҬѽѮ, ԫ Ҭ ԫ

Ѭ Ѭ. ԫ ߼߽ ٮ Ҭѽ

ѽ Ӽ ߽үڿ ẫ:

TYPE ADDRESS = POINTER TO WORD.

ᡡ ߿ ٬ ӫἼӫ᡿

TSIZE (ADDRESS) = TSIZE (WORD) = 2 ().

p ԫ Ẽ ӫ ߫, ѽѼٮ ڡ

Կ ADDRESS, ߫󽴽 16-Ӵ 216 =

65536 = 64*1024 = 64K. Ѽѡ ޿ӿ ߡ ӫ

( Ἤ ԫ ӴԿ ) ӿѽ ߿

٬ ӫἼӫ᡿ ѽѡ Ẽ ݽѼѡԫ ѡ ߫ 2

:

TSIZE (ADDRESS) = TSIZE (ARRAY[1..2] OF WORD) = 4 ().

ӿ ԫ ADDRESS ӻԿӫߴ Ҭ:

TYPE ADDRESS = RECORD

SEGMENT, OFFSET: CARDINAL;

END;

߻᡿ ԫӫ Կ߬ ߡᡫ Ѭߡ ѡԿᵿ

Ѭ. SEGMENT ѽ ѡ ӫ ߫,

ԫѼ ߼ѡѼ (OFFSET), ԫӫ ᡿ߴ "ԫ"

ѡ ѡ ѡԿѼ Ѭ.

Ѭ-Ҭѽ (ٮ ᡿ѡٮ) ѡԿߴ

ѡѼ, Ѭӿӫᡡټ ӫἼ. ѡ Ҭѽ, ߫ᡴѼ ""

Կ ѡѼ, ѡԿ Ѭ (Ҭ

). ѡԿᵿ ӫ ѡ 󫽴 Ἷ߬ (

ӫ ٻѡ ӫἼ) ѡ "ѡ ѽ" Ҭѽ

߫ѡ ѡԿӫ ẽ Ѭ. "ԫ" ѡ᡿

ᬿ 󫺼Ѯ. 쿪 ӿѡ ߬ ᵿ ٽ

ѡԿᵿ Ѭԫ ҬѽѼ " ѡ" P.

TYPE : ... ; VAR P: POINTER TO ;

ؽѼѡ xѡ Ҭѽ

+-----------------------------+

꼴: P | ѡ Ҭѽ *--+---+ (P=NIL)

+--------------------------+--+ v

+---+-----+--------+----+ -+-

| | | -+-

| | | |

+--v---+-----+--------+-------+

| +++ | | v | +-+ Ѭ

| +-+ v v | +-+ p

| +++ +++ |

| +-+ +-+ | Ѭ

| | Pԫ

| P pp ἴԿ |

+-----------------------------+

ѡ ѽ, ѽѼ 󫺼ټ ѡ Ҭѽ P,

Ԭ һ Ѭ . ѡ ѽ,

ҬѮ "pԫ", P, Ѭӿӫᡡ POINTER TO ,

ߴ Կټ, ѽ P=NIL ԫ Ҭ.

ѡԿᵿ Ѭԫ Ѻ ٽ Ԭ 󫺼Կ ᡿ᵿ

Ἷ߬ Ѽ ᡡ pҬp. Ѭ, ԫ

ҿүߴ ᬿ Ҭ, 񫽪 " 󴺿

ѬἿ", ԫp ߻ѵpߴ Ҭѽ. ӿ,

TYPE ؽѼѡ_ = RECORD

A : ;

B : POINTER TO ؽѼѡ_

END.

쿪 ӿѡ ߬ ᵿ 񡫮 ᡡ pҬp -

pҬp 諽, ߫ѡ ᬿ ݽѼѡԫ.

+--------+ +----------+

| v v P | v

| +---+---+ +---+---+ | +---+---+

| | A | | A | | | A |

| |-------+ +-------| | +-------|

| | B *-+-------->+ B *-+-----+ | B * |

| +-------+ +-------+ +---+---+

| |

+-----------------------------------------------+

VAR P: POINTER TO ؽѼѡ_

ԫ ᵿ ѡٮ Ҭѽ P ߽ѽ ( ѡ

ѽ Ѯ) Ԭ һ Ѽ ݽѼѡ pҬp 諽.

Կ, ԫ ԫ ᵿ ( Խ Ѯ) ݽѼѡ ѡ

Ҭѽ P Ҫ ѡ. ӫԫ Ӵ ߫ pѽ pѡ

Ҭѽ - ԫ ٮ ӿѼ ߬ ᵿ pѡ

ᡡ Ҭ.

ӿѡ ѡ Ҭѽ ߬ ӻԿߴ

ѡѡ ѡ ߫үѮ ѽ (ᡫ, 󿪬

Ҭѽ Ѭ). һ Ѭ Ѻ Ҭѽ Ԭߴ

Ѽ ѡ᡿ Ҭѽ ߫ "^". , ӿѡ

ӿ һ Ѭ Ѻ P: POINTER TO

ؽѼѡ_ ѫի񿼫 ߻ ὿ѡ P^.A. Ѽ

"޿ӫ" ߽ү ߽ѽ һ:

P - һ Ҭѽ, ѡԿүѼ ؽѼѡ_;

P^ - һ Ҭ ؽѼѡ, ԫү Ҭ P;

P^. - һ p (ѡ) ԫ Ҭ;

P^.A - һ p .

ٮ ὿ѡԫ Ԭ һ "Ѽ" ҡ

Ѭ ( p). p Կ, ԫ ԫ ӿ ( Ѽ

߽)

SIZE (P) # SIZE (P^) # SIZE (P^.A).

Կ, Ѽ SIZE (P^) ԫ pp?

P "^" (ѽ) ᬽߴ "ԬԿ" һ Ѭ

Ѻ ѡ ҬѮ ٽ. ꡫ pᵿ pạ

"p߬pԿѼ ٽ". ߻ ߿ "^" ѡ

Ѭ, ԫٮ ߴ ҬѽѼ, Ѽ ߽ Կ.

߻᡿ ὿ѡԫ ߿󫽫 "^" ԫ ӿ߫ѡ

ӫߴ ߡ󡫼 , Ҫ ٽ ᡫ ӿѡѽ

ӫᡡټ Ҭ. ߽ , ԫ ӿ߫ѡ

ѽ߫pạ ԫѬ pѡ:

1) ߫ѡ ᡵ һ ѡ ӫᡡ Ҭ;

2) ѡ Կ, pếѽԿ pҬpԿ ppἼ.

佴 ߽ P: POINTER TO ؽѼѡ_ ߻᡿ ԫ

WITH P^ DO < ӿ߫񿡴Ѽٮ ѡ > END

p὿ p߫ѡ ؽѼѡ_p, pẼѡ ἴԿ "" P,

ԫ

WITH P DO < ӿ߫񿡴Ѽٮ ѡ > END

p὿ p߫ѡ ԫ (!) p Ἣ Ҭѽ

(.. SEGMENT OFFSET) ᬫ ߼߽

p߫ѡ ؽѼѡ_p. ԫ 󴺿 ᬪ ԼԿ, ԫ

ӿ߫ѡ, Ѭӿӫᡡ ߫үڿ ԫӫ WITH, ٻߴ

߽ ԫ, ѽѡ ѡ ӿ߫񿡴 ὿ѡ, ..

"ի" ӿ߫񿡴Ѽٮ ѡ. ūԫ ѡѡ ѡ

p߫񿡴 Ҭѽ ӿ ӿ߫񿡴Ѽ ѡ ѡ Ҫ

߫ᡡ ӿ߫ѡ ѿѪ p޿ ٻѡ ԫ

pѡ. pѼ pp:

VAR P: POINTER TO ;

BEGIN ... P:= ...; (* ᡫ P *)

WITH P^ DO ...

(* ԫ, ԫٮ Ҭ P *);

P:= ...; (* ᡫ P ٮ *)

... (* ټ ԫ *)

END.

ԫ ӿ ᡫ P " ٮ " ӿ ѡѡ Ҫ

߫ᡡ ӿ߫ѡ ߫ѡ " ټ ԫ" Ѻ

Ҭӫѡ ѡԿԫ ߫ԫߴ - ԫ ѡ ӫ񫽪 ߫

"ټ" ԫ. Ѻ᡿ ԫ ԫѽ ߽Ҫ ԫ

ѡԿѼ ޿, 󫺡ڿ ԫ p ѡԿᵿ

Ѭԫ ԫ Ҭ᡿.

ѽ Ҭѽ ѡԿᵿ ӿ Խߴ ѡ᡿

Ѽ, ԫ ߻ ߻ѵ ѡԿүڿ Ѭ - Ҭѽ

( ٽ), ԫټ ټ "ټ"

ѬἿ. ԫ ѡ ޿Ӵ 󫺼Կ "ԫ" ѡ᡿

󫽴 ὿ Ἷ߬ү ѡԿᵿ ẽ Ѭԫ Ѻ

ԫ Ҭѽ, ѡԿѼٮ ѡټ ӿѡټ Ѽ

ѡѼ.

IV. PPf

ū. - Կ Կ. - ҡ ѫẫ᡿ ӿѡ

Կ. - ỿ߿ ӿἿ. - ߽᡿ . - Ļѽѡ "

ὫѡѼ ". - ἫӻԿѼٮ Ѭ.

Ӽ "ӻᵿ" ѽ "ӿ᡿" Ѭ ѽѡ

ѼԿ߬, ߼߽ . ӿ, ߿ "I", ӻԿѼٮ

"ɿ߬_", ߫pߴ Ѭԫ ѽѡ ߿Ѽ

߽ѡ, ӿѼ ߫ټ Ἷ ԫ ߿Ѽ.

ԫ Ѽ "I" "" Կ߬ ӿߴ

߫ѡ Ἷ. "I" Ҭ ߬

߫ѡ , ԡԿ, ѽ ߫ ӫѡ "",

Ҭ Ѽѵ ᬿ .

ѡ ӻᵿ ԫ Ѭ ԿѼ

. pѡѼ ӻᵿ Ѭԫ

ὬѼߴ Ҭ - ԫ

pԫ (ẫ Ҭ) ѽ ߻᡿ Ѭ

(߻ .ѡ "ӿ ڿ", ٮ ӫ

ӻԿӫ ѡү ߬᡿

ի), , ᬫѵ, ԡ ӻԫ: -

ԫ ӫ - ԫ , -ԫ ޿.

ӫἼӫ᡿ Ѭ ᡡ ѽߴ ԿѼ

ݽѼѡ ѡ, Ҫ ߻ᡡټ ڿ .

ἴԿ ݽѼѡ ѡ ߫Ӫ ߽ѽ ҽѮ

񿡿, ӻᵿ ԫ ߽ѽԿ Ѭ

߿ ӫἼ. 髻ӫ ԫ, Ѻ ᬿ "" (, ߬)

߼ӿ ݽѼѡ ѡ. ԫ ߼߽ Կ ԡ Կ

ӫἼӫ᡿ ٻ ӫ ᬿ (, ߬).

 Կ ѽ 󫺼 ӻᵿ Ѭ.

ԫ ٬ 3- ѡ ߡټ ߴ Կ ߫ԿԿ

Կ. ߼ӿѼ ߻Ѭ ᬫ ߫ԿԿ: ߫Կ

ѡ (ѡ) Ѭ ἴԿ ߫Կ ߫ѡ

ӻᵿ.

Կ ѡ ѽߴ ẼἿ ݽѼѡԫ ѡ.

ӿ, ߽ Ѭ Կ CARDINAL ᡴߴ 񡫼 ޿ ߽ (2

) Ѭ Կ INTEGER ᡴߴ 񡫼 ߽, ԫ INTEGER CARDINAL

߫Կ ѡ (Ѫ ߫ ޿ټ Կ WORD).

AὫ ߫Կ ѡ CHAR BYTE; WORD ARRAY [1..2] OF

BYTE ..

Կ ӻᵿ ѽߴ 󫺼 ߻

Ѭ Ѭ . ӿ,

󿽬. ӫἼӫ᡿ ߫Կ ӻᵿ

ߴ 󫺼 ӿ᡿ Ѭ ѡ

Ѭ ߴ ߫Կ ӿ᡿. ӿ

ᬫ ߫ԿԿ:

VAR A: CARDINAL; B: INTEGER; BEGIN ... A:=B .

Կ ӿ᡿ Ҽ ߫Կ

ѡ Ѭԫ.

ūԿ ߫ԿԿ Կ ߽ ѽ ٬ ӫἼӫ᡿

"ӫ" "ӫ". һ ٬ 󿽫 ߴ

󫺼 Ӵ ߻᡿ Ѭԫ ạ ߫ 񡫼

ѡ. ᬫ ѡ ѫի񿼫 ҿӫ ߡ ߻ѵ

ҡ ѫẫ᡿ Կ, ӿѡ Կ ߻ѵ ԫ

߫ѡ Կ. Ҽߴ, "ѻѡ ӫԿ" ٬ - Կ

߽, ߿ ү ߬ѡ ԫ .

"ӫ" ٬ 󽴯 ӫἼ ү ӻᵿ

Ѭԫ: 񡫼 ѡ "߼޿" ߫ԡ ẽ Ѭ,

ӿ ԫ, Ҽߴ, "ѡ" ԫ, Ѽ ӿ ᬫ

߼ѡ, ߴ ѽ. Ѭԡ-ӿѡԿӫᡡٮ Կ

ӫἼӫ᡿ Ѻ߽ ѡ "ӫ" ٬

ټ Ἷ ӫ ߫ԿԿ Կ, ԫ Ѽ ߽

Ѫ ߫Ѽ ӫἼ, իԴ 󫿼

"ӫԴ" Ѭԫ "ԡټ" ӫἼ.

ҡ ѫẫ᡿ ӿѡ Կ ὿ү 󫺼Կ ߫ѡ

ӿ᡿. ӿ ԫ ᡿ ᬫ ߫ѡ ѫẫ᡿

ӿѡ ߴ ߫ѡ ẽټ. ӿѡ Կ ᡫ

ᬿ- ѫẫ᡿Ѽ ߫ү ѡ ݽѼѡ ѡ.

ᬫ ѡ ӫԫ "ߴ " - ӿߴ

Ѽѡ Կ. 佴 ὿ᵿ ӿѡ Կ ѫի

߫Կ ѡ ߫үڿ ݽѼѡԫ. ӿ:

VAR A: INTEGER; B: CARDINAL;

BEGIN A:=-3; B:= CARDINAL (A); ...

CARDINAL() ߻ߴ ҡ ӿѡ ѡ Կ

CARDINAL. ᬿ ѡ ߻ߴ ῼѡ᡿ ẫ

޿-ӿѡԿӫᡡ Կ. ӿ ߻᡿ ҡ ӿѡ Կ

ӫἼ 񫽪ѡ իӫޫ ѡ Ѭԫ

"ѫᡡԿ" ӻᵿ . (ӿ, ԫ

ӿ "-", Ѽٮ 񿡿Ѯ 15- Ӵ ݽѼѡ ѡ A,

B ӻԿӫߴ 215. 櫫ѡ ߽ ӿѡ B =

215 + 21 + 20 = 32771). Կ߬ ҡ ӿѡ Կ ҡ

߼߽ 󽴯ߴ. ߻᡿ ߽ ٬ (ᬿ

CARDINAL, BOOLEAN, INTEGER ..), ѽڿ ѡ ẫ Կ,

Ѭ BEGIN ... END ѫի񿼫 ߽ԫ ԫ ӫ

ѬԡԿ ѡ, ߫ѡ Ѭԫ ẽ Կ.

ѫẫ᡿ Կ ԫ ߼߽ - ӫԿ󫻫 ӿѡ.

ߡ ѬԿ ᬫ ѫẫ᡿ (CHR, ORD, VAL, FLOAT, TRUNC)

὿үߴ ӫѡټ ѽѡټ ӫἿ. ᬿ ҡ

޿Ӵߴ ߻᡿ ߻ѵ Ѭ. p

ҡ ѫẫ᡿ ԡߴߴ ߽ټ ԿἿ ӫ

߫үѮ . ӬѼ ߻Ѭ

߻᡿ ҡ VAL. ū߬, Ҫ ԼὫ, ޿

ẫ Կ ὿үߴ ߡ ߽ѡ, VAL

߽ټ. ߿߿߬ Ҭ ٺ VAL ӿ

ԫ ߽үڿ :

:=

VAL (, ).

Կ B ߻ߴ ԫ ẫٮ Կ, ὿Ѽٮ

ߡ ߽ѡ ( Կ ӫ REAL "ӫ"). Ѭԫ

CARDINAL ԫ Ҭ Ѽѡ,

. ӿ,

VAR c: CARDINAL; b: BYTE; i: INTEGER; ch: CHAR;

BEGIN ch := 'A'; c := 32771;

i := INTEGER ( c ); (*1*)

i := VAL ( INTEGER, c ); (*2*)

b := BYTE ( ch ); (*3*)

b := VAL ( BYTE, ORD(ch) ); (*4*)

b := VAL ( BYTE, c ); (*5*)

ᬫټ Ѻҽ ӿ ᵿ (1) (2)? (3) (4)?

ᬫ Ѻҽ ӿ ᵿ (5)? , ԫ ᵿ

ѫẫ᡿Ѽ ѡ Ѽѡ ߽ ӿ

߫ԿԿ ѡ.

ҡ FLOAT TRUNC ạѡ ὿ᵿ "ի"

ӿԿ ѽ ӿԿ Ѯѽ ѽ ӫ. ġ ӫ

ӫἼӫ᡿.

Ҭѽ ߫Կ ѡ, ߻ѡ ߫ԿԿ

ӿ᡿ ᡫ ߻᡿Ѽ ҡ ӿѡ ADDRESS. ѻѡ

"ӫԿ" ߫ԿԿ ҬѽѮ ߴ ạ

߿ ԫ ٬.

񡿼 ӫѡ ѻ ٬ ӫἼӫ᡿

ѡ ߴ ѡ Կ Ҭ, ԡ

᡿Ѽ "ỿ߿ ӿἿ" (ỿ߿ "Ἷ", ỿ߿ Ѽѡ

Ҭ). ᬿ Ҭ ߴ ߻ѵ ѽڿ (ڿ)

, ѽڿ ӻᵿ Ѭ. ӿ, Ѭ

"ѡ" ӿߴ ߽үڿ Ἷ:

- ߻Ѽ,

- ӿѪ һ,

- ἿѮ,

- Ẽӫ Ѽ Կѡ.

ӿ ӿڿ ѡ, ߽ ԫ

߻Ѽ. ߻ڿ ѡ ӿߴ ߫ټ

: ӿ, ߴ ԫ ߽ѡ .

ᬿ ẫ, ߻Ѽ ѡ ԡ߿ߴ ӿ ѽڿ

: ѡ ԫ ѽ ߻ڿ ѡԫ,

ӿѼ ὿Ѽ 񫻫ѽ , ѡ

߻ڿ. ӿ ԫ "߻ڿ ѡ" "߻ڿ ѡ"

ӿߴ ạټ ҬἿ Ѭԫ:

TYPE ߻Ѽ = ( Խ, , , );

߻ڿ_ѡ = RECORD

FAM : Ἷ;

GR : 쫼_һ;

SB : ߻Ѽ;

ST : REAL; (* Ẽ Կѡ *)

END;

߻ڿ_ѡ = RECORD

FAM : Ἷ;

GR : 쫼_һ;

SB : ߻Ѽ;

__߽ѡ : ( , )

END.

Կ, ԫ Կ Ҭ ڿ Կ, Խ

ԫ ߽񡿼 (pԫ, Ѽ). ١ߴ ѽ

SB ӿ, ߬ҿѼ Ҭ Ѭ

ỿ߿ ӿἿ:

TYPE ѡ = RECORD

FAM : Ἷ;

GR : 쫼_һ;

CASE SB : ߻Ѽ OF

: __߽ѡ : ( , ) |

Խ, , : ST : REAL

END

END.

ѡ ߽ Կ ߻Ѽ ԫ ӿ ѽ

ӻᵿ Ѭ ߻, ߻

ѡ. ᬿ pẫ p pҬp ỿ߿ pἿ

ᬽߴ 󫺼Կ ppᵿ pԿ󡫮 ߡ.

ԫ 󴺿 󫺡 ӫ ߻ѵᵿ ѡ Ҭ

ѡ. ġ ߫Ӫ ԫү

TSIZE (Ἷ) + SIZE (GR) + TSIZE (߻Ѽ)

Ѽѡү (p pԿ), Ẽ ԫӫ ѽߴ ѡѼ SB.

ԫ ( ߽ SB = )

SIZE (__߽ѡ) = 1; ,

󫮡 ߽ ( ߽ SB # ) SIZE(ST)=4. ᬫ Ẽ ἴԿ

ѽ ߽ԫ ݽѼѡ ѡ Ѭ "ѡ"? ѡ

ѡ - ߿ 󫺼ٮ, ԫٮ ߴ ѡ

ᡡ ѡ. ū߬ TSIZE (߻ڿ_ѡ) > TSIZE

(߻ڿ_ѡ), ߽ԫ ѽ ἴ, ԫү ѡ

ᡡ ߻Ѽ ѡ. ߽ ᬫ ѡ Ѯ Ӵ

߻ڿ, ԫ ݽѼѡ ѡ ӻԿӫߴ

߫ ԡѡѼ ѽѡ SB=. ӿ ԫ p ,

ѽѡ ߽ԫӫ ST ߻ ѡ, p

߽ ӫԫ ߻ߴ, ٮ

ӻԿӫߴ ߫ᡴڿ ѡ

__߽ѡ.

Կ, ԫ ѽڿ , һ󽴯ڿ ӫ ӻᵿ,

ѡߴ. ᬿ ߽ pԿ󡫮 ppᵿ

pѽߴ ѽڿ , Կ߬ ߻᡿Ѽ ѡ

p pѡ Ѭ. pp:

TYPE ѡ = RECORD

FAM : Ἷ; GR : 쫼_һ;

CASE : ߻Ѽ OF

: __߽ѡ : ( , ) |

Խ, , : ST : REAL

END

END.

VAR V: ѡ. p ԫ ݽѼѡ pѡ V ѽ

, ԫ pẼp TSIZE(Ἷ)+SIZE(GR),

pԿ pẼp

max {SIZE(__߽ѡ), SIZE(ST)}.

pѡ Ѭ pѺ ὿ѡ V.__߽ѡ p

ppᵿ pԿ󡫮 Կ ߫ p߽ټ Կ (,

), pѡ V.ST - ppᵿ ԫ Կ ߫

Կ REAL. Կ, ԫ pԿ ppᵿ ߴ

"ԫ", ᡡ 󫺼Դ 󫺡ѡ

񫻫ѽ ޿. ὿ pҬp pԡ Կ ߽

pp Ѭpᵿ Կ ѽ (߻Ѽ), ᬪ

ԫ Կ (,Խ,,), p p, ߽ѡ ԫ

񡿼 ԫѽ: pѼѡѼ ߫p᡿ ү ߿߿߬ү pҬp

ỿ߿ pἿ. ߼߽ ppѬԡ ppᵿ Կ Ѭpᵿ

ѯ ᬫ ѡ - pp ѡ ү

ѽ 󫺼!

Ѽ ߽ Ѻ߿ ԫ, ѡߴ , ỿ߿

ӿἿ ᡿ p 󫺼 ӻᵿ Ѭԫ

pԿ󡫮 ߡ. ԫ ߫ԫ pѡԿpү p Կ pҬp

p pԿ󡫮 ppᵿ Ѭԫ.

὿ ڿ Ѯ Ҭ ߼ѡ ӿ ߻ڿ_ѡ

߻ڿ_ѡ ߴ ӡټ ӫἼӫ᡿.

ԫ ߼߽ ỿ߿ ӿἿ ߼ӿ Ӽ ᬫ

᡿ Կ, 󫽴ү ߴ ԫӫ ᡿

Ѭԫ. Ѭԡ-ӿѡԿӫᡡ ٬ 񫻫ѽ

󫺼 ᬫ ᬫᵿ, ѽ ү ӻᵿ

Ѭԫ pԿ󡫮 ߡ, ߡ p޿pѡ .

󫺼 ᡿ ߽᡿ .

᡿ ߽᡿ 󫽴 ᬫ ẽ Ѭԫ

Ѽ ѽѡ ڿ . ᬫ ѽѡ ӫߴ ߡ

ԡѡ " ԡ" - ѡ. ѡ ѽѡ

Ӽ ߡ ԡѡ 󬽯ѡ 񼡫 .

- Ѭԫ ѡԡټ Ἷ (A): A = {a/P(A)}, a B

= {b/P(B)}. ߽ P(A) IN P(B) (P(A) ߴ 񼡫 P(B), IN -

ԡѡ 󬽯ѡ), ԫ "" (A*>B, "*>" - ԡѡ ѡ).

ԡѡ (*>B) ߴ ߫, - ߫, ӿ ԫ

Ѭ ӿߴ ߽Ѽټ Ἷ P(A)

ӿѡټ P(B)-P(A). ӿ, ԫ Ἷ

߻ԡ Ѭԫ ߫ѡ "ԫ"

, ԫټ ᬫ ߻ԡ , , pp,

. ԫ ߼߽

߻ԡ_ *> ԫ, .

ӿѼ (ԫ)^P() = P(߻ԡ_). ( ߿ "^"

߻ߴ "ѡ "). , ԫٮ ߴ

ᬿ , ߴ Ӵټ ߫. ߡ ѡ

ѡԡ ߫ ӫѡ Ѫ߫ ԡѡ

񿡿 ߽᡿, ԫ ѻѡ ߴ

. ӿ,

߻ԡ_

*

|

+------------------+---------------------+

| |

|ԫ |

+-----*-----+ +-----*-----+

| | | |

| | | |

* * * *

Һ Ӭ f

ԫ

|

|

|

*

ѼԿ ѡ ԡѡ ԡ Ѽѡ ߿

ᬫ ᡿ ߫ ߡ 񿡿 ߽᡿

"" Ѭԡ. ӿ,

TYPE ѽ = RECORD

A: ; B: ᮬ;

END; .

Ӽ ԫ ӿ ѽ ѡ: *>ѽ (ᮬ

*> ѽ), ᬫ ҿԿ ߻ӿߴ ӿ

ԡѡ .

Ѭ, ҿѼٮ ߡ ԡѡ ѡ, ߴ

Ҭӫ Կӫᡡ (߽ѡ) . ӿѼ ٮ ߽

() ᬫ Ҭ ạѡ ٻѡ ӫ ݽѼѡ

ѡ ߫ү ӫ 󬽯ѽ.

ӿ, Ѭ "f" (߼. Ѽ ) ѽߴ

Ҭӫ:

TYPE Ҭ f = RECORD

: ߻ԡ_;

: ;

: f;

END; .

ӻᵿ f ߻ԡ ԫ

߻᡿Ѽ ߽ ݽѼѡ ѡ. ӻᵿ f -

߻᡿Ѽ ߽: , , ᬫѵ, ӻᵿ f

߫ ߻᡿Ѽ ߽: ,,.

Ѭᵿ "Ҭ_f" Ѭԡ-ӿѡԿӫᡡ ٬ ѡߴ

ԡѡѼ

f . (NEW DISPOSE - ӫ, ٺ

߽үߴ ٺ ALLOCATE DEALLOCATE ߫ѡ). ߻᡿

NEW DISPOSE 󫽴 Ѫ ѼԿ߬ ޿, ᡡ

ẽټ ѡ N ߽ѽԿ ٺ ALLOCATE...DEALLOCATE,

ѽѮ ߫᡿/ҡԫѡ ԫ Ѭ.

ѽ ߽ѽ ٺ NEW...DISPOSE ( ߫ѡ

ALLOCATE...DEALLOCATE), Ѽ ߽ ѽѼ

ӫἼ, ӫ Ӵ ӫѼ, ᡡ ᡿ᵿѮ

߻ѽѡѼ ӫ Ἷ߬ ἴԿ. 񡫮 ᬿ

ӫѼ ߴ ӫѼ ѡᵿ. Ѭ ѡᵿ ᬽߴ

ԫ, ԫ Ἷ߬ ἴԿ "ӫߴ" Կ -

ѡ ẽ 񽿡. ᬿ-ԫ "ᡴ" - ߻үߴ

ӫἼԫ ݽѼѡ ѡ Ѭԫ, ᬿ-ԫ "",

ӿѼ ᡿ ᡴ ѡԫ Ѽ ߽

߫ѡ ӫټ. ӫ ӫἼ ߫᡿

Ѭ ӿ ԫ, ԫ ߿Ѽ һѡ Ἷ߬ ἴ

"" Ѽ ѡ, իڿ Ẽ. ᬫ

ẽ, ᬫӡ : ᬫ ѡ 񫽪ѡ

Ẽ, ѡ޿, Ѽ ޿Ѽٮ ӫἼԫ. ߽ իڿ

ѡ ޿ Ẽ, Ѽ ߴ, ӿү ӫἼ

, ԫp ѻp p߼pߴ ߿Ѽ ᡴٮ

pѡ, ԫ ߴ 񡫮

pѡ. ӿ ԫ ӫѼ ѡᵿ ᬽߴ ԫ, ԫ Ѭ

"ӫѡ" ӿԿ ԫ, ԫ 񡫮 իߴ

"ѡ" ӫѡ ѡԫ, ߫һԿ

߫󽴯ڿ ԫٮ Ѽ. Ѽ ѡ, ߼Ӵ ᬫ Ѽ,

ӫ ӫἼ ٮ ݽѼѡ ἴԿ Ԭ ӿ

ѽ ի ݽѼѡ. 쿪 ӿѡ ѡ ӫἼ

Ѽ ߻ѽѡ Ἷ߬ ἴԿ, ӿүڿ Ѭ

ѡᵿ. ӿ ԫ ӫԫ 񻫽ߴ, ԫ ڿ Ѽ

Ἷ߬ ἴԿ ߫ 20 .

TYPE = POINTER TO _1

_1 = RECORD

ԫӫ_1, ԫӫ_2, ԫӫ_3:CARDINAL

END;

= POINTER TO _2;

_2 = RECORD

ԫӫ_1, ԫӫ_2, ԫӫ_3, ԫӫ_4:

CARDINAL

ND

VAR T1, T2: ; 1, 2: ;

BEGIN NEW(T1);... NEW(M1);... NEW(T2);...

DISPOSE(T1);... DISPOSE(T2); NEW(M2);...

+-------------------+ -+

| WORD | |

+-------------------+ |

| | > ٮ ѡ,

+-------------------+ | ߻ᡡٮ

| | | Ѭ 1^

+-------------------+ -+-+

| | |

+-------------------+ |

| | |

+-------------------+ > ѡ, ᡴٮ

| | | Ѭ 1^

+-------------------+ |

| | |

+-------------------+ -+-+

| | |

+-------------------+ |

| | > ٮ ѡ,

+-------------------+ | ߻ᡡٮ

| | | Ѭ 2^

+-------------------+ -+

꽽ᵿ ӫѡ ѡ Ԭ ӫ NEW(M2). ԫ ѡ

Ѽѡ Ἷ߬ ἴԿ ѯߴ ѡ ڿ Ѽ

߽, ԫ ԫ ٻѡ ӫ ѽѡ ݽѼѡ

ѡ Ѭ 2^ (.. Ѭ, ԫpٮ Ҭ M2),

ᬫ ѡᵿ 󫽴 ߿Ѽ ѽ ἴ Ѭ 2^.

Ѽ һѡ Ἷ߬ ἴ ߻ѵٮ ߻߫

pѡԫ - ҽ ἴԿ. ӿ ѡ ᬫ- ݽѼѡ ѡ,

߻Ѽ ӿ񡫮 ӫἼ, ҽ 񡫮 ἴԿ

὿ᡫ "߬ѿ᡿" ߫ pѡԫ pѡ

Ѽ. ӿ, ߽ Ѯ ӫἼ ѡ

߽ѽ ѡ Ἷ߬ ἴԿ ӿѡү , ԫ

ᡡ Ԭ ἴԿ ӫ:

BEGIN NEW(T1);...NEW(T2);...NEW(M1);...

DISPOSE(T1);...DISPOSE(T2);... NEW(M2);...

ӿ Ԭ ӫ NEW(M2) ҽ Ἷ߬ ἴԿ

իߴ ٮ ѡ Ѽ ߽, ẫᡡٮ

"߬ѿ᡿Ѽ" ݽѼѡԫ 1^ T2^, ٻѡټ ӿ Ԭ ӫ

DISPOSE(T2). Ѽ ߽ ӫ ѬԿ󡫮 ὿ᵿ һѡ

Ἷ߬ ἴ, ߻Ѯ Ҽ Ԭẫ ӿ ᡿ѡ

Ѽ, ߫󽴯 ѽү ӫѼ. ԫ Կ, ԫ

᡿ᵿѮ ѽѡ " ի" ѡ ἴԿ

ӫἼӫ᡿ ᬿ Ӽ "տ" "", ԡߴڿߴ

߬ ӫ߿ , Ѽ -ԫ߬ Ӽ.

Ѽ ѡ Կ Ӽ ạ ӿү ӿ

᡿ᵿ Ἷ߬ ἴԿ.

᡿ᵿ Ѭԡ ߽ѽԿ ӫ߫ , ӫ ԫ,

Ҽ Ҽ ӫѼἿ. ԫ ӫѼ

"ߴ ٽ" "߫", ѽ ԫӫ 񡫮 ԫ

޿, ᬽѮߴ ѬѬԡ Ҭѽ. үڿ

ѡ ӫἼ ӿ 󫺡ѡ ᬿ ޿ (Կ

"" ).

VAR T1, T2:;

BEGIN NEW(T1);...T2:=T1;...

DISPOSE(T1); (* T2-"ߴ ٽ" *)

............

NEW(T1);...NEW(T2);...

T1:=T2; (* ߴ "߫" *)

ԫ ӿ ԡ, ԫ "ߴ ٽ" - ԫ Ҭѽ ӿ񡫮

ӫἼ, Ҭڿ ٮ ѡ Ἷ߬ ἴԿ. ū߬

ԫ ѡ ѽѡ ߿Ѽ ᬫ- ӫ

ӿ񡫮 ӫἼ, 2 Ԭ һ "Ҫ" ᡡټ

"޿" ӻᵿ . ū߽ ᬫ

ӻᵿ Ѽ ߽ ѻ߬Ѽ. Կ, ԫ "ߴ" ٽ

"" ٽ (ѯ ѡ NIL, ߼. p.III) 󽴯ߴ ߫ѡ

ạټ Կ. "߫" - ԫ ᡴٮ ѡ Ἷ߬ ἴԿ,

ԫӫ ӿ񡫮 ӫἼ Ӵ һ. ӿѡ ӿ

߫ӫ ߴ ٮ 1^, ԫٮ Ҭ 1

󿪬 (ᡫ 2). ԫ ߫ ᡿: ӫἼ

Ѽ һ, ߿Ѽ һѡ "" ߫ ᡴټ ѡԫ

ἴԿ.

񿡴 Կ ޿ ԫѽ:

Ҫߴ ߻ѽ . ѡԿӫ ޿

ԫ Ѽ ѽ ӫӬ Խ ӫἼ. , ᬫѵ,

󫿼 󫺼ټ 󽿴 ӫἼ ߫ "Ѻ"

ߴѮ ٽ. ġ Կ߬ ӿ ԫ ѽѡ ի

ἴԿ, ԫ Ѽ ߴ ٽ ߻߫ ӿ ѽѡ ߽

὿ ӫ ٻѡ ӫἼ. ߽ ߿Ѽ

"ѡ" ߴѮ ٽ ߴ ѡ ߫.

߻᡿ ԫԿ߬ ἴԿ ᡫ ߫᡿Ѽ / ҡԫѡѼ

߻ѵ ݽѼѡԫ ѡ, ᡡ Կټ ѬἿ -

Ѯ󿴼 ӫἿ. ӫ p ٻѡ

߫ѡ . ūү ү

Ѽѡ, ۴ѡ ӫ, Ӽ ,

ݽѼѡ ѡ ӫ, .. Ѭԫ,

߻ڿ ٻѡ Ѯ, ᡡ ӫӫ. ѫի񿼫

󫺡 ԫ ѡ ٺ ӫ - ѡ

ӻᵿ Ѭ ӫӡ Կ. ū߽ ѡ ᬫ

ӻᵿ ѫի񿼫 Ѻ. ᬿ ẫ,

Ѽ ᡿ߴ ѼѡѼ Ԭ ӫἼ,

ԫӫ . 櫫ѡ ӫ ߫᡿

ٺ ӫ, ӫ ҡԫѡ - ᡿Ѽ

ԿԿ Ѭ (ԫ RETURN END ѽ ӫ). ӿ:

VAR W1, W2: PROC;

PROCEDURE _1;

VAR A: INTEGER;... BEGIN... W2;...

END _1;

PROCEDURE _2;

VAR A: INTEGER;... BEGIN... W2;...

END _2;

BEGIN... W1:=_1;... W2:=_2;... W1;...

ԫ ѡ Կ Ѭ ӫӡ Կ PROC =

PROCEDURE(): W1 W2 ӫ Ѻ ӫ: _1 _2,

ԫ ߻ߴ Կ PROC. ӻᵿ

(Կᵿ) W1 ӿ ٺ _1 ߫᡿

(߫ӪѮ Ѽѡү ). ӫ ٻѡ _1 ӫߴ

Կᵿ Ѭ W2 ߫ѡ ߫᡿

_2. Ѭڿ ѡ Ѽѡ ߿Ѽ Կ

߬ Ѭԫ. ( ԫ ӿ Կᵿ W1 ӿ Կᵿ

W2, Ѽ ߴ Կ󡫼 ߫ԫ Ѽ Ӵ

Կ ԡ ߽ѽԿ: ߡ ߿ߴ W2, Ѽ

W1). ū߽ѽ Կᵿ ߿ᵿ 󽫪ѡ

ٺ ӫ, ߫ѡ һѡ ԫԿ߬ ἴ

ߡߴ ߻᡿ Ѭ - Ҭ, ӪѮ ү

󽫪ѡ. 쿪 ԫ ѡ ӿѡ ᵿ ߻ѽѡ

ԫԿ߬ ἴԿ, ү ѡ ߫ԡ ԿԿ

Ѭԫ W1 W2.

+- +-------------------+ -+

| | Ѽѡ | |

| +-------------------+ > 﫬

| | | | W1

ᡴԫ ӫ- < +-------------------+ -+

| | Ѽѡ | |

| +-------------------+ > 﫬

| | | | W2

޿ --> +- |-------------------+ -+

Ѭ | | |

ԫԿ߬ | | |

ἴԿ | | |

| | > ӫ

߿ᵿ | | | ἴԿ

| ^ | | |

| | | | |

| | | | |

v | +-------------------+ -+

ǬԿᵿ

ӿ Կᵿ Ѭ ޿ Ѭ "߬ߴ 󡿺"

ѽ, ѽѼү ẼἿ ԫ Ѭ,- ӿ

߿ᵿ ޿ Ѭ "񡿼ߴ ". ߻᡿Ѽ

ԫԿ߬ ἴԿ ߡ ӫѼ: Ѭ߿

ѡԿ ߫ᵿ.

Ѭ߿ - ᡿, 󫽴ڿ Ѭ ߫ ἫԿ-.

ӿ, Ѽ:

W1-->W1 (Ӵ Ѭ߿)

W1-->W2 ...-->W1 (ѡ Ѭ߿).

Ӵ Ѭ߿ ѻѡ ԫӡ (󽫪ѡ)

ԿᵿѮ, ѡ - ᡡ (ӿѼ ߽ 񡿬

Ѽ W1-->...-->W1 ӫټ). ߻᡿ Ѭ߿

Ӵү ᡫ ẼἿ ӫ ԫԿ߬ ἴԿ.

߻᡿ Ѭ߿ Կᵿ Ѭԫ, 񡫮 ԫӫ, 󫽴

ѡ ᬫ Ѽ ߫Ӫ᡿ ӫἼ, ԫӫ,

Ѭ߿ Ѽ (߫ѡ ѡ Ѭ߿) ӫԡ

ѡ ѡԿѼ ޿.

ѡ ߫ᵿ ᬽߴ ԫ, ԫ ԫԿ߬

ἴԿ Ѽѡ Ẽѡ ߬ 񡫿ѡ Ѭԫ,

ѯڿ Ѽ ߽ ẽ ѡ ԡߴڿߴ ạټ

ԿԴ ԫ -ᬿ ạ Ѭԫ. ӿѡ

ӿ ү 񡫿ѡ Ѭ: Ѽѡ , ᡡ

(߫ӫᡡ) Կ W1, Ѽѡ , ߫ӫᡡ

Կ Ѭ W2. ߫ ӿ Ѭ ߿Ѽ һpѡ

ԫԿ߬ ἴ p߼p Կ󡫮 ߽񡯯

߫ᡡү ߫ᵿ (ү "" ޿ Ѭ ԫԿ߬

ἴԿ). 髺ѡ ѡԿ ߫ᵿ ߽ѡ ԫ

߻᡿Ѽ ӿ ӫἼ 񡫿ѡ Ѽѡ ẽ

Ѯ ( 񿼫Կ). ߽ Ҫ ߻᡿ ᬿ

Ѽѡ ߴ ѫիټ ( Ѽ ԫ ߫ߴ), ԫ ӿ

ӻᵿ ߽ ѡԿ ߫ᵿ.





!



 

  :
 

© 2010 .