996
|
1 Changes from CLC-INTERCAL 1.-94.-3 to 1.-94.-2
|
|
2
|
|
3 * Moved all documentation, user interfaces and the calculator
|
|
4 stuff to separate packages, so their installation is now
|
|
5 optional. The documentation is always available from the
|
|
6 website, so people may not need to install that at all.
|
|
7 There is a plan to move the INTERNET stuff to its own separate
|
|
8 package as well, but this hasn't been done yet.
|
|
9
|
|
10 * Changed Makefile.PL to be a thin wrapper around a new module,
|
|
11 Language::INTERCAL::InstallModule - this is going to do all
|
|
12 the work for CLC-INTERCAL but also for all the optional modules.
|
|
13 One day, it'll also be possible to have a Build.PL without
|
|
14 extra effort.
|
|
15
|
|
16 * Added $VERSION (derived from $PERVERSION) to all modules; this
|
|
17 is required so that the compiler can be uploaded to CPAN and
|
|
18 made available to a wider unsuspecting audience. Added a check
|
|
19 in the test programs to make sure the $VERSION can be found
|
|
20 by ExtUtils::MakeMaker, and hence by the CPAN software.
|
|
21
|
|
22 * Made generic filehandle code (GenericIO.pm) more generic and
|
|
23 modular; this will allow extensions to define new file types.
|
|
24
|
|
25 * Make some changes in Interpreter.pm because the above changes to
|
|
26 GenericIO broke it.
|
|
27
|
|
28 * FIxed some invalid HTML in the documentation. As I was there, I
|
|
29 changed the Makefile so that it can generate the file error.html
|
|
30 from the list of splats, and parsers.html from the list of
|
|
31 bytecodes. The generated HTML will be produced in blib/htmldoc
|
|
32
|
|
33 * A new version of Language::INTERCAL::HostIP has been produced
|
|
34 for better integration with the rest of CLC-INTERCAL. This
|
|
35 version is no longer derived (just inspired) from Sys::HostIP,
|
|
36 after I tried to submit patches to it and could not contact
|
|
37 the author.
|
|
38
|
|
39 * Fixed a bug in the Hollerith encoding (thanks to ais523 for
|
|
40 the bug report); see the end of doc/html/charset.html
|
|
41
|
|
42 * Fixed a problem that caused the calculator to splat when dealing
|
|
43 with registers overloaded by a previous line.
|
|
44
|
|
45 * Fixed a problem with class WRITE IN. Also added test programs for
|
|
46 class I/O.
|
|
47
|
|
48 * Fixed a problem with the theft server when invoked with --linger=0
|
|
49
|
|
50 Changes from CLC-INTERCAL 1.-94.-4 to 1.-94.-3
|
|
51
|
|
52 * Fixed some incompatibility between the implementation of REINSTATE
|
|
53 and the documentation. Thanks ais523 for pointing that out.
|
|
54
|
|
55 * Updated documentation (see doc/html) to reflect the current
|
|
56 state of the compiler.
|
|
57
|
|
58 * Fixed error building CLC-INTERCAL when a previous version was
|
|
59 present. I always clean up after myself :-) so I never noticed
|
|
60 this. Thanks to Mark Brown (maintainer of the debian package
|
|
61 of clc-intercal as well as more useful packages) for the report.
|
|
62
|
|
63 A similar problem also occurred while testing (t/??intercalc-*),
|
|
64 which has also been fixed
|
|
65
|
|
66 * Added the two crawling horrors as accessible registers; however,
|
|
67 there isn't much one can do with them apart from enslaving and
|
|
68 overloading them. Still, they are there, ready for the time they
|
|
69 can be used properly.
|
|
70
|
|
71 * Fixed a problem where constant labels did not have the correct
|
|
72 value if the, ehm, constant had been changed. This can happen if
|
|
73 you use overloading. This isn't the same as computed labels.
|
|
74 Something similar could also happen with ABSTAIN FROM (label)
|
|
75 where the label was a modified constant. Fixed that too.
|
|
76
|
|
77 * Made some changes to the grammars (see 1972.iacc, iacc.iacc, ick.iacc
|
|
78 and sick.iacc) to speed up the compilation process (there was an urgent
|
|
79 need for it!). My favourite example of pathological parser behaviour,
|
|
80 examples/hello.i now takes about 2 minutes to compile, compared with
|
|
81 the over 30 minutes of 1.-94.-4). Moreover, there is now a faster way
|
|
82 to enable/disable the buttons in the calculator which makes it usable
|
|
83 in "sick" mode. For this reason, the calculator now defaults to "sick"
|
|
84 mode, the previous default was "ick" because "sick" was too slow.
|
|
85
|
|
86 * Added some more tests to the test suite; this allowed me to find
|
|
87 and fix a bug in "ick" compatibility mode which generated wrong
|
|
88 bytecode for REINSTATE, and to notice that ABSTAIN and REINSTATE
|
|
89 weren't supported in the calculator (they are now).
|
|
90
|
|
91 * Written a reference implementation for the INTERNET (INTERcal NETworking).
|
|
92 See files under directory doc/INTERNET in this distribution for the draft
|
|
93 specification, which is a modification of the article originally posted
|
|
94 on alt.lang.intercal. If you have any comments, do let me know.
|
|
95
|
|
96 * Made some changes to .sickrc and system.sickrc so that they
|
|
97 can contain defaults for programs other than sick; these are specified
|
|
98 as mappings for weird program suffixes, to allow older versions of
|
|
99 CLC-INTERCAL to read new sickrc files without producing an error -
|
|
100 however in the unlikely case a program has suffix ..<program>.<option>
|
|
101 the older versions will get confused by it (but you wouldn't be able
|
|
102 to compile these programs under any version of CLC-INTERCAL anyway).
|
|
103
|
|
104 Intercalc now uses two options from the sickrc: ..INTERCALC.LANGUAGE
|
|
105 defines the default language and default language options, to be used
|
|
106 when the command line does not contain a -l / --language; and
|
|
107 ..INTERCALC.MODE defines the operating mode (one, expr, full) to be
|
|
108 used when the command line does not contain -m / --mode.
|
|
109
|
|
110 The new INTERNET library also uses options from the sickrc:
|
|
111 ..INTERNET.PORT contains the port number to be used for communication
|
|
112 (default 64928 until we can obtain an official port assignment) and
|
|
113 ..INTERNET.DEVICE.<device_name> contains the broadcast address for
|
|
114 an interface (default: try to determine them - or disable part of the
|
|
115 functionality of the CASE statement if that fails). See the appropriate
|
|
116 section of the README file for another discussion of this.
|
|
117
|
|
118 * Fixed a bug in intercalc which made it impossible to perform an assignment
|
|
119 in "full" mode! Well, it worked in batch mode...
|
|
120
|
|
121 * Added menus in intercalc (as well as special syntax to access the menu
|
|
122 functions in batch mode) to change language, base and (un)select options.
|
|
123 Note that some changes (change base, change mode) will just load the
|
|
124 changes in memory, while other (change language, unselect option)
|
|
125 require a reload of the compiler; doing this in the middle of entering
|
|
126 a statement or expression is permitted but may cause unexpected results.
|
|
127 Even when the compiler needs to be reloaded, the contents of registers
|
|
128 remains unchanged (except for the special registers, if the options
|
|
129 loaded change them). It is also possible to read out the current state
|
|
130 (to a file) and write it back in (from a file) so you can quit the
|
|
131 calculator and start it again in the same state (with the limitations,
|
|
132 to be removed in a future version, that the operating mode must be
|
|
133 the same). In a future version, the calculator will also be able to
|
|
134 change the options stored in your .sickrc to correspond to the current
|
|
135 ones selected from the menu. For now, you can "Read as" to save the
|
|
136 current state to a file, then when you write that back in you get
|
|
137 all your options (mode, language, base, options) restored with it.
|
|
138
|
|
139 * Finished the initialisation code included in compiled objects so that
|
|
140 one can select wimp mode and other stuff from the command line; any
|
|
141 unrecognised option is saved in special register ^AV and any environment
|
|
142 is saved in special register ^EV. Although these registers are not
|
|
143 accessible to user programs, one can always add the syntax for them or
|
|
144 write an extension which will be able to use them.
|
|
145
|
|
146 * Added new system calls to syscall.iasm to allow file operations and TCP
|
|
147 sockets. Note that this is not related to the INTERNET extension.
|
|
148
|
|
149 * Found a very rare bug in the assignment to arithmetic unary divide, which
|
|
150 was so rare it only manifested by running "make test" about 100 times in
|
|
151 a row. At the same time fuxed a related bug which had never manifested.
|
|
152 Changed the test script to run more tests when the result involves random
|
|
153 numbers to help picking these things out in future.
|
|
154
|
|
155 Changes from CLC-INTERCAL 1.-94.-5 to 1.-94.-4
|
|
156
|
|
157 * Simplified Makefile.PL
|
|
158
|
|
159 * Changed the system call interface which is now written in
|
|
160 assembler (that would be INTERCAL assembler, not your
|
|
161 computer's native assembler). It even works in the
|
|
162 calculator, if you use -osyscall...
|
|
163
|
|
164 * Improved "sick.iacc" to allow more sensible templates (e.g.
|
|
165 "READ OUT REGISTER LIST" or "READ OUT EXPRESSION", whereas
|
|
166 before you could only use "READ OUT REGISTER").
|
|
167
|
|
168 * All internal data types (Spot, Twospot, Hybrid, Tail,
|
|
169 Whirlpool) are now subclasses of the same thing, DataItem.
|
|
170 This allows uniform implementation of calculating and using
|
|
171 a register, a simple place where registers and elements can
|
|
172 be overloaded, and an easy way to produce splats, for example
|
|
173 when arrays are used where classes would be expected etc.
|
|
174
|
|
175 * Added "WRITE IN EXPRESSION" which is roughly equivalent to
|
|
176 writing in a numeric value and then assigning the value to
|
|
177 the expression. Alphanumeric and binary WRITE INs are currently
|
|
178 only possible if EXPRESSION is a single register of suitable
|
|
179 type (tail, hybrid or shark fin). For maximum obfuscation do
|
|
180 something like PLEASE WRITE IN #1 and see what happens.
|
|
181
|
|
182 * Made substantial changes to the bytecode - this is necessary to
|
|
183 implement CONVERT and SWAP. The objects will now be incompatible
|
|
184 with 1.-94.-5's objects but hopefully I won't need to make any
|
|
185 more incompatible changes later.
|
|
186
|
|
187 While doing this, going through the various grammar and
|
|
188 checking all generated code - needless to say, found and fixed
|
|
189 some bugs.
|
|
190
|
|
191 Language::INTERCAL::Bytecode is now generated automatically from
|
|
192 a list of bytecode opcodes and internal registers: this means
|
|
193 that a C version (for a C runtime) can be generated from the
|
|
194 same list and guaranteed to be consistent; it also means that
|
|
195 now the module is much faster to load, as its initialisation
|
|
196 can now be done while generating it.
|
|
197
|
|
198 The new module also allows to classify opcodes by type and to
|
|
199 automate some tasks (such as interpreting bytecode and generating
|
|
200 code dependent on a bytecode sequence): this allows a simplification
|
|
201 of both interpreters and backends.
|
|
202
|
|
203 There is also the advantage that the POD documentation is also
|
|
204 generated from the same list, so the two don't get inconsistent
|
|
205 with each other as they used to.
|
|
206
|
|
207 * Added splat *123, program attempted more than 80 levels of
|
|
208 NEXTing, which was never produced by CLC-INTERCAL before.
|
|
209 Ditto for *621, RESUME #0, and *632, RESUME instead of GIVE UP.
|
|
210
|
|
211 * Changed Language::INTERCAL::Splats to be generated like the
|
|
212 bytecode. In fact, any other module can now be generated from
|
|
213 a data file and a template by just including @@DATA anywhere
|
|
214 in it: see comments at the start of Generate/Generate.
|
|
215
|
|
216 * Added unary divide because I just couldn't resist. You don't have
|
|
217 to use it if you don't approve of it. In fact, you are not very
|
|
218 likely to use it as it is almost, but not quite, completely
|
|
219 useless.
|
|
220
|
|
221 * Changed the way the compilers (and compiler compilers etc) work,
|
|
222 simplifying just about everything. Removed the CoreDump backend,
|
|
223 which was only used to produce compilers (etc) and is now
|
|
224 unnecessary.
|
|
225
|
|
226 * Extensively changed Language::INTERCAL::Object to bring it up
|
|
227 to date with all the other changes. As I was there, implemented
|
|
228 CONVERT and SWAP. Note that the functionality is now split
|
|
229 between Language::INTERCAL::Object and Language::INTERCAL::Interpreter
|
|
230
|
|
231 * Added the possibility to assign to any expression, providing a
|
|
232 shortcut to assigning to an overloaded register: for example:
|
|
233
|
|
234 DO .&1 <- #2
|
|
235
|
|
236 * Added ABSTAIN FROM / REINSTATE COMPILER BUG, equivalent to
|
|
237 requesting that the compiler does not generate a bug. When
|
|
238 the compiler bug is ABSTAINed FROM, it may still execute as
|
|
239 an unexplainable compiler bug. As a side effect, one can
|
|
240 now also COME FROM COMPILER BUG and so on, although this is
|
|
241 not likely to be very useful as the COME FROM executes after
|
|
242 the bug, or in other words does not execute at all.
|
|
243
|
|
244 Note that the above does not stop the unexplainable compiler
|
|
245 bug. In fact, by ABSTAINing FROM the explainable bug, one
|
|
246 may trigger the unexplainable one.
|
|
247
|
|
248 Also added the ABSTAIN FROM / REINSTATE QUANTUM COMPUTING,
|
|
249 together with all the normal friends such as COME FROM
|
|
250 QUANTUM COMPUTING etc. These statements refer to any quantum
|
|
251 statement in the program.
|
|
252
|
|
253 Note that there are no template (just gerunds) for COMPILER
|
|
254 BUG and QUANTUM COMPUTING.
|
|
255
|
|
256 Also note that an ABSTAIN FROM QUANTUM COMPUTING WHILE
|
|
257 REINSTATING IT will cause the program to have a split personality,
|
|
258 one quantum, one classical. Or something like that.
|
|
259
|
|
260 * Also made substantial changes to the parser. The idea is that in
|
|
261 many cases the program never needs to be recompiled at runtime,
|
|
262 even if the compiler does change during execution. We do this by
|
|
263 guessing how many alternative versions of the code we are likely
|
|
264 to need, and generating them all. The way it's implemented now it
|
|
265 reduces the recompile but could do a lot more, which is planned
|
|
266 for 1.-93 or (if I find the time) 1.-94.-3
|
|
267
|
|
268 As I was there, I've put some code towards writing the optimiser.
|
|
269
|
|
270 * Changed the way the compiler handles top-level symbols (i.e.
|
|
271 ?PROGRAM) to avoid the code generated becoming exponentially
|
|
272 large, just to be then compressed back to normal by
|
|
273 _setcode() (in Parser.pm). This problem is a consequence of the
|
|
274 previous change. Note that the compiler is stil slower than it
|
|
275 needs to be, but further improvements will need to wait for a
|
|
276 new release.
|
|
277
|
|
278 * Added a lot of functionality to the calculator (intercalc),
|
|
279 which now works in "oic" and "expr" mode (see the docs), and
|
|
280 will probably work in "full" mode but it is untested. Anyway,
|
|
281 you can astonish all your friends with a calculator where you
|
|
282 can type something like:
|
|
283
|
|
284 #1 <- #2
|
|
285
|
|
286 and thereafter whenever you use the number 1 you get 2 instead,
|
|
287 for example:
|
|
288
|
|
289 .1 <- #5
|
|
290 .2
|
|
291
|
|
292 will give you 5 (or rather "V") because you've assigned to .2...
|
|
293 OK, it is a bit slow just now but this is because the compiler is
|
|
294 slow, and improvements will follow in 1.-94.-3. Honest.
|
|
295
|
|
296 * Minor changes/fixes/etc in:
|
|
297 Language::INTERCAL::ArrayIO
|
|
298 Language::INTERCAL::Charset
|
|
299 Language::INTERCAL::Charset::Baudot
|
|
300 Language::INTERCAL::Exporter
|
|
301 Language::INTERCAL::GenericIO
|
|
302 Language::INTERCAL::Interface::None
|
|
303 Language::INTERCAL::Numbers
|
|
304 Language::INTERCAL::ReadNumbers
|
|
305 Language::INTERCAL::Reggrim
|
|
306 Language::INTERCAL::WriteNumbers
|
|
307
|
|
308 Changes from CLC-INTERCAL 1.-94.-6 to 1.-94.-5
|
|
309
|
|
310 * Done some changes to the parser as a preparation for further
|
|
311 development (planned between 1.-94.-4 and 1.-94-release).
|
|
312
|
|
313 * Removed licence.* and the corresponding paragraph in the
|
|
314 README etc. It was a joke but it is getting difficult to
|
|
315 maintain.
|
|
316
|
|
317 * Added a separate gerund for loops and events (before they had
|
|
318 a common gerund); added a possibility to ABSTAIN FROM LOOPING,
|
|
319 which also abstains from events, and the corresponding templates.
|
|
320
|
|
321 Ditto for CONVERT/SWAP to distinguish betweem loops/events and
|
|
322 generic statements.
|
|
323
|
|
324 * Fixed a bug in the bytecode generated for loops, which could not
|
|
325 possibily work in bases other than 2. Ditto for the corresponding
|
|
326 CONVERT and SWAP.
|
|
327
|
|
328 * Fixed a typo on the grammar which caused any expression to be
|
|
329 recognised as end of comment; computed labels appear as
|
|
330 (expression), so this is now the syntax checked. And a related
|
|
331 grammar bug caused invalid code when processing labels!
|
|
332
|
|
333 * Fixed the "COME FROM gerund" code, which caused problems with
|
|
334 examples/quantum/come-from-gerund.gi
|
|
335
|
|
336 * Made some changes in Language::INTERCAL::GenericIO to fix
|
|
337 some problems with the example programs provided.
|
|
338
|
|
339 * Fixed some problems with the bytecode generated for REMEMBER
|
|
340
|
|
341 Changes from CLC-INTERCAL 1.-94.-7 to 1.-94.-6
|
|
342
|
|
343 * Added an INTERCAL desk calculator (intercalc) - just a stub for
|
|
344 now but it'll grow into something one day.
|
|
345
|
|
346 * Bug fixes in the sick.iacc grammar: some quantum statements were
|
|
347 incorrectly specified; also READ OUT * did not parse correctly.
|
|
348
|
|
349 * Some rewriting of the parser allows more flexibility when writing
|
|
350 grammars; also, there is now a mechanism to extract the whitespace
|
|
351 discarded by the compiler: this may be, one day, used to embed
|
|
352 Whitespace (see http://compsoc.dur.ac.uk/whitespace/) into INTERCAL.
|
|
353
|
|
354 Also, the code looking for the end of a comment, which used to
|
|
355 look for the first DO, PLEASE or (number) after a parse error,
|
|
356 now uses symbols defined in the grammar instead. This means that,
|
|
357 for example, sick now recovers correctly from a parse error
|
|
358 just before a computed label; formerly, it would consider the
|
|
359 computed label as part of the comment because it did not match
|
|
360 the simple pattern.
|
|
361
|
|
362 Yes, the compiler is getting slower, but I have ideas on how to
|
|
363 improve that, which I plan to work on in 1.-93; meanwhile, this
|
|
364 release will test all the grammars and iacc files.
|
|
365
|
|
366 * Removed the "deep recursion" messages when compiling the licence
|
|
367 agreement (this would also happen in any other suitably complicated
|
|
368 grammar).
|
|
369
|
|
370 * Removed references to the old licence from all source files, and
|
|
371 updated copyright statement and perversion number.
|
|
372
|
|
373 * Fixed some weirdness in the generation of manpages from pod, caused
|
|
374 by the weirdness of the source directory structure.
|
|
375
|
|
376 * Added an option to link any two objects together; this is similar
|
|
377 to the preload used to compile things, but can be applied to
|
|
378 any object, even one already compiled. Moreover, using --preload
|
|
379 prevents guessing a list of preloads, so you need to specify
|
|
380 them all in the command line; --link is an independent mechanism
|
|
381 and does not stop the default preloads: see the example in the
|
|
382 next bullet.
|
|
383
|
|
384 Note however that not all objects designed to use with --preload
|
|
385 will work with --link; for example, attempting to --link 3.io
|
|
386 will not switch the base at runtime: instead it will cause your
|
|
387 program to fail to run. The reason is that 3.io has been designed
|
|
388 to be included at compile time, not at runtime.
|
|
389
|
|
390 * Added a "trace mode" which allows one to watch bytecode while it
|
|
391 is executed. To use it, compile to object as normal and then link
|
|
392 with trace.io:
|
|
393
|
|
394 sick -lObject PROGRAM.i (or whatever)
|
|
395 sick -lRun PROGRAM.io --link trace.io
|
|
396
|
|
397 of course, you can combine the two:
|
|
398
|
|
399 sick -lRun PROGRAM.i --link trace.io
|
|
400
|
|
401 The advantage of --link over --preload in this case is that --link
|
|
402 does not clear the preload list; the equivalent command using
|
|
403 --preload, and assuming you haven't changed the system.sickrc is:
|
|
404
|
|
405 sick -lRun -psick -ptrace -ppostpre PROGRAM.i
|
|
406
|
|
407 Note that trace.io has been designed to be included at runtime. While
|
|
408 it works in this example, it may cause other preloads to stop working
|
|
409 if they appear after trace.io in the command line.
|
|
410
|
|
411 * Changed the encoding of Hollerith into bytes to interleave the bits
|
|
412 instead of splitting them.
|
|
413
|
|
414 Changes from CLC-INTERCAL 1.-94.-8 to 1.-94.-7
|
|
415
|
|
416 * New licence.
|
|
417
|
|
418 * Minor problems in the documentation fixed (could cause some fussy
|
|
419 browsers to display the examples incorrectly).
|
|
420
|
|
421 Changes since CLC-INTERCAL 0.05
|
|
422
|
|
423 * NOTE: CONVERT and SWAP are currently unimplemented in the prerelease
|
|
424 1.-94 compiler. Use the new CREATE and DESTROY instead (see below).
|
|
425
|
|
426 * ALSO NOTE: This file is sorted by decreasing order of sanity. You may
|
|
427 stop reading at any point, but, if you continue, things are guaranteed
|
|
428 to get worse.
|
|
429
|
|
430 * New version scheme including negative revision numbers has been introduced.
|
|
431
|
|
432 * "Version" renamed "perversion" for honesty.
|
|
433
|
|
434 * Implemented the just-too-late compiler people have heard me talking about:
|
|
435 see file doc/just-too-late.pod
|
|
436
|
|
437 * Modified the operators to support Tri-INTERCAL (and all bases up to 7)
|
|
438 and of course add the extra operators (Unary BUT, etc); the notation will
|
|
439 be different from their C-INTERCAL's counterpart (because the whirlpool
|
|
440 has already been used for classes); unary BUT is written ?; unary Add
|
|
441 Without Carry is written | (in C-INTERCAL compatibility mode, BUT is @
|
|
442 and Add is ^).
|
|
443
|
|
444 * Updated the WRITE IN code to allow input in Latin, like C-INTERCAL 0.20;
|
|
445 also added an alternative spelling for Gaelic Neoni (0).
|
|
446
|
|
447 * Added new stashes. INTERCAL 1972 and C-INTERCAL have two stashes: one for
|
|
448 the program counter (used by NEXT) and one for all the other registers.
|
|
449 CLC-INTERCAL 0.05 had three (two independent ones for the program counter:
|
|
450 did anybody notice that you can do NEXT from within a lecture, do a FINISH
|
|
451 LECTURE, and you can still RESUME? In other words, you could do subroutine
|
|
452 returns in the wrong order and it wold work (for INTERCAL values of work);
|
|
453 after all, you can already stash registers and then retrieve them in the
|
|
454 wrong order, as long as the registers are distinct).
|
|
455
|
|
456 CLC-INTERCAL 1.-94 has sixteen independent stashes, but we aren't (yet)
|
|
457 admitting what they are used for. It helps to remove that unfortunate
|
|
458 resemblance between stashes and stacks. You can now stash a register
|
|
459 several times and then retrieve it in any order, not just the reverse
|
|
460 of the stashing. If this is confusing, don't worry, we can't figure out
|
|
461 why one would want to do that either.
|
|
462
|
|
463 * Updated READ code to allow array slices (e.g. if ;1 is a 2-dimensional
|
|
464 array, READ OUT ;1 SUB #2 will read out all elements of ;1 which have
|
|
465 first subscript #2). For reasons which shall remain unexplained, WRITE IN
|
|
466 can only use whole array or single elements, no slices (this, of course,
|
|
467 might change in a future release).
|
|
468
|
|
469 * Implemented the CREATE statement, as well as its companion DESTROY: the
|
|
470 syntax is different from what had been announced (but never implemented)
|
|
471 before, and use of these statements require knowledge of the INTERCAL
|
|
472 virtual machine, which will be documented in future (possibly). The parser
|
|
473 is now provided in its source form (a list of CREATE statements), and this
|
|
474 can be used as example by anybody who is interested to extend the compiler.
|
|
475 A mini-compiler is provided in src/iacc.iacc (source) and src/iacc.io
|
|
476 (object) to compile the full compiler.
|
|
477
|
|
478 * Implemented a new statement, the "NEXT FROM". This is similar to
|
|
479 "COME FROM", except that the current position is stashed. For example,
|
|
480 the two programs:
|
|
481
|
|
482 (1) DO .1 <- #1 | DO (2) NEXT
|
|
483 PLEASE READ OUT .1 | PLEASE READ OUT .1
|
|
484 DO GIVE UP | DO GIVE UP
|
|
485 DO NEXT FROM .1 | (2) DO .1 <- #2
|
|
486 DO .1 <- #2 | PLEASE RESUME #1
|
|
487 PLEASE RESUME #1
|
|
488
|
|
489 produce the same result ("II"). It is an error to have more than one
|
|
490 "NEXT FROM" looking at the same label, or a "NEXT FROM" and a "COME FROM".
|
|
491 This limitation might be removed in future releases. Also note that
|
|
492 we think this new statement is cool, so you won't have to ask the compiler
|
|
493 to include it (as you need to do with "NEXT"/"RESUME"/"FORGET"), it's
|
|
494 always available.
|
|
495
|
|
496 * Also allowed "Gerund" forms of "COME FROM" and "NEXT FROM", so they now
|
|
497 look like ABSTAINs and REINSTATEs in the grammar. There is an example
|
|
498 in examples/quantum/come-from-gerund.gi; Since programs using this
|
|
499 construct incur some performance penalty (every statement is now a potential
|
|
500 target for a "COME FROM"/"NEXT FROM", not just ones with labels), it needs
|
|
501 to be explicitly enabled by preloading "come-from-gerund" or using the
|
|
502 suffix ".gi" instead of ".i"
|
|
503
|
|
504 * Also updated the definition of "GERUND" to include "COMMENTING" (which can
|
|
505 be abbreviated "COMMENTS") - with all INTERCAL compilers, unrecognised
|
|
506 statements are treated as comments; if they are executed, they print
|
|
507 themselves as error messages and abort. Now it is possible to ignore
|
|
508 errors by saying:
|
|
509
|
|
510 PLEASE ABSTAIN FROM COMMENTING
|
|
511
|
|
512 You can, of course, REINSTATE COMMENTS, although this might transform
|
|
513 genuine comments ("PLEASE NOTE: THIS IS A COMMENT") into error messages.
|
|
514 But then, you had a similar problem when comments had labels.
|
|
515
|
|
516 * Modified the initialisation code to make the command-line and the
|
|
517 environment available to the program. These will be found in the special
|
|
518 array registers ^1 and ^2, respectively. The arrays are bidimensional,
|
|
519 with ^1 SUB #1 containing the first argument, ^1 SUB #2 the second, and
|
|
520 so on. Needless to say, these arguments are provided as if they had been
|
|
521 written in, so they are likely to be in Baudot or something as bad as that.
|
|
522 A class library to implement associative arrays is going to be provided
|
|
523 one day - this would be just what you need to use ^2 (the environment).
|
|
524
|
|
525 Please note that these registers are used by the initialisation code, and
|
|
526 are not normally accessible to the program (but see the next point)
|
|
527
|
|
528 * Made some of the program's internal state accessible to the program via a
|
|
529 set of special registers (%n). For example, "DO %1 <- #1" will cause the
|
|
530 program to do something unexpected (because %1 is the first part of the
|
|
531 instruction pointer, the rest being %2 and %3). Note that a statement
|
|
532 starting with "DO %1" can now be an assignment or something else, for
|
|
533 example "DO %10 <- #1" is an assignment, and "DO %10 READ OUT .1" is a
|
|
534 statement which reads out a register one time in ten. This is OK because
|
|
535 IACC (the parser generator) happily accepts nondeterministic grammars, and
|
|
536 sometimes even produces the expected results.
|
|
537
|
|
538 The use of these registers should be limited to the compiler itself. In
|
|
539 fact, they are currently only available to the compiler, but nobody stops
|
|
540 the programmer from making them available with the appropriate CREATEs.
|
|
541
|
|
542 If you really must, the list of these register is around line 82 of
|
|
543 Language/INTERCAL/Object.pm -- look for %special_registers. Note that
|
|
544 you cannot use any % or ^ register unless it's listed there, and you
|
|
545 cannot always resize ^ registers. Some of the registers behave weirdly.
|
|
546
|
|
547 * Rewritten the write/read code to allow more flexibility from within the
|
|
548 program - this is used by the compiler itself as well as by other things
|
|
549 which are currently kept secret. The word "Outercal" has been uttered again.
|
|
550
|
|
551 * Added some more quantum constructs:
|
|
552
|
|
553 DO register <- expression WHILE NOT ASSIGNING TO IT
|
|
554 DO COME FROM (label) WHILE NOT COMING FROM THERE
|
|
555 DO CREATE ... WHILE NOT CREATING IT
|
|
556 DO DESTROY(... WHILE NOT DESTROYING IT
|
|
557 DO ENROL register TO LEARN subjects WHILE NOT ENROLLING
|
|
558 DO ENSLAVE register TO register WHILE LEAVING IT FREE
|
|
559 DO FINISH LECTURE WHILE CONTINUING IT
|
|
560 DO FORGET expression WHILE NOT FORGETTING
|
|
561 DO FREE register TO register WHILE LEAVING IT IN SLAVERY
|
|
562 DO NEXT FROM (label) WHILE NOT NEXTING FROM THERE
|
|
563 DO GIVE UP WHILE CONTINUING TO RUN
|
|
564 DO register GRADUATES WHILE REMAINING A STUDENT
|
|
565 DO register LEARNS subject WHILE NOT LEARNING IT
|
|
566 DO (label) NEXT WHILE NOT NEXTING
|
|
567 DO RESUME expression WHILE NOT RESUMING
|
|
568 DO RETRIEVE registers WHILE NOT RETRIEVING THEM
|
|
569 DO STASH registers WHILE NOT STASHING THEM
|
|
570 DO STUDY subject AT (label) IN CLASS @(number) WHILE NOT STUDYING IT
|
|
571 DO WRITE IN registers WHILE NOT WRITING THEM
|
|
572
|
|
573 Note that quantum assignment will also generate quantum bits on side effects:
|
|
574 if the expression contains some overloading, the overloading will take effect
|
|
575 while not taking effect; if the assignment modifies constants (see next
|
|
576 point), they will retain their previous value while assuming a new one.
|
|
577 This applies to most of the new constructs except (just to be different)
|
|
578 quantum COME FROM, which always applies side effects but causes the program
|
|
579 to jump while remaining stationary (similarly quantum NEXT FROM and
|
|
580 behaves like quantum COME FROM)
|
|
581
|
|
582 Examples for all forms of quantum constructs are found in directory
|
|
583 examples/quantum: all these files can be compiled with the default
|
|
584 CLC-INTERCAL compiler; in addition, examples/threads.i is a program
|
|
585 which demonstrates the use of (non-quantum) threads, and must be
|
|
586 compiled using the Threaded INTERCAL compatibility mode ("thick").
|
|
587
|
|
588 * Allowed to modify constants by assigning to an overloaded register, for
|
|
589 example:
|
|
590
|
|
591 PLEASE DO .1 <- .1/#1
|
|
592
|
|
593 will (shock! horror!) leave the value of .1 unchanged, but at the same
|
|
594 time modifies the value of #1 to whatever value was in .1 before the
|
|
595 assignment. Note that this changes more than you might expect: for
|
|
596 example, the "1" in ".1" will now change too... so when you try to
|
|
597 assign to .1 (for example to restore #1 to its former value), you might
|
|
598 get a different register. The way around it is:
|
|
599
|
|
600 PLEASE DO .2 <- #1
|
|
601 PLEASE ENSLAVE .2 TO .1
|
|
602 DO .1 <- #1234
|
|
603 DO .1 <- .1/#1
|
|
604 DO SOMETHING WITH #1 CHANGED TO #1234
|
|
605 DO $.2 <- .2
|
|
606 DO FREE .2 FROM .1
|
|
607
|
|
608 You need to use $.2, because .1 is not accessible in any other way. Of
|
|
609 course, you are responsible for keeping the value of #2 constant during
|
|
610 the above code.
|
|
611
|
|
612 You probably guessed a simpler solution already:
|
|
613
|
|
614 PLEASE DO .1234 <- #1
|
|
615 PLEASE ENSLAVE .1234 TO .1
|
|
616 DO .1 <- #1234
|
|
617 DO .1 <- .1/#1
|
|
618 DO SOMETHING WITH #1 CHANGED TO #1234
|
|
619 DO $.1 <- .1
|
|
620 DO FREE .1234 FROM .1
|
|
621
|
|
622 This works because the references to .1 are really references to .1234,
|
|
623 which of course contains .1; and $.1 is really $.1234 which is the real .1
|
|
624
|
|
625 People who want to keep their sanity should avoid assigning to constants.
|
|
626 (come to think of it, people who want to keep their sanity should avoid
|
|
627 INTERCAL...)
|
|
628
|
|
629 People who are not so worried about their sanity can read all about
|
|
630 overloading in the documentation.
|
|
631
|
|
632 * A new operating system interface is available via the use of the special
|
|
633 register %OS and the compiler module "syscall.iacc" (which can be added to
|
|
634 sick by using the option "-psick -psyscall" or, better, "--suffix=si").
|
|
635 After you added "syscall.iacc" to your program, it will behave as if the
|
|
636 operating system had, lurking in its darkest corner, the statement:
|
|
637
|
|
638 DO NEXT FROM (666)
|
|
639
|
|
640 (In fact, it is a computed NEXT FROM and the label is specified by the
|
|
641 internal register %OS; however, since the register is not accessible to
|
|
642 the program, it is just as good as a noncomputed one, unless you use CREATE
|
|
643 to make the register accessible). The operation code is contained in
|
|
644 register +.1-$%OS which is just a shortand for "the spot register with the
|
|
645 same number as the last register assigned to before the system call". For
|
|
646 example, the following:
|
|
647
|
|
648 (666) DO .666 <- #2
|
|
649
|
|
650 would execute system operation #2, whatever it is. However, the following:
|
|
651
|
|
652 (666) DO :123 <- #2
|
|
653
|
|
654 would execute the system operation with code in .123 (the assignment was to
|
|
655 :123, which of course does not alter .123, but sets the register number to
|
|
656 be used to 123, so the expression "+.1-$%OS" becomes equivalent to
|
|
657 "+.1-:123" which is of course ".123".
|
|
658
|
|
659 Also note that if a thread has never assigned to a register, it is an error
|
|
660 to use the syscall interface. A program starting with:
|
|
661
|
|
662 (666) DO NOT GIVE UP
|
|
663
|
|
664 would therefore produce an error.
|
|
665
|
|
666 One more note, "writing" a register means assigning to it. For example,
|
|
667 the following program would obtain a system operation number from the
|
|
668 operator:
|
|
669
|
|
670 (666) PLEASE WRITE IN .1
|
|
671
|
|
672 An then there is:
|
|
673
|
|
674 (666) DO RETRIEVE :1 + ,2 + ;3
|
|
675
|
|
676 which can decide to use .1, .2 or .3 depending on the actual order of
|
|
677 evaluation (the RETRIEVE is considered to modify all the registers listed).
|
|
678 In all versions of CLC-INTERCAL, registers are retrieved in order, so,
|
|
679 until we change something, this uses .3 for the opcode.
|
|
680
|
|
681 Enslaving, freeing, enrolling and graduating are not considered
|
|
682 modifications in this context. Overloading is also not considered a
|
|
683 modification (including assignment to overloads) although it probably
|
|
684 ought to be. If you want consistency, don't use INTERCAL. For example:
|
|
685
|
|
686 PLEASE .1 <- .2/#3
|
|
687 (666) DO .2 <- #4
|
|
688
|
|
689 would execute the system call with ".1", not ".2", because the last
|
|
690 assignment is to an overloaded register (in fact, it is altering #3
|
|
691 to be the same as #4, so it is not assigning to a register at all!)
|
|
692
|
|
693 The list of system operations does not necessarily correspond with the
|
|
694 O.S. kernel's list of syscalls, or with anything else. It is currently
|
|
695 documented only by the self-explanatory source code in syscall.i - which
|
|
696 also doubles as example for "COME FROM GERUND" and "CREATE".
|
|
697
|
|
698 Parameters to the call are contained in registers with the same number
|
|
699 as the opcode: +:1-$%OS for numbers, +,1-$%OS for strings and +;1-$%OS
|
|
700 for lists of numbers. Of course, some opcodes have nonstandard calling
|
|
701 conventions.
|
|
702
|
|
703 It is possible to disable system calls using "DO ABSTAIN FROM NEXTING FROM",
|
|
704 and re-enable them with "DO REINSTATE NEXTING FROM".
|
|
705
|
|
706 * Since you are still here, you can read the comment before subroutine
|
|
707 _forall_statement() in Language::INTERCAL::Object and reproduced below:
|
|
708
|
|
709 # The following subroutine handles the rather dubious case in which the
|
|
710 # compiled program has changed, and the program counter needs adjusting
|
|
711 # in all threads to find where the current code has gone. The reason it
|
|
712 # is called _forall_statements is because this can only happen when we
|
|
713 # sweep through the program, for example to find come froms, labels, and
|
|
714 # what have you. In all other cases, the program counter automagically
|
|
715 # adapts to the code. Really. Look at _run_code() if you don't believe me
|
|
716
|