You are on page 1of 43

1

" ?" , , " :


, printf writeln?"
, , , , ,
.
, , ,
.
, , , :
. " Printf .
,printf , ,
, .
" , , ! ! printf-
? ! ? , ?"
, , , ,
. , , .
, , ,
.
, , ! ,
. , !
. , , ,
.


1.1 ,! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2 . . . . . . . . . . . . . . . . . . . . . . . . . . .

2
4

1.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7
7
7

1.3.3 . . . . . . . . . . . . . . . . . . . .

1.3.4 . . . . . . . . . . . . . . . . . . .

.1
1.3.5 . . . . . . . . . . . . . . . . . .
1.4 . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.4.1 . . . . . . . . . . . . . . . . . . . . . .

8
10
10

1.4.2 . . . . .
1.4.3 . . . . . .
1.4.4 : . . . . . . . .
1.5 . . . . . . . . . .
1.5.1 . .
1.5.2 . .
1.5.3 . . . . . . . . . . .
1.6
1.6.1 . . . . . . . . .
1.6.2 . . . . . . . .
1.6.3 . . . . . . . .
1.6.4 . . . . . . .

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

11
12
12
13
14
14
15
16
17
18
18
19

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

21
21
22
22
23
24
24
24
26
26

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

26
27
27
27
28

1.9.4 . . . . . . . . . . . . . . . . . . . . . . . . . . .

30

.
.
.
.
.
.
.
.
.

30
32
32
33
34
35
36
39
41

.
.
.
.

1.7 . . . . . . . . . . .
1.7.1 . . . . {}-
1.7.2 . . .
1.7.3 . . . beginend-
1.7.4 .
1.7.5 . . . . . . . iffi-
1.8 . . . . . .
1.8.1 . . . . . .
1.8.2 . . . . . . .
1.8.3 -
1.8.4
1.9 . . . . . . . . .
1.9.1 .
1.9.2 .
1.9.3

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

1.10 . . . . . . . . . . . . .
1.11 . . .
1.11.1 . . . . . . . . . .
1.11.2 . . . . . . . . . . .
1.11.3 . . . . . . . . . . .
1.11.4 . . . . . .
1.11.5
1.12 . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

1.1 , !
, "" . 1
2 )(.
1=text editor
2 =IDE: Interactive Development Environment

.1.1 , !
,3 )( ,
) 4(.
)(,
, )( .
, ,
.
" , !" ) (Hello, World! program .
" 5 , !" .
.
, ,C
" , !" .
, , ,
/ , .bash 6
% rm f hello .c; cat << EOF > hello .c
*/
** hello .c: My first C program ; it prints
** "Hello , World !", and dies.
*/
># include <stdio .h
)int main(int argc , char *argv [], char ** envp
{
;)"printf (" Hello , World !\n
;return 0
}
EOF

, bash- % .7 bash

, 8
: , . cat

9 ,10

11

cat << EOF


3 =operating systems
4=compiler
5=string
6 =command shell
7=prompt
8=command
9 =standard input
10 =standard output
11 =programmatic idiom

.1
EOF.

, , . 1.1
,gvim , .hello.c

:1.1 C gvim
, , , .
,:
% cc hello .c

, , :
% ./a.out
!Hello , World

, ,
, . , :
.
,
. ,
, .
, " , !" , ,
, ,
. ,
, ,.
, ,
. , ,
.
,
.12
12=comment

.1.2
. ,
.
--- ,
, , , .

1.2


. , 1.1 gvim
.hello.c

. ,
, 13 .
/ , gtksourceview
. gtksourceview .

, :
.1

14

, , .

.2
.3
.4

15

16

.5 , .
.6 , .
.
17 . 1.1
hello.c .
. " ,
!" .
13=library
14=literal
15 =reserved word
16=identifier
17=convention

.1
/*
** hello.c: My first C program; it prints
** Hello, World!, and dies.
*/

#include <stdio.h>

int main(int argc, char *argv[], char **envp)


{
printf("Hello, World!\n");
return 0;
}

