-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraph1.sample
More file actions
75 lines (70 loc) · 3.7 KB
/
graph1.sample
File metadata and controls
75 lines (70 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
Example of result from parsing graph1.pas
Note: your version may have more progn operators; that is okay.
yyparse result = 0
Symbol table level 0
38027280 real BASIC basicdt 1 siz 8
38027376 integer BASIC basicdt 0 siz 4
38027472 char BASIC basicdt 2 siz 1
38027568 boolean BASIC basicdt 3 siz 4
38027664 exp knd 5 0 typ 38027760 lvl 0 siz 0 off 0
(FUNCTION real
real)
38028240 sin knd 5 0 typ 38028336 lvl 0 siz 0 off 0
(FUNCTION real
real)
...
Symbol table level 1
38050576 d CONST typ REAL val 6.250000e-02
38050928 s CONST typ INTEGER val 32
38051280 h CONST typ INTEGER val 34
38051632 c CONST typ REAL val 6.283180e+00
38051984 lim CONST typ INTEGER val 32
38052592 x VAR 1 typ real lvl 1 siz 8 off 0
38052688 y VAR 1 typ real lvl 1 siz 8 off 8
38053168 i VAR 0 typ integer lvl 1 siz 4 off 16
38053264 n VAR 0 typ integer lvl 1 siz 4 off 20
token 38058544 OP program dtype 0 link 0 operands 38050000
(program graph1 (progn output)
(progn (:= i 0)
(label 1)
(if (<= i 32)
(progn (:= x (* 6.250000e-02
(float i)))
(:= y (* (funcall exp (- x))
(funcall sin (* 6.283180e+00
x))))
(:= n (fix (+ (funcall round (* 3.200000e+01
y))
3.400000e+01)))
(progn (label 0)
(funcall write ' ')
(:= n (- n 1))
(if (= n 0)
(progn)
(goto 0)))
(funcall writeln '*')
(:= i (+ i 1))
(goto 1)))))
Your version may look like this, also okay:
(program graph1 (progn output)
(progn (progn (:= i 0)
(label 1)
(if (<= i 32)
(progn (progn (:= x (* 6.250000e-02
(float i)))
(:= y (* (funcall exp (- x))
(funcall sin (* 6.283180e+00
x))))
(:= n (fix (+ (funcall round
(* 3.200000e+01
y))
3.400000e+01)))
(progn (label 0)
(progn (funcall write ' ')
(:= n (- n 1)))
(if (= n 0)
(progn)
(goto 0)))
(funcall writeln '*'))
(:= i (+ i 1))
(goto 1))))))