about summary refs log blame commit diff stats
path: root/js/games/nluqo.github.io/~bh/pdf/v1ch09.pdf
blob: 8f531fdeb1c4e6036813f8cec304ee9c4795c3b2 (plain) (tree)
blob is binary.
href='/akkartik/mu/plain/arc/.traces/default-space-shared-extra-names-dont-overlap-bindings?h=hlt&id=cb0060ee0f88149968a8f2b0bbf617c88ea46753'>plain) (blame)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
c{0: 0 (((default-space space-address)) <- ((new)) ((space literal)) ((30 literal))) -- nil
c{0: 1 (((x integer)) <- ((copy)) ((3 literal))) -- nil
c{0: 2 (((y integer)) <- ((copy)) ((4 literal))) -- nil
c{0: 3 (((reply)) ((default-space space-address))) -- nil
c{1: 0 ✓ (((default-space space-address)) <- ((new)) ((space literal)) ((30 literal)))
c{1: 1 ✓ (((x integer)) <- ((copy)) ((3 literal)))
c{1: 2 ✓ (((y integer)) <- ((copy)) ((4 literal)))
c{1: 3 ✓ (((reply)) ((default-space space-address)))
c{0: 0 (((default-space space-address) (names f)) <- ((next-input))) -- nil
c{0: 1 (((y integer)) <- ((add)) ((y integer)) ((1 literal))) -- nil
c{0: 2 (((x integer)) <- ((add)) ((x integer)) ((2 literal))) -- nil
c{0: 3 (((z integer)) <- ((copy)) ((2 literal))) -- nil
c{0: 4 (((reply)) ((x integer)) ((y integer))) -- nil
c{1: 0 ✓ (((default-space space-address) (names f)) <- ((next-input)))
c{1: 1 ✓ (((y integer)) <- ((add)) ((y integer)) ((1 literal)))
c{1: 2 ✓ (((x integer)) <- ((add)) ((x integer)) ((2 literal)))
c{1: 3 ✓ (((z integer)) <- ((copy)) ((2 literal)))
c{1: 4 ✓ (((reply)) ((x integer)) ((y integer)))
c{0: 0 (((1 space-address)) <- ((f))) -- nil
c{0: 1 (((2 integer)) ((3 integer)) <- ((g)) ((1 space-address))) -- nil
c{1: 0 ✓ (((1 space-address)) <- ((f)))
c{1: 1 ✓ (((2 integer)) ((3 integer)) <- ((g)) ((1 space-address)))
cn0: convert-names in f
cn0: (((default-space space-address)) <- ((new)) ((space literal)) ((30 literal))) nil nil
cn0: checking arg ((space literal))
cn0: checking arg ((30 literal))
cn0: checking oarg ((default-space space-address))
maybe-add: ((default-space space-address))
cn0: (((x integer)) <- ((copy)) ((3 literal))) nil nil
cn0: checking arg ((3 literal))
cn0: checking oarg ((x integer))
maybe-add: ((x integer))
cn0: location for oarg ((x integer)): 1
cn0: (((y integer)) <- ((copy)) ((4 literal))) ((x 1)) nil
cn0: checking arg ((4 literal))
cn0: checking oarg ((y integer))
maybe-add: ((y integer))
cn0: location for oarg ((y integer)): 2
cn0: (((reply)) ((default-space space-address))) ((x 1) (y 2)) nil
cn0: checking arg ((default-space space-address))
maybe-add: ((default-space space-address))
cn0: convert-names in g
cn0: (((default-space space-address) (names f)) <- ((next-input))) ((x 1) (y 2)) nil
cn0: checking oarg ((default-space space-address) (names f))
maybe-add: ((default-space space-address) (names f))
cn0: (((y integer)) <- ((add)) ((y integer)) ((1 literal))) ((x 1) (y 2)) nil
cn0: checking arg ((y integer))
maybe-add: ((y integer))
cn0: checking arg ((1 literal))
cn0: checking oarg ((y integer))
maybe-add: ((y integer))
cn0: (((x integer)) <- ((add)) ((x integer)) ((2 literal))) ((x 1) (y 2)) nil
cn0: checking arg ((x integer))
maybe-add: ((x integer))
cn0: checking arg ((2 literal))
cn0: checking oarg ((x integer))
maybe-add: ((x integer))
cn0: (((z integer)) <- ((copy)) ((2 literal))) ((x 1) (y 2)) nil
cn0: checking arg ((2 literal))
cn0: checking oarg ((z integer))
maybe-add: ((z integer))
cn0: location for oarg ((z integer)): 3
cn0: (((reply)) ((x integer)) ((y integer))) ((x 1) (y 2) (z 3)) nil
cn0: checking arg ((x integer))
maybe-add: ((x integer))
cn0: checking arg ((y integer))
maybe-add: ((y integer))
cn0: convert-names in main
cn0: (((1 space-address)) <- ((f))) nil nil
cn0: checking oarg ((1 space-address))
maybe-add: ((1 space-address))
cn0: (((2 integer)) ((3 integer)) <- ((g)) ((1 space-address))) nil nil
cn0: checking arg ((1 space-address))
maybe-add: ((1 space-address))
cn0: checking oarg ((2 integer))
maybe-add: ((2 integer))
cn0: checking oarg ((3 integer))
maybe-add: ((3 integer))
cn1: (((default-space space-address)) <- ((new)) ((space literal)) ((30 literal)))
cn1: (((1 integer)) <- ((copy)) ((3 literal)))
cn1: (((2 integer)) <- ((copy)) ((4 literal)))
cn1: (((reply)) ((default-space space-address)))
cn1: (((default-space space-address) (names f)) <- ((next-input)))
cn1: (((2 integer)) <- ((add)) ((2 integer)) ((1 literal)))
cn1: (((1 integer)) <- ((add)) ((1 integer)) ((2 literal)))
cn1: (((3 integer)) <- ((copy)) ((2 literal)))
cn1: (((reply)) ((1 integer)) ((2 integer)))
cn1: (((1 space-address)) <- ((f)))
cn1: (((2 integer)) ((3 integer)) <- ((g)) ((1 space-address)))
schedule: main
run: main 0: (((1 space-address)) <- ((f)))
run: f/main 0: (((default-space space-address)) <- ((new)) ((space literal)) ((30 literal)))
run: f/main 0: 1000 => ((default-space space-address))
run: f/main 1: (((1 integer)) <- ((copy)) ((3 literal)))
run: f/main 1: 3 => ((1 integer))
mem: ((1 integer)): 1002 <= 3
run: f/main 2: (((2 integer)) <- ((copy)) ((4 literal)))
run: f/main 2: 4 => ((2 integer))
mem: ((2 integer)): 1003 <= 4
run: f/main 3: (((reply)) ((default-space space-address)))
run: main 0: 1000 => ((1 space-address))
mem: ((1 space-address)): 1 <= 1000
run: main 1: (((2 integer)) ((3 integer)) <- ((g)) ((1 space-address)))
mem: ((1 space-address)) => 1000
run: g/main 0: (((default-space space-address) (names f)) <- ((next-input)))
arg: nil 0 (1000)
run: g/main 0: 1000 => ((default-space space-address) (names f))
run: g/main 1: (((2 integer)) <- ((add)) ((2 integer)) ((1 literal)))
mem: ((2 integer)) => 4
run: g/main 1: 5 => ((2 integer))
mem: ((2 integer)): 1003 <= 5
run: g/main 2: (((1 integer)) <- ((add)) ((1 integer)) ((2 literal)))
mem: ((1 integer)) => 3
run: g/main 2: 5 => ((1 integer))
mem: ((1 integer)): 1002 <= 5
run: g/main 3: (((3 integer)) <- ((copy)) ((2 literal)))
run: g/main 3: 2 => ((3 integer))
mem: ((3 integer)): 1004 <= 2
run: g/main 4: (((reply)) ((1 integer)) ((2 integer)))
mem: ((1 integer)) => 5
mem: ((2 integer)) => 5
run: main 1: 5 => ((2 integer))
mem: ((2 integer)): 2 <= 5
run: main 1: 5 => ((3 integer))
mem: ((3 integer)): 3 <= 5
schedule: done with routine nil
ght: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# To check our support for screens in scenarios, rewrite tests from print.mu

scenario print-character-at-top-left-2 [
  local-scope
  assume-screen 3/width, 2/height
  run [
    a:char <- copy 97/a
    screen <- print screen, a
  ]
  screen-should-contain [
    .a  .
    .   .
  ]
]

scenario clear-line-erases-printed-characters-2 [
  local-scope
  assume-screen 5/width, 3/height
  # print a character
  a:char <- copy 97/a
  screen <- print screen, a
  # move cursor to start of line
  screen <- move-cursor screen, 0/row, 0/column
  run [
    screen <- clear-line screen
  ]
  screen-should-contain [
    .     .
    .     .
    .     .
  ]
]

scenario scroll-screen [
  local-scope
  assume-screen 3/width, 2/height
  run [
    a:char <- copy 97/a
    move-cursor screen, 1/row, 2/column
    screen <- print screen, a
    screen <- print screen, a
  ]
  screen-should-contain [
    .  a.
    .a  .
  ]
]