2
3
4

9
10
11
12

C !" , " :1.1


% rm hello .p; cat << EOF > hello .p
{hello .p: My very first Pascal program . It does not do
too muchit prints the string "Hello , World !" ( followed
by a new line), and then terminates .}
program HelloWorld ( output );
begin
WriteLn ('Hello , World !')
end.
EOF

,
% pc hello .p

. , ,
% ./a.out
Hello , World!

. 1.2 ,
{hello.p: My very first Pascal program. It does not do
too muchit prints the string Hello, World! (followed
by a new line), and then terminates.}

program HelloWorld(output);
begin
WriteLn('Hello, World!')
end.

2
3

6
7
8

!" , " :1.2


,1.2 1.1
6

.1.3
.18 ,
,
.19
1.1 char ,int :C .return-
, #include , ,
, 6 .C
1.2 : program
, begin ,
end .
. C
) 1-4 ,(1.1 ) main
,(printf ) ,(10
) 0 (11 :
* ; ] [ } { ) (
1.2 ) ,(1 ) ,HelloWorld
output (WriteLn- :
( ) ; .
, , .

1.3

" , !" ,
. , ,
, . ,
, ,20 ,21 ,22
.

1.3.1

, , .
, .
, ,
.
18 =monospace font
19 =proportional font
20 =reserved identifier
21 =predefined identifier
22 =library identifier

.1
,C , ,
, ,
.
. ,23 ,24 ,25

26

. . :
.

1.3.2

. , ,C
:
,A-Z , ,a-z
0-9

27

_ , .

main printf- ,1.1 ,


.
,
, .C
, , : TEX
, ,
, .

28

, , .

1.3.3

, , ,
,Hello ,HELLO .hello- ,
) (,
, , ,
.
,
. ' ,

29

23=variable
24=constant
25=type
26=entity
27 =underscocre
28 : ,
, ,C .
.
29=class

.1.3
,
, .
, ,
. , , :
,1.7 ,HELLO .hello
, Hello.
. '
;)(foo.bar
, foo ,
)( .bar ,
;)(Foo.bar
,Foo bar
.

30

. ,
, [?] C#
.

1.3.4

, .
, .
, .
, I- ,
X- .
, $
, , %
, ,
.

1.3.5


. ASCII-
. .
, .
30=static

.1

. fileopen ,
,
.file_open
, ,
.
camelCase .
, , , . ,
fileOpen file .open
, . WriteLn
' 7 ,1.2 PascalCase
write ) ln ,(line .PascalCase-
) .
writeln WRITELN (.
, ) ,(-
. ") 1.3 , !" ( ,
.
1

IDENTIFICATION DIVISION.
PROGRAMID. HELLOWORLD.

*** Hello, World! in the COBOL programming language

ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCECOMPUTER. RMCOBOL.
OBJECTCOMPUTER. RMCOBOL.

11

DATA DIVISION.
FILE SECTION.

14

PROCEDURE DIVISION.

16

MAINLOGIC SECTION.
BEGIN.
DISPLAY " " LINE 1 POSITION 1 ERASE EOS.
DISPLAY 'Hello, World!' LINE 15 POSITION 10.
STOP RUN.
MAINLOGICEXIT.
EXIT.

7
8
9

12

17
18
19
20
21
22

" :1.3 , !"


,68 ,
10

.1.4
.

1.4

,
,
. int C ,
. C .int

1.4.1

? ,
. begin ,program end- .
, .
. ,
"" . , :

:

31

.1 , .
.2
.
,

32

: .
, ,
, , , , .
-
. ,
- . ,
, , .
,

33

. ,
;a := b + c

, , .b+c ,
, - .
, ,
31 =recursively defined set
32=expression
33=assignment

11

.1
begin
;a := b + c
end

, .
) C (
: ,
, .
. ,34
- .
, ,
. ,
.
int C .
.
. Integer
.
. , ,
WriteLn .
, : ---
, . , ,
Integer ,
.
.
, - ,
, .C
C ,
.
.
;return 0
11 ,1.1 .
, ,
. , , , .
34 =compound type

12

.1.4

1.4.2

,
. ,
.
.
,
. ,[?] AWK .1.4
#!/usr/bin/gawk f

#
# Hello, World! in the AWK programming language
#

{ BEGIN
)"!print("Hello, World
exit
}

4
5

8
9
10

" :1.4 , !" AWK


print ' 8 . ,
, print
.AWK

1.4.3


.AWK ,
. WriteLn35 4 ,1.2 .
, . ,
,
. , .
, WriteLn . ,
.
1.2 . output
. , .
WriteLn? printf ?C
,
. .
35=routine

13

.1

print AWK
WriteLn
printf C
HelloWorld 1.2

:1.1
, ,C " " .printf
C
, C .
---
. , WriteLn
) ( .
C .
printf 11 ,1.1 . ,
C . , ,
.

1.4.4

1.1 :
: , , ,
.
, . :
, ,
.
,
.
. C,
.

, ,
,
.
,1.5 " , !" ,[?] Go .
,Go ,
,import ,package ,func- , .
, Printf , .
14

.1.5
// Hello world in the Go programming language
package main
"import "fmt
{ )(func main
)"fmt.Printf("Hello, World!\n
}

