101 lines
1.7 KiB
Plaintext
101 lines
1.7 KiB
Plaintext
1 1 700 "(* Type definitions *)"
|
|
2 1 405 "type"
|
|
2 6 101 "string"
|
|
2 12 508 ":"
|
|
2 14 301 "1"
|
|
2 16 510 "->"
|
|
2 19 204 "character"
|
|
3 1 405 "type"
|
|
3 6 101 "int2int"
|
|
3 13 508 ":"
|
|
3 15 201 "integer"
|
|
3 23 510 "->"
|
|
3 26 201 "integer"
|
|
4 1 405 "type"
|
|
4 6 101 "string2int"
|
|
4 16 508 ":"
|
|
4 18 101 "string"
|
|
4 25 510 "->"
|
|
4 28 201 "integer"
|
|
5 1 700 "(* Function prototypes
|
|
They use the above type definitions
|
|
*)"
|
|
8 1 406 "function"
|
|
8 10 101 "square"
|
|
8 17 508 ":"
|
|
8 19 101 "int2int"
|
|
9 1 406 "function"
|
|
9 10 101 "entry"
|
|
9 16 508 ":"
|
|
9 18 101 "string2int"
|
|
10 1 700 "(* Function definition
|
|
Functions must be declared before they are defined
|
|
*)"
|
|
13 1 101 "square"
|
|
13 7 501 "("
|
|
13 8 101 "x"
|
|
13 9 502 ")"
|
|
13 11 608 ":="
|
|
13 14 505 "{"
|
|
14 1 407 "return"
|
|
14 8 101 "x"
|
|
14 10 603 "*"
|
|
14 12 101 "x"
|
|
14 13 507 ";"
|
|
15 1 506 "}"
|
|
16 1 700 "(* Function definition
|
|
entry is the first function called
|
|
*)"
|
|
19 1 101 "entry"
|
|
19 6 501 "("
|
|
19 7 101 "arg"
|
|
19 10 502 ")"
|
|
19 12 608 ":="
|
|
19 15 505 "{"
|
|
20 1 101 "input"
|
|
20 7 607 "="
|
|
20 9 301 "7"
|
|
20 10 507 ";"
|
|
21 1 101 "expected"
|
|
21 10 607 "="
|
|
21 12 301 "49"
|
|
21 14 507 ";"
|
|
22 1 101 "actual"
|
|
22 8 608 ":="
|
|
22 11 101 "square"
|
|
22 17 501 "("
|
|
22 18 101 "input"
|
|
22 23 502 ")"
|
|
22 24 507 ";"
|
|
23 1 101 "rseult"
|
|
23 8 608 ":="
|
|
23 11 101 "expected"
|
|
23 20 607 "="
|
|
23 22 101 "actual"
|
|
23 28 507 ";"
|
|
24 1 407 "return"
|
|
24 8 301 "0"
|
|
24 9 507 ";"
|
|
25 1 503 "["
|
|
25 3 201 "integer"
|
|
25 10 508 ":"
|
|
25 12 101 "input"
|
|
25 17 507 ";"
|
|
25 19 201 "integer"
|
|
25 26 508 ":"
|
|
25 28 101 "expected"
|
|
25 36 507 ";"
|
|
25 38 201 "integer"
|
|
25 45 508 ":"
|
|
25 47 101 "actual"
|
|
25 53 507 ";"
|
|
25 55 101 "boolean"
|
|
25 62 508 ":"
|
|
25 64 101 "result"
|
|
25 70 507 ";"
|
|
25 72 101 "string"
|
|
25 78 508 ":"
|
|
25 80 101 "input"
|
|
25 86 504 "]"
|
|
26 1 506 "}"
|