996
|
1 PLEASE NOTE: This program computes the GCD of two numbers. It is
|
|
2 the example used in the operational semantics article.
|
|
3
|
|
4 Copyright (c) 2006 Claudio Calvelli, all rights reserved.
|
|
5
|
|
6 CLC-INTERCAL is copyrighted software. However, permission to use, modify,
|
|
7 and distribute it is granted provided that the conditions set out in the
|
|
8 licence agreement are met. See files README and COPYING in the distribution.
|
|
9
|
|
10 PLEASE WRITE IN .1 + .2
|
|
11 DO COME FROM (3)
|
|
12 (1) DO .3 <- '¥.1¢.2'~'¥.1¢.2'~#1
|
|
13 DO READ OUT .1
|
|
14 PLEASE GIVE UP
|
|
15 PLEASE COME FROM .3
|
|
16 DO .3 <- #0
|
|
17 DO .4 <- #32768
|
|
18 DO COME FROM .6
|
|
19 DO .6 <- #0
|
|
20 DO .5 <- '¥!1~.4'¢!2~.4''
|
|
21 (2) PLEASE .5 <- .5¢#0
|
|
22 DO .4 <- .4~#65534
|
|
23 (8) DO .6 <- !4~.4~#1'¢#0¢#0
|
|
24 PLEASE COME FROM .7
|
|
25 DO .7 <- #0
|
|
26 (3) bit left as an exercise to the reader - subtracts .2 from .1 and
|
|
27 leaves the result in .1 without modifying .2; the last statement
|
|
28 executed must have label (three). Do not cheat by looking it up
|
|
29 DO COME FROM .5
|
|
30 PLEASE .5 <- #0
|
|
31 (128) DO .7 <- "!1~.4'~!1~.4'"¢#0¢#0¢#0
|
|
32 DO .3 <- .2
|
|
33 DO .2 <- .1
|
|
34 DO .1 <- .3
|
|
35 DO .3 <- #0
|
|
36 (7) PLEASE .7 <- #7
|