1
2
3
4
5
6

" :1.5 , !" Go

1.5
,
. , C
.typeoupt ,
1.1 .
,
. " , !"
.

1.5.1

1.5 Go
"import "fmt
' ,3

36

Printf fmt
"import "fmt
.
Printf ,fmt
' 5 :1.5
)"fmt.Printf("Hello, World!\n
. " , !"
) ,(1.6 ,Go .
,Put_Line .Text_IO

;with Text_IO
36=import

15

1.
Hello, World! in the Ada programming language
;with Text_IO
procedure Hello_World is
begin
;)"!Text_IO.Put_Line("Hello, World
;end Hello_World

1
2
3
4
5
6

" :1.6 , !"


) ' 2(
. , , , Text_IO
:
;)"!Text_IO.Put_Line("Hello, World

1.5.2

C . 1.1 C

>#include <stdio.h
.C
C : ,
C .37
#
. ,
.
, include
. ,
>#include <stdio.h
,stdio.h
.
printf .
,
.
% cpp P hello .c > hello .P.c

:
% wc l hello .c
37 =preprocessor

16

.1.6
12 hello .c
% wc l hello .P.c
355 hello.P.c

38

. , ,
printf
% grep n "\< printf \>" hello .P.c
;)225: extern int printf ( __const char * __restrict __format , ...
;)"353: printf (" Hello , World !\n

. C

. , Go ,
.

1.5.3

, ,1.7 " , !" ' .


, , 1.7
.
1

// Hello.java: my first Java program. It prints


// the string Hello, World! on the standard output
// stream, and then terminates.

{ class HelloWorld
{ )][static public void main(String args
;)"!System.out.println("Hello, World
}
}

2
3

6
7
8
9

" :1.7 , !" '



.
, . ,
.

1.6

" , !" .
.
38 =preprocessing

17

.1
, .
--- .
. . C
. ---.
, .
: , ,
. 1.4

39

AWK

)"!print("Hello, World
) ' 8 (1.4 ) exit .(9
.
,
.
, ,
. " , !"
, .
: ,
. printf
" " ,
" " .

. ,
, , ,
. ,
.
, ,
. , ,
. , ,
% cc hello .c

C , ,stdio.h
,
.
.
.
39=interpreter

18

.1.6

1.6.1

