Документ взят из кэша поисковой машины. Адрес оригинального документа : http://sp.cs.msu.ru/courses/prak2/model_lang.pdf
Дата изменения: Tue Feb 25 14:40:51 2003
Дата индексирования: Mon Oct 1 21:45:50 2012
Кодировка:

. - ++.

:
: a) {} , .. , , , .. b) [] , , . c) - , . d) . ( ): <> program { <> <>} <> { <>; } <> <> <> { , <> } <> int | string <> <> | <> = <> <> <> | <> <> [<>] <> { <> } <> + | <> " { <> } " <> { <> } <> if (<>) <> else <> | while (<>) <>| read (<>); | write (<> { ,<> } ); | < > | <-> < > { <> } <-> <>; if while ; read - <>; write ­ , . . .


: not ( ) * / ( ) + ­ ( ) < > <= >= == != ( ) and ( ) or ( ) = () 1


( , ). ; . string : · · + ; , string a = "one", b = "two", c; c = a + " plus " + b; c "one plus two". · < > == != , string a = "one", b = "only", c = "one"; a < b, a == c, b != c; ­ c > b, a != c, a == b. ( , ): ( ) , . I. 1. <> if (<>) <> 2. <> case (<>) of < > end ; < > <> { <> } <> <> { ,<> } : <> if ; case ­ ( , - , ; , ). II. 1. <> do <> while (<>) ; 2. <> for ( [<>];[<>];[<>]) <> do-while for . 3. <> for < > = <> step <> until <> do <> < > <> for I = E1 step E2 until E3 do S, E1, E2, E3 ­ , S ­ , : I E1 E3 E2; S. , . E1, E2, E3 . ( goto) . III. 1. <> < > | goto <> ; < > <> : <> 2. <> continue; 3. <> break; , , , . - 2


. ( ); , , . continue break , . IV. 1. <> boolean <> <> <> true | false 2. <> real <> <> <> [<>] < >.< > < > <> { <> } < > <> { <> } . V. 1. 2. 3. % - VI. 1. "" ( ; , ) 2. ( )


1. , , . 2. . 3. read , , . 4. write , . 5. for I = E1 step E2 until E3 do S . 6. (boolean), if, while, for dowhile . , (0 false; , 0, - true). . 7. case . 8. (boolean), , 1, ­ 2. 3


: § - , , , , . § , ­ true false, ­ 0 (false) 1 (true). § X - , Y ­ ; , "-".

*/% ­*/ ­*/ ­*/ + + ­ + ­ < > <= >= == != < > <= >= == != < > <= >= == != < > <= >= == != < > == != and or not = = = = = = +­ + + +

X int real real int string int real int real real int string boolean boolean int real int real string boolean

Y int real int real string int real int real string boolean int real real int string boolean

int real real real string int real boolean boolean boolean boolean boolean boolean boolean int real int real string boolean

*/% ­*/ ­*/ ­*/ + +­ +­ < > <= >= == != < > <= >= == != < > <= >= == != < > <= >= == != < > == != and or not = = = = = +­ + + +

X int real real int string int real int real real int string int int int real int real string

Y int real int real string int real int real string int int real real int string

int real real real string int real int int int int int int int int real int real string

1

2


: § , , , /* < , */ > */. § . 4


§ §

, , , , . , . ­ , , ( * / % + ­ < > <= >= == != , ; : ( ) { } ).


: § § § ( ) § ( - ) § , .. . VII. : 1. - ; ­ + ( ; ); ­ + + : , . ; ­ . 2. ­ + + + . ­ ; , , ; ­ . VIII. , . , , : 1. ( -) 2. ( -).

5



, , ­ . , ­ . "" () , , , , . , , , . . : " " " ". " " , . " " , , . , . , , , . " " . ­ , . " " , , . , . , . - " ", . 1. . . . ., . "", 1980. 2. . . . ., " ", 1982. 3. . , . , .. . . .,"DiaSoft", 2001. 4. . , .. - . . .,"DiaSoft", 2002. . ­ , . : , .. , (-), , .. , (-). : 6


, , , , 0. - ( ): program { int a = 51, b = 6, c; string x = "abc", y, z = "abcd"; c = (a + b)*2; if (c >= 100 or x == z) { read(y); write(y); write(x + y + z, c); } else c = a = 21; while (c > 100) { c = c-5; write(c); x = x + "step"; } write(x); } : "1234" ( y) : "1234" "abc1234abcd" 114 109 104 99 "abcstepstepstep" B- ( ): program { int j = 6, k; k = ( i + j )*2; /* ERROR ­ i */ write ("ERROR not detected"); }




, , , : · ­ - · , · , (, <>, , / ..) · , · · - - , ( , , ). . II 5. .., .. . . ­ ., . , 1999.

7


, , , 6. . , . , . . . , , . - ., "", 2001. 7. . , . . . . ­ , "", 2002. 8. .. . - ., , 1975. 9. ., ., .. . - ., , 1979. 10. ., .. , . . 1,2. - ., , 1979. , - , , 11. . . - ++ , 2- . - .:, " "- " ",1998. 12. . . - , 2- . - ., "", 2002. ++ , STL 13. . . ++, 3- . ­ ., -, 2001. 14. . . ++, . . - .:, " "- " ",2001.


: ............................................................................................................... ...................................................................................................................................... ......................................................................................................................... ............................................................... ................................................................................ ............................................................................................. .......................................................................................... .............................................................................................................................................. 1 1 3 4 5 6 7 8

8