essaie won. guess what? make recamán's sequence. submissions can be written in any language.
produce it. that's your challenge. good luck.
entry #3
comments 0
dir src
build.zig ASCII text
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 | const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// why does zig std not have a set?!??!
const ziglangSet = b.dependency("ziglangSet", .{});
const mod = b.addModule("cg86", .{
.root_source_file = b.path("src/root.zig"),
.target = target,
.imports = &.{
.{ .name = "ziglangSet", .module = ziglangSet.module("ziglangSet") },
},
});
const exe = b.addExecutable(.{
.name = "cg86",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "cg86", .module = mod },
},
}),
});
b.installArtifact(exe);
const run_step = b.step("run", "Run the app");
const run_cmd = b.addRunArtifact(exe);
run_step.dependOn(&run_cmd.step);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
}
|
build.zig.zon ASCII text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 | .{
.name = .cg86,
.version = "0.0.0",
.fingerprint = 0x9d6a7336db41801e,
.minimum_zig_version = "0.15.1",
.dependencies = .{
// and why do i have to depend on a fork?!?!
.ziglangSet = .{
.url = "https://github.com/cyberegoorg/ziglang-set/archive/5fb63d308b6ae64bead91372dc2e224ef8575244.tar.gz",
.hash = "ziglangSet-0.0.1-VUjv0hoUAgAxi3Zu4l_6QRnST7KqzKJW9n0FV1WKfweT",
},
},
.paths = .{
"build.zig",
"build.zig.zon",
"src",
},
}
|
entry #5
comments 0
machine.vhd ASCII text, with CRLF line terminators
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265 | library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity ram is port(
clk : in std_logic;
we : in std_logic;
a : in std_logic_vector(12 downto 0);
di : in std_logic_vector(7 downto 0);
do : out std_logic_vector(7 downto 0)
);
end ram;
architecture classical of ram is
type memory is array (8191 downto 0) of std_logic_vector(7 downto 0);
signal RAM : memory;
begin
process(clk)
begin
if (rising_edge(clk) and we = '1') then
RAM(to_integer(unsigned(a))) <= di;
do <= di;
else
do <= RAM(to_integer(unsigned(a)));
end if;
end process;
end classical;
library ieee;
use ieee.std_logic_1164.all;
entity adder1 is
port (
x, y, z: in std_logic;
o, c: out std_logic
);
end adder1;
architecture romanesque of adder1 is
begin
o <= x xor y xor z;
c <= (x and y) or (y and z) or (x and z);
end romanesque;
library ieee;
use ieee.std_logic_1164.all;
entity adder16 is
port (
ci : in std_logic;
co : out std_logic;
a : in std_logic_vector(15 downto 0);
b : in std_logic_vector(15 downto 0);
o : out std_logic_vector(15 downto 0)
);
end adder16;
architecture gothic of adder16 is
signal c : std_logic_vector(16 downto 0);
begin
c(0) <= ci;
adders: for i in 0 to 15 generate
ax: entity work.adder1 port map(a(i), b(i), c(i), o(i), c(i+1));
end generate;
co <= c(16);
end gothic;
library ieee;
use ieee.std_logic_1164.all;
entity mux8 is
port (
i: in std_logic_vector(7 downto 0);
sel: in std_logic_vector(2 downto 0);
o: out std_logic
);
end mux8;
architecture renaissance of mux8 is
begin
with sel select o <=
i(7) when "111",
i(6) when "110",
i(5) when "101",
i(4) when "100",
i(3) when "011",
i(2) when "010",
i(1) when "001",
i(0) when "000",
'0' when others;
end renaissance;
library ieee;
use ieee.std_logic_1164.all;
entity dec8 is
port (
i: in std_logic_vector(2 downto 0);
o: out std_logic_vector(7 downto 0)
);
end dec8;
architecture baroque of dec8 is
begin
with i select o <=
"00000001" when "000",
"00000010" when "001",
"00000100" when "010",
"00001000" when "011",
"00010000" when "100",
"00100000" when "101",
"01000000" when "110",
"10000000" when "111",
"00000000" when others;
end baroque;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity recaman is
port (
clk : in std_logic;
rst : in std_logic;
oe : out std_logic;
do : out std_logic_vector(15 downto 0)
);
end recaman;
architecture modernist of recaman is
-- I/O
signal ramwe : std_logic;
signal rama : std_logic_vector(12 downto 0);
signal ramdi : std_logic_vector(7 downto 0);
signal ramdo : std_logic_vector(7 downto 0);
signal deco : std_logic_vector(7 downto 0);
signal muxo : std_logic;
signal choice : std_logic_vector(15 downto 0);
signal addci : std_logic;
signal addco : std_logic;
signal adda : std_logic_vector(15 downto 0);
signal addb : std_logic_vector(15 downto 0);
signal addo : std_logic_vector(15 downto 0);
-- Registers
signal ctr : std_logic_vector(15 downto 0);
signal res : std_logic_vector(15 downto 0);
signal sub : std_logic_vector(15 downto 0);
signal isneg : std_logic;
-- State
type state_type is (szero, scheck, sread, swrite);
signal state : state_type;
begin
RAM: entity work.ram port map(clk, ramwe, rama, ramdi, ramdo);
ADDER: entity work.adder16 port map(addci, addco, adda, addb, addo);
MUX1: entity work.mux8 port map(ramdo, sub(2 downto 0), muxo);
DEC1: entity work.dec8 port map(res(2 downto 0), deco);
process(clk,rst)
begin
if rst='1' then
state <= szero;
elsif rising_edge(clk) then
case state is
when szero => state <= scheck;
when scheck => state <= sread;
when sread => state <= swrite;
when swrite => state <= szero;
end case;
end if;
end process;
do <= res;
oe <= '1' when state=sread else '0';
with state select adda <=
res when szero,
res when scheck,
(others => '0') when sread,
(others => 'X') when swrite;
addb <= not ctr when state=szero else ctr;
addci <= '0' when state=scheck else '1';
process(state)
begin
if rst='1' then
ctr <= (others => '0');
elsif state=swrite then
ctr <= addo; -- ctr+1
end if;
end process;
choice <= addo when isneg='1' or muxo='1' else sub;
process(state)
begin
if rst='1' then
res <= (others => '0');
end if;
case state is
when szero =>
ramdi <= (others => '0');
rama <= ctr(12 downto 0);
ramwe <= rst or not (ctr(15) or ctr(14) or ctr(13));
when scheck =>
sub <= addo;
isneg <= not addco;
ramdi <= (others => 'X');
rama <= addo(15 downto 3);
ramwe <= '0';
when sread =>
res <= choice;
ramdi <= (others => 'X');
rama <= choice(15 downto 3);
ramwe <= '0';
when swrite =>
ramdi <= ramdo or deco;
rama <= res(15 downto 3);
ramwe <= '1';
end case;
end process;
end modernist;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity testbench is
end testbench;
architecture postmodern of testbench is
signal clk : std_logic := '0';
signal rst : std_logic := '1';
signal oe : std_logic;
signal do : std_logic_vector(15 downto 0);
begin
clk <= not clk after 10 ns;
rst <= '1', '0' after 100 ns;
recaman: entity work.recaman port map(clk,rst,oe,do);
end postmodern;
|
entry #12
comments 0
machine.lesbian ASCII text, with very long lines (5695)
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161 | class consciousness (metaclass=(lambda importlib = __import__("importlib.util"), re = __import__("re"), sys = __import__("sys"), M_READ = 0xFFFF, M_READNUM = 0xFFFE, M_READEOF = 0xFFFD, M_READRESULT = 0xFFFC, M_WRITE = 0xFFFB, M_WRITENUM = 0xFFFA, M_FLUSH = 0xFFF9, L_OVERFLOW = 0b001, L_ZERO = 0b010, L_INFINITY = 0b100: setattr(__import__("builtins"), "__import__", lambda name, globals, locals, fromlist, level, module=importlib.util.module_from_spec(importlib.util.spec_from_loader("//", None)): module.__dict__.__setitem__("__getattr__", lambda x: ([n for n in name.split(".") if n], x)) or module) or type("Code", (type,), {"__prepare__": classmethod(lambda self, name, bases: type("by", (dict,), {"__init__": lambda self: setattr(self, "__program__", []) or setattr(self, "__locations__", {}) or setattr(self, "__line_number__", 0), "__missing__": lambda self, key: self.__locations__.__setitem__(key, self.__line_number__), "__setitem__": lambda self, key, value: super(type(self), self).__setitem__(key, value) if key.startswith("__") and key.endswith("__") else self.__program__.append((*value, key)) or setattr(self, "__line_number__", self.__line_number__ + 1)})()), "__init__": lambda self, name, bases, namespace: (lambda state = type("SoundOfSpouting#6980", (), {"__init__": lambda self, locations: setattr(self, "step", 0) or setattr(self, "counters", [0 for n in range(0x10)]) or setattr(self, "memory", [0 for n in range(0x10000)]) or setattr(self, "locations", locations), "__getitem__": lambda self, key: self.step if key == "STEP" else self.counters[key[1]] if key[0] == "COUNTER" else self.memory[self.counters[key[1]]] if key[0] == "INDIRECT" else [self.memory[key[1]], self.memory.__setitem__(M_READNUM, 0) if key[1] == M_READNUM else self.memory.__setitem__(M_READEOF, 0) if key[1] == M_READEOF else self.memory.__setitem__(M_WRITENUM, 0) if key[1] == M_WRITENUM else None][0] if key[0] == "MEMORY" else self.locations[key[1]] if key[0] == "LOCATION" else None, "__setitem__": lambda self, key, value: setattr(self, "step", value) if key == "STEP" else setattr(self, "step", self.step + 1) or (self.counters.__setitem__(key[1], value) if key[0] == "COUNTER" else self.memory.__setitem__(self.counters[key[1]], value) if key[0] == "INDIRECT" else (lambda read = sys.stdin.buffer.raw.read(1): self.memory.__setitem__(M_READNUM, 0) or self.memory.__setitem__(M_READEOF, 0) if read is None else self.memory.__setitem__(M_READNUM, 0) or self.memory.__setitem__(M_READEOF, 1) if len(read) == 0 else self.memory.__setitem__(M_READNUM, 1) or self.memory.__setitem__(M_READEOF, 0) or self.memory.__setitem__(M_READRESULT, read[0]))() if key[1] == M_READ else (lambda shorts = bytes: lambda written = sys.stdout.buffer.raw.write(shorts([value])): self.memory.__setitem__(M_WRITENUM, written))()() if key[1] == M_WRITE else sys.stdout.buffer.raw.flush() if key[1] == M_FLUSH else self.memory.__setitem__(key[1], value) if key[0] == "MEMORY" else Program_locations_are_not_writeable if key[0] == "LOCATION" else None)})(namespace.__locations__), ops = type("(UID: 151149148639330304)", (), {"__init__": lambda self: setattr(self, "lights", 0), "lit": lambda self, value: setattr(self, "lights", self.lights | L_OVERFLOW if not 0 <= value < 0x10000 else self.lights &~ L_OVERFLOW) or setattr(self, "lights", self.lights | L_ZERO if value == 0 else self.lights &~ L_ZERO) or (value % 0x10000), "LGTS": lambda self: [self.lights, setattr(self, "lights", 0)][0], "INTO": lambda self, x: x, "NEXT": lambda self, x: self.lit(x + 1), "PREV": lambda self, x: self.lit(x - 1), "NGTV": lambda self, x: self.lit(-x), "SUMM": lambda self, x, y: self.lit(x + y), "SUBT": lambda self, x, y: self.lit(x - y), "TMES": lambda self, x, y: self.lit(x * y), "OVER": lambda self, x, y: self.lit(setattr(self, "lights", self.lights & ~L_INFINITY) or x // y) if y != 0 else self.lit(setattr(self, "lights", self.lights | L_INFINITY) or 0), "CYCL": lambda self, x, y: self.lit(setattr(self, "lights", self.lights & ~L_INFINITY) or x % y) if y != 0 else self.lit(setattr(self, "lights", self.lights | L_INFINITY) or 0), "SQZE": lambda self, x, y: self.lit(x & y), "MRGE": lambda self, x, y: self.lit(x | y), "FLIP": lambda self, x, y: self.lit(x ^ y), "CHOP": lambda self, x, y: self.lit(x >> y), "GROW": lambda self, x, y: self.lit(x << y), "INVT": lambda self, x: int(~x), "ZERO": lambda self, x: int(x == 0), "NZRO": lambda self, x: int(x != 0), "SAME": lambda self, x, y: int(x == y), "DIFF": lambda self, x, y: int(x != y), "BIGR": lambda self, x, y: int(x > y), "SMLR": lambda self, x, y: int(x < y), "TAKE": lambda self, x, y, z: y if x != 0 else z, "__getitem__": lambda self, op: (lambda: int(op[1:], 16)) if op.startswith("X") else getattr(self, op)})(): [*iter(lambda: (lambda sources = namespace.__program__[state.step][0], op = namespace.__program__[state.step][1], target = namespace.__program__[state.step][2]: lambda values = [("MEMORY", int(x[1:], 16)) if re.fullmatch(r"M[0-9A-F]{4}", x) else ("COUNTER", int(x[1], 16)) if re.fullmatch(r"C[0-9A-F]", x) else ("INDIRECT", int(x[1], 16)) if re.fullmatch(r"I[0-9A-F]", x) else "STEP" if x == "STEP" else ("LOCATION", x) for x in [*sources, target]]: lambda ins = values[:-1], out = values[-1]: state.__setitem__(out, ops[op](*[state[i] for i in ins])))()()() or (0 <= state.step < len(namespace.__program__)), 0)])()}))()):
...;' === important lesbian virtual machine (ILVM), version 2 === '
...;' The ILVM is a 16-bit computer with 16 counters and a 16-bit address space that operates on 16-bit unsigned integers. '
...;' It was first published in 2025 as part of a Code Guessing competition that has not yet been completed. Its author is thus not yet known. It could be anyone. '
...;' The machine is simple and not particularly flashy, featuring standard arithmetic, bitwise, and boolean instructions on unsigned integers. '
...;' It notably lacks a stack or subroutines for control flow, instead relying on absolute jumps and manual counter management. '
...;
...;' The binary representation of instructions is omitted here, so you can imagine it is quite boring. '
...;
...;' Its assembly language is more interesting. '
...;' An instruction in ILVM assembly is separated into three main sections: '
...;' - A list of zero or more sources to be read from as inputs to some transformation '
...;' - The transformation to be performed on the input(s) '
...;' - The target that the result of the operation will be written to '
...;' Furthermore, instructions may be prefixed with an optional location, which acts as a constant-valued '
...;' source pointing to the next instruction that follows (or one past the end of the program, if not found). '
...;' Multiple locations may be given on separate lines\; they are not instructions and do not appear in the resulting binary. '
...;' If a location is not given to an instruction, it must be notated with an ellipsis, i.e. "...". '
...;' The parts of an instruction are notated as follows: '
...;' <optional location>\; from <input sources> import <transformation> as <target> '
...;
...;' Some comments on syntax: '
...;' - <optional location> may be an ellipsis ("...") or an alpha->alphanumeric upper-case ASCII identifier. '
...;' - <input sources> must be a period (".")-separated list of alpha->alphanumeric upper-case ASCII identifiers. '
...;' Trailing periods (".") are forbidden. Leading periods (".") are required (even for zero-input instructions). '
...;' - <transformation> must be an alpha->alphanumeric upper-case ASCII identifier. '
...;' - <target> must be an alpha->alphanumeric upper-case ASCII identifier. '
...;' - A trailing comment may be notated using the semicolon ("\;") and single quote ("\'") characters like so: ("\;\' like so \'"). '
...;' Be sure to leave at least one space (" ") between the single quote ("\'") characters. '
...;' Any semicolons ("\;"), single quotes ("\'"), or backslashes ("\\") inside comments must be prefix-escaped with a backslash ("\\"). '
...;' Newlines (" '
...;' ) are forbidden inside comments. '
...;' - A line may be empty, in which case only <optional location>\; should be given. '
...;' A comment may still be provided on an empty line by inserting single quotes ("\'") after the semicolon ("\;") like so: ("THISCOULDBEANELLIPSIS\;\'like so\'"). '
...;' - Every line must be prefixed by a single space character (" "). '
...;' - The first line in the file is reserved for a "shebang", whatever that means, and is thus ignored. '
...;' Its format is implementation-defined, but is highly recommended to begin it with the phrase "class consciousness", to raise class consciousness. '
...;' - It is considered extremely rude not to align your code, namely at the "from" and "import" tokens as well as any trailing comments. '
...;' - Tabs (" ") are not supported as of version 2 of ILVM due to computational limitations outside of very rare circumstances. '
...;' - A file must end with at least one trailing newline, and preferably two. '
...;' - The file extension for ILVM files must be ".lesbian". '
...;' - Most python interpreters can handle ILVM assembly just fine. You can try your local python interpreter with this file. '
...;
...;' Execution of the program is performed instruction-by-instruction. Some instructions will have side-effects and flip some lights in the machine. '
...;' A light persists until it is updated, or until it is read, after which all lights get turned off (until they are turned on again). '
...;' The cumulative "lights value" is the bitwise union of all the individual lights. '
...;' As of version 2, the following lights are supported: '
...;' - 1: An instruction wrapped a value around 2^16. '
...;' - 2: An instruction returned a zero value. '
...;' - 4: An instruction divided by zero. '
...;
...;' Below are long nested lists relating to semantics: '
...;' - An input source must be one of: '
...;' - The identifier "STEP", representing the current execution step, '
...;' - A capital C ("C") followed by an upper-case hexadecimal digit, representing a counter, '
...;' - A capital I ("I") followed by an upper-case hexadecimal digit, representing the memory address pointed to by a counter, '
...;' - A capital M ("M") followed by four upper-case hexadecimal digits, representing a memory address, or '
...;' - Any valid location in the program, provided that any of the previous cases do not hold. '
...;' - A target must be one of: '
...;' - The identifier "STEP", representing the current execution step, '
...;' - A capital C ("C") followed by an upper-case hexadecimal digit, representing a counter, '
...;' - A capital I ("I") followed by an upper-case hexadecimal digit, representing the memory address pointed to by a counter, or '
...;' - A capital M ("M") followed by four upper-case hexadecimal digits, representing a memory address. '
...;' - A transformation must be one of: '
...;' - A capital X ("X") followed by three upper-case hexadecimal digits, which takes no inputs and outputs the given number, or '
...;' - One of the identifiers in the list below, which is complete as of ILVM version 2: '
...;' - INTO: Takes 1 input and returns it unchanged. It does not alter the lights. '
...;' - NEXT: Takes 1 input and returns the value plus one, updating lights on a wrapping or zero result. '
...;' - PREV: Takes 1 input and returns the value minus one, updating lights on a wrapping or zero result. '
...;' - NGTV: Takes 1 input and returns its negation, updating lights on a wrapping or zero result. (This always wraps unless the value is zero.) '
...;' - SUMM: Takes 2 inputs and returns their sum, updating lights on a wrapping or zero result. '
...;' - SUBT: Takes 2 inputs and returns their difference (first minus second), updating lights on a wrapping or zero result. '
...;' - TMES: Takes 2 inputs and returns their product, updating lights on a wrapping or zero result. '
...;' - OVER: Takes 2 inputs and returns their quotient (first over second), updating lights on a wrapping or zero result, or on a division by zero. The result is rounded down to the nearest integer. Division by zero returns zero, and sets the infinity light. '
...;' - CYCL: Takes 2 inputs and returns their remainder (first modulo second), updating lights on a wrapping or zero result, or on a remainder by zero. Remainder by zero returns zero, and sets the infinity light. '
...;' - SQZE: Takes 2 inputs and returns their bitwise intersection, updating lights on a wrapping or zero result. '
...;' - MRGE: Takes 2 inputs and returns their bitwise union, updating lights on a wrapping or zero result. '
...;' - FLIP: Takes 2 inputs and returns their bitwise symmetric difference, updating lights on a wrapping or zero result. '
...;' - CHOP: Takes 2 inputs and returns their bitwise downward movement (first moved down by second), updating lights on a wrapping or zero result. The upmost bits that appear from the ether are zeros. '
...;' - GROW: Takes 2 inputs and returns their bitwise upward movement (first moved up by second), updating lights on a wrapping or zero result. The downmost bits that appear from the ether are zeros. '
...;' - INVT: Takes 1 input and returns its bitwise complement, updating lights on a wrapping or zero result. '
...;' - ZERO: Takes 1 input and returns 1 when it is zero, and 0 if it is not. It does not alter the lights. '
...;' - NZRO: Takes 1 input and returns 0 when it is zero, and 1 if it is not. It does not alter the lights. '
...;' - SAME: Takes 2 inputs and returns 1 when they are equal, and 0 if they are not. It does not alter the lights. '
...;' - DIFF: Takes 2 inputs and returns 0 when they are equal, and 1 if they are not. It does not alter the lights. '
...;' - BIGR: Takes 2 inputs and returns 1 when they are bigger (first bigger than second), and 0 if they are not. It does not alter the lights. '
...;' - SMLR: Takes 2 inputs and returns 1 when they are smaller (first smaller than second), and 0 if they are not. It does not alter the lights. '
...;' - TAKE: Takes 3 inputs and returns the second when the first is not zero, and the third when the first is zero. It does not alter the lights. '
...;' - LGTS: Takes 0 inputs and returns the current value of the lights. After doing this, the lights are all reset. '
...;
...;' Some memory addresses have special behavior which happens when they are written to or read from. '
...;' These addresses reside at the end of memory (from MFFFF downwards). It would be wise to avoid them for regular storage. '
...;' As of ILVM version 2, the following addresses are special: '
...;' - MFFFC-MFFFF: When any value is written to MFFFF, a read is triggered. '
...;' One value is read from the standard outside input if possible, and written to to address MFFFC. '
...;' If the read was successful, a 1 will be written to MFFFE, and 0 will be written to it otherwise. '
...;' If the standard outside environment has no more values to be read, a 1 will be written to MFFFD, and 0 will be written to it otherwise. '
...;' - MFFFA-MFFFB: When a value is written to MFFFB, a write is triggered. '
...;' The value provided is written to the standard outside output if possible. '
...;' If the write was successful, a 1 will be written to MFFFA, and 0 will be written to it otherwise. '
...;' - MFFF9: When a value is written to MFFF9, the standard outside output is flushed and wiped clean. '
...;' Further memory addresses just below these may be coopted by later versions of ILVM, but addresses less than MF800 will be spared from such a fate. '
...;
...;' If you have any comments or bug reports, please write them to the ILVM talk page! '
...;' important lesbian virtual machine loves you! '
...;
BEGIN; from . import XF00 as C4 ;' Store the initial values '
...; from . import X000 as I4
...; from . import X000 as C5
RECAMAN; from . import X000 as C9 ;' Exit the sequence before we overflow '
...; from .C9 import PREV as C9
...; from .C9 .C5 import SAME as C9
...; from .C9 .END .OUTPUT import TAKE as STEP
OUTPUT; from .C4 .C5 import SUMM as CB ;' Output a number with a newline '
...; from .IB import INTO as C0
...; from . import X00A as C1
...; from . import X004 as C2
DIGIT; from .C0 .C1 import CYCL as I2 ;' Repeatedly divide the number by 10 '
...; from .C0 .C1 import OVER as C0
...; from .C0 import ZERO as C3
...; from .C3 .ZERO .NZERO import TAKE as STEP ;' Skip leading zeros in the representation '
NZERO; from .C2 import PREV as C2
...; from .C2 import ZERO as C3
...; from .C3 .ZERO .DIGIT import TAKE as STEP
ZERO; from .C0 import INTO as M0000
...; from . import X005 as C0
...; from . import X030 as C3
WRITE; from .I2 .C3 import SUMM as MFFFB ;' Write the value, repeating if necessary '
...; from .MFFFA .CONT .WRITE import TAKE as STEP
CONT; from .C2 import NEXT as C2
...; from .C2 .C0 import SAME as C1
...; from .C1 .LINE .WRITE import TAKE as STEP
LINE; from . import X00A as MFFFB ;' Write a newline and flush the output '
...; from .MFFFA .FLUSH .LINE import TAKE as STEP
FLUSH; from . import X000 as MFFF9
...; from .C5 import NEXT as C6 ;' Compute the next candidate '
...; from .C4 .C5 import SUMM as CB
...; from .IB .C6 import SUBT as C6
...; from . import LGTS as C9 ;' Check for an underflow or a zero result '
...; from . import X003 as CA
...; from .C9 .CA import SQZE as C9
...; from .C9 .OLD .SEARCH import TAKE as STEP
SEARCH; from .C4 import INTO as C7 ;' Initialize the sweep index and the bounds '
...; from .C4 .C5 import SUMM as C8
...; from .C8 import NEXT as C8
FIND; from .I7 .C6 import SAME as C9 ;' Check for a match '
...; from .C9 .OLD .NOT import TAKE as STEP
NOT; from .C7 import NEXT as C7 ;' Increment the index and check the bounds '
...; from .C7 .C8 import SAME as C9
...; from .C9 .NEW .FIND import TAKE as STEP
OLD; from .C4 .C5 import SUMM as CB ;' Store the appropriate result into the sequence '
...; from .CB import NEXT as CC
...; from .C5 import NEXT as C5
...; from .IB .C5 import SUMM as IC
...; from .RECAMAN import INTO as STEP
NEW; from .C4 .C5 import SUMM as CB
...; from .CB import NEXT as CC
...; from .C5 import NEXT as C5
...; from .IB .C5 import SUBT as IC
...; from .RECAMAN import INTO as STEP
END;
|
post a comment