,
. , ) ,(1.2 program
, .
,HelloWorld , , .
AWK- . ,BEGIN ,
) , AWK- ( . ,
, "" .
BEGIN- .
AWK : ,
, , :
) . ,
AWK- , , (.
:
, .

1.6.2

: ,
, . ,
.
C ,
program . C
,main , ,1.1 printf- .main-
, main
, .
1.8 " , !" C .
.WinMain
,
% cc hello .c

, .
,printf ,
. main.
,
,
. , ,
.
19

.1
1

/* Hello, World! in C for MSWindows */

>#include <windows.h

int PASCAL WinMain(HINSTANCE hInstance,


)HINSTANCE hPrevInstance, LPSTR CmdLine, int Show
{
(MessageBox
GetActiveWindow(),
"Hello, World!",
"Hello Windows World",
;)MB_OK
;return 0
}

6
7
8
9
10
11
12
13
14

" :1.8 , !" C

1.6.3

.C ,
,
,
, .
,
.

, .
, )(Cluster
, .
, , ,
.
'.

1.6.4

,1.9 " , !" .OCaml ,


1

)* (* Hello World in OCaml

;;"print_string "Hello, World!\n


" :1.9 , !" OCaml

. . , ,
20

.1.6
, OCaml-
: ,ocaml , ocaml
, . .1.2

:1.2 ocaml
, ocaml
ocaml bash. , ocaml
,
Objective Caml version 3.11.2
, .#
,2+2 ocaml . , ocaml
,int , , .4 ocaml
, .

;;"print_string "Hello, World!\n
ocaml , ,
!Hello, World
, ocaml ,unit ,
40
)(.
,ocaml
:
40 unit )( . ,
, .

21

.1
% cat << EOF >input .ml
;;2+2
;;"print_string "Hello , World !\n
EOF

,input.ml ocaml
:
% ocaml < input .ml
Objective Caml version 3.11.2
# : int = 4
! # Hello , World
)( = : unit
#

, , . , ocaml
,input.ml ocaml
,
:
% ocaml input .ml
! Hello , World

,
.
, , .
) ocaml ( , , ,
.

1.7

,
. , , ,
, .41
,
, .
,
. 42
41=nesting
42=closer

22

.1.7
,
.

43


,
.

1.7.1

{}-

) C (1.1 }{ . C
,
. ,{}-
' , ,C++ ,C# AWK.
Go {}- ,
if while- .{}-
,{}-
. {}-
.

1.7.2

{}- .44
.

45

,
.
1.10 .
1
2
3
4
5
6
7
8
9
10

Hello world in the Occam programming language


"#INCLUDE "hostio.inc
"#USE "hostio.lib
)PROC hello.world (CHAN OF SP fs, ts
SEQ
)"!so.write.string.nl(fs, ts, "Hello, World
SEQ i = 1 FOR 10
SEQ
)so.write.int(fs, ts, i, 0
)so.write.nl(fs, ts
" :1.10 , !"

43=opener
44 , - ,
" ".
45=indentation

23

.1
8-9 ) (SEQ ' ,7
' .6
, '.

1.7.3

beginend-

1.2 ,
begin .end
.
,
begin end- ,
.
, ,
, ,
beginend- .
, ,CDC { }- .

1.7.4

,
. ,
.
.
.beginend-
, , ,
. 1.6
, ) ' (6
;end Hello_World
.Hello_World
,1.11 , .
,
.
. ' 14
' ,10 Do ' .9 ' 10
End Do.
24

.1.7
;MODULE HelloWorld
)* (* Hello, World! in Oberon for the Oberon System

1
2

;IMPORT Oberon, Texts

VAR
;W: Texts.Writer

;*PROCEDURE Do
BEGIN
;)"!Texts.WriteString(W,"Hello, World
;)Texts.WriteLn(W
)Texts.Append(Oberon.Log, W.buf
;END Do

10
11
12
13
14

BEGIN
)Texts.OpenWriter(W
END HelloWorld.

16
17
18

" :1.11 , !"


' 18 ' ,16
HelloWorld ' .1 ' 18
END HelloWorld.
Do .HelloWorld
, ,
.
.beginend-
do done ,end
.

1.7.5

iffi-

.68 , if
: .fi case
: ,escac for...do od
) . ,repeat ,
,until dowhile (.C
, , .
beginend- .
iffi
, ,68 .1968
46 ALGOL 68 ALGOrithmic Language 1968-

25

46

.1
. , .
, ) ,(bash ,
.

1.8

,
.

1.8.1

,
,47 . n ,
n 1 . , , .
, 1.2 , , ; -
beginend.
.
, .

.
.
.

1.2 ,
begin
)'!WriteLn('Hello, World
end.
,
begin
;)'!WriteLn('Hello, World
end.
, .
-
. , ,
47=separator

26

.1.8
; max(a,b: Integer ): Integer
b then
:= b
;:= a

function
begin
> if a
max
else
max
end

, , - max := b
; max(a,b: Integer ): Integer
b then
;:= b
;:= a

function
begin
> if a
max
else
max
end

, then else- ,
: max := a , , .

1.8.2

, ,C ,{}- -
, . , -
.
" , !" ) C ,(1.1
:
;)"printf ("Hello , World !\n
;return 0
-.
, ,
. , .

1.8.3

) , ( ,
- , , , ;
.
27

.1
, , .
, - if ,
then- else- .

1.8.4

, - ,
.
- , , -
, .
, , , ,AWK .Go
, ,
, .
Go
- .

1.9

" , !" , " , !".


.

: .

1.9.1

, ,
, .
, .
) AWK ,(1.4 ,
.bash

48

,#

,{}- .// ,49


) Go (1.5 ' ) .(1.7 C
, ,
.//
) ,(1.6 ,-- ,
) (1.10 . note
48=hash sign
49=slash character

28

.1.9
, ,1.12 " , !" .
"note "Hello World in the Eiffel programming language
class HELLO
create run
feature run
do
)"print ("Hello, World!%N
end
end HELLO

1
2
3
4
5
6
7
8

" :1.12 , !"

1.9.2

.
, .
,C *) /,
, (50 ) */ ( .
.OCaml , *( ) ,
( ) *)- , (.
,
, .
{ ) ( } ) ( ,
,} , .
,OCaml- *(
.*)-

, . ,
1--3 :1.2
{hello.p: My very first Pascal program. It does not do
too muchit prints the string Hello, World! (followed
}by a new line), and then terminates.
, .
, ,1.7 ' ,
,
:
// Hello.java: my first Java program. It prints
// the string Hello, World! on the standard output
// stream, and then terminates.
50=asterisk

29

.1
, ,
. :1.1

*/
** hello.c: My first C program; it prints
** Hello, World!, and dies.
*/

, ' , ,C++ ,Go


, * / .*/

1.9.3

, , , ,
.
, ,
.
, ,C
. C ,
, .
. ,
.
)**( }{ .
,68 ,
. 51 ,
. , .
68 .
,
.
,
, .
, ,
.
:
. ,
. sed 1.7
51=delimiter

30

.1.10
% cat Hello .java | sed s +^+//+
//// Hello .java: my first Java program . It prints
//// the string "Hello , World !" on the standard output
//// stream , and then terminates .
//
{ // class HelloWorld
{ )][ // static public void main( String args
//
;)"! System .out. println (" Hello , World
} //
}//

,
, .
% cat Hello .java | sed s +^+//+ | sed s+//++
// Hello .java: my first Java program . It prints
// the string "Hello , World !" on the standard output
// stream , and then terminates .
{ class HelloWorld
{ )][ static public void main( String args
;)"! System .out. println (" Hello , World
}
}

1.9.4

, , .
,C ,
:
% cpp P hello .c | grep / | wc
0
0
0

, . ' ,
' , , , .
, ' , **) / , (
.
,
.

1.10

" , !" , " ,


!" . , , , .
31

.1

OCaml ,Go ,C
,
', , ,AWK ,

"World!\n
'!World
"!World
"World!%N

"Hello,
'Hello,
"Hello,
"Hello,


\n

%N

:1.2 ! Hello, World " , !"


1.2 " , !"
. , , . ,
) (.
, , )'( ,
, )"( .
, '
.

'!'Hello, World
, )'( ,
"!"Hello, World
)"( . , , ,1.3
' 18 .
DISPLAY ""LINE 1 POSITION 1 ERASE EOS.
. ' "
,hello.p , .
% sed s/\ '/\"/g < hello .p > hello \".p; pc hello \".p; ./a.out
!Hello , World

,hello".p , ) hello.p(,
)( , )( ,
.

, . , ' ,
;)"System.out.print("Hello, World!\n
.
32

.1.11

1.11

1.2 ,
.
.
C
, '" "' ,
, .
,1.2 ,
. ,PostScript (
) , .1.13
% Hello, World in Postscript
%!PS
/PalatinoRoman findfont
100 scalefont
setfont
100 100 moveto
(Hello, World!) show
showpage

1
2
3
4
5
6
7
8

" :1.13 , !" PostScript


-
.

52

- .
- . ,
,PostScript
.
.
) ,- (,
) ,- ,
(.

1.11.1


- . , . ,1.14
) (FORTRAN 66 .
52 =delimiter collision

33

.1
PROGRAM HELLO
C A HELLO, WORLD! PROGRAM IN FORTRAN IV
)WRITE (6,100
)!100 FORMAT(14H HELLO, WORLD
STOP
END

1
2
3
4
5
6

" :1.14 , !" 66


,100 '

53

.H

14H 14 ,
! HELLO,WORLD 14 )
( .
, .
. ,77 '.
, .

1.11.2

,54
, 55 . ,
) ( - .

56

, .

: ,
, .
.
.
, ,1.9 " , !"
.OCaml ,C ,
.1.9 , :1.9
;;"print_string "Hello, World!\n
,C
.n ,1.15
, " .
53 '=Hollerith constant
54=escaping
55 =escaping character
56 =backslash

34

.1.11
>#include <stdio.h
{ )int main(int argc, char *argv[], char **envp
;)"printf("print_string \"Hello, World!\\n\";;\n
;return 0
}

1
2
3
4
5

Output
;;"print_string "Hello , World !\n

:1.15 C

. 1.15 ) C (\n
, , .
, n
.
, ,
, ,
. ,\n
. C 256 ASCII-
. Go'
) - ( ,
,
.

.
. ,
"" , .
.
, ,
. , , ,
.

1.11.3

,
.
,
. , ,
35

.1
. ,
.
, n , 2n
.
:
.
, ,
.
.

1.11.4


.
,
.
1.16 , .
1
2
3
4
5
6
7

;)program makeHelloWorld(output
begin
;)';)WriteLn('program HelloWorld(output
;)'WriteLn('begin
;)")'!WriteLn(" WriteLn('Hello, World
)'WriteLn('end.
end.

Output
;) program HelloWorld ( output
begin
)'! WriteLn ('Hello , World
end.

:1.16
1.16 " , !" .
.1.2
, ,
. ,
, . ,
.
36

.1.11
, sed
':
sed s+//++
s sed .
,s sed s+//++ + ,
. ,
. ,
sed sa//aa
a , .

1.11.5

" "!Hello, World , ,


.
.
, ,
, ,1.16 1.2 ,
:
;)program HelloWorld(output
begin
)'!WriteLn('Hello, World
end.
,C ,
.
.
,
, ,
.
, ,C ,
. 1.17
" , !" .
,1.17
. ,
, - ,
.
,C

57

57=concatenation

37

.1
>#include <stdio.h
{ )int main(int argc, char *argv[], char **envp
(printf
\;)"program HelloWorld(output
\begin\n
\WriteLn('Hello, World!')\n
;)"end.\n
;return 0
}

1
2
3
4
5
6
7
8
9

:1.17 C
C ,1.18 ,1.17
.
1
2
3
4
5
6
7
8

>#include <stdio.h
{ )int main(int argc, char *argv[], char **envp
"printf("program HelloWorld(output);\n
""begin\n
"" WriteLn('Hello, World!')\n
;)""end.\n
;return 0
}
:1.18 C

'
.
C ' , ,C
, , ' , . , '
.
1.19 '
" , !" .
1
2
3
4
5
6
7

{ class MakePascalHelloWorld
{ )][static public void main(String args
(System.out.println
"program HelloWorld(output);\n" +
"begin\n" +
" WriteLn('Hello, World!')\n" +
} } ;)""end.\n
:1.19 '

Go . ,
` ) ( ,
38

.1.11
.
Go
, .1.20
package main
1
"import "fmt
2
{ )(func main
3
(fmt.Printf
4
;)`program HelloWorld(output
5
begin
6
)'!WriteLn('Hello, World
7
)`end.
8
}
9
:1.20 - Go
Go, , , ,
.
, ,
` . , -
.
` . ,
,1.5 Go " ,
.
, , ,
,bash- " , !" .C
:
% rm f hello.c; cat << EOF > hello.c
*/
** hello.c: My first C program ; it prints
** "Hello , World !", and dies.
*/
># include <stdio .h
)int main(int argc , char *argv [], char ** envp
{
;)"printf ("Hello , World !\n
;return 0
}
EOF
"
cat << EOF
39

.1
,
.
.

1.12
. 1.1 , .
" ,!" .C
. C ?
?
. ?
?
. sigil . ?
. ?
. ?
. ?
.
.
. ?
?
.

58

;
.
. ?
. :C
auto break case char const continue default do double else entry
enum extern float for goto if int long register return short
signed sizeof static struct switch typedef union unsigned void
volatile while
) :(
)( )( .
sizeof enum- . .
. ':
58 =keyword

40

.1.12
abstract assert boolean break byte case catch char class const
continue default do double else enum extends final finally float
for goto if implements import instanceof int interface long native
new package private protected public return short static strictfp
super switch synchronized this throw throws transient try void
volatile while
) :(
)( )(
)( . package ,import ,assert
instanceof- . .
. bash .
. .
. JavaScript .
.

59

. PHP HTML.
PHP, PHP HTML.
. ?
. .
?
. ?
. ?
. .
. ?
. , .
. .
. " ,!" ,:
% sed s/\'/\"/g < hello.p > hello\".p; pc hello\".p; ./a.out
? sed
?
. ?
59=portable

41

.1
. .C
. . ,
.

42

39 ,3 .programmatic idiom
,25 ,19 ,17 ,13--11 ,7 ,5 .reserved word
40
41 ,34 .escaping
41 ,39--35 ,32 ,31 ,7 ,5 .literal
40 .keyword

18 ,16 .preprocessor
3 .command shell
3 .operating systems
26 .separator
18 .interpreter
IDE:

41 ,11 .expression
40 ,33 ,32 ,30--28 ,26--23 .opener
41 ,37--32 ,30 .delimiter

11 ,9 ,8 .variable

6 .monospace font

Interactive
2 .Development Environment

7 .proportional font

39--37 ,35 ,34 ,31 ,17 ,14 ,7 ,5 ,3 .string

39 ,34 ,33 .delimiter collision


23 .indentation

28 .hash sign

31--28 ,7 ,5 ,4 .comment

9 .static

11 .assignment

19 ,5 .library

22 ,21 ,3 .prompt

5 ,4 ,2 .text editor

40 ,12 ,8 .type

17 .preprocessing

12 .compound type

3 .standard output

17 ,15 .import

,28--22 ,19--17 ,14 ,12 ,11 ,9 ,7 ,3 .command


40 ,34

41 .portable

40 ,37 ,33--28 ,26--22 .closer


8 .constant
34 .Hollerith constant '

31 ,24 ,14--11 ,9 ,8 .entity


29 .asterisk
31--28 .slash character
34 .backslash

.recursively defined set


11

40 ,30 ,28 ,19--15 ,9 ,5 ,3 .compiler

30 ,25--22 .nesting

10--8 ,6 ,5 .convention

3 .standard input

40 ,19 ,15--7 ,5 .identifier

32 ,19 ,18 ,13 .routine

12 ,7 .reserved identifier

38 ,37 .concatenation

7 .library identifier

39 ,37 ,35 ,34 .escaping character

40 ,7 .predefined identifier

9 ,8 .underscocre

9 ,8 .class

43

You might also like