CLC-INTERCAL-1.00000755001750001750 014602536740 14026 5ustar00intercalintercal000000000000CLC-INTERCAL-Base000755001750001750 014602536740 16417 5ustar00intercalintercal000000000000CLC-INTERCAL-1.00COPYING000644001750001750 323514602536740 17614 0ustar00intercalintercal000000000000CLC-INTERCAL-1.00/CLC-INTERCAL-BaseCopyright (c) 2006-2008, 2023-2024 Claudio Calvelli (Please include the word INTERLEAVING in the subject when emailing that address, or the email may be ignored) In addition to the above, permission is hereby granted to use, misuse, modify, distribute, break, fix again, etcetera CLC-INTERCAL-1.00 provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the Author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Changes000644001750001750 14476014602536740 20125 0ustar00intercalintercal000000000000CLC-INTERCAL-1.00/CLC-INTERCAL-BaseChanges from CLC-INTERCAL 1.-94.-2.4 to 1.00 * The build system had a bit of hardcoded stuff for the INET which was left in by mistake. Removed. * Added a new optional XS module for the calculations which happen most often (interleave, select, unary AND, OR and XOR). It is rather faster than the Perl version if it can be built. * Updated the build system to simlify passing options to the various extensions when built as part of the Bundle. * Added new test programs for existing and new functionality. * Added a mechanism by which an extension can extend a preload. Initially to be used by the INET extension to extend syscall.iasm * Added a mechanism by which an extension can provide new file access modes; this will be used by the INET extension to provide "delayed open" for files. * Non-blocking operation: before, if a statement could block, it would block the whole program. This applied to WRITE IN where the data came from a device or network connection, and to some system calls (also, to CASE, SMUGGLE and STEAL from the INET extension). Now it is possible to ask for just the thread executing the operation to block, while other threads can go ahead; the programmer is responsible for not using the data before it arrives, which was impossible before but it's possible now, therefore the non-blocking operation must be requested either by adding the "nonblock" preload or by including the letter "b" in the suffix. * Two new syscalls, to sleep a specified number of microseconds. One blocks the whole program, and the other one blocks just the calling thread. These are intended primarily to test the blocking / non-blocking operation, but could be useful in programs. They do not obey the presence or absence of "nonblock" preload, but they are defined to always block / nonblock. * Moved syscall #6 (open TCP socket) to the INET extension: it won't work without loading the extension anyway. Changes from CLC-INTERCAL 1.-94.-2.3 to 1.-94.-2.4 * Modified Splats, ByteCode and Registers so that they also have the description of the various opcodes and splats; this has always been in the source data, and is used to generate the documentation, but was not included in the modules. Adding this will allow the documentation to also include items added by an extension. Also including the "source" of each item (undef = Base, otherwise the name of the extension which added it), which will also be used for documentation. * Modified RcFile so that it keeps track which extension added which configuration item. This may permit in future to add information about required extensions in a saved sickrc. * Removed documentation-specific code from Generate.pm - the Docs package now has a different way to generate HTML files. * Moved TCP filehandles (TCP and UTCP) to INET where they belong. Also moved all network-specific parts of Server (TCP and UDP) to INET. Splitting Server.pm into local file (Base) and network (INET) parts also permitted a simplification of its code. * Added an option to the "None" (batch) interface to allow reading generic binary data in (and also to reading in without producing a prompt); this is for use by the calculator when loading state from standard read, but will also be used when the compiler command line tool will start using interfaces. * Simplified the build system slightly and removed unnecessary make rules. Also removed some files which were generated but also included in the distribution, because the build required these files but the files could only be generated after building the system. Some of the simiplifications removed this circular dependency. * Changed the system call #1 (perversion number) to use the running interpreter's perversion instead of specifying one; this means we won't have to keep updating syscall.iasm with each escape; also test t/13syscall.t compares the result against the perversion of the running interpreter rather than a harcoded one as it did before. * Improved the tracing output by including the corresponding source fragment if it can be found. Also made sure to list any bytecode being skipped (for example, overloading because it stores it instead of executing it). * Profiling identified several places where optimisation would do most good so made changes in there which resulted in performance improvements. This includes: - ByteCode::bc_skip(), used in many places where the length of a chunk of bytecode needs to be known (overloading, some unoptimised expressions, COME FROMs, loops and events, system calls). - Interpreter::_find_label() and other code it calls: used every time something needs to find a label, like NEXT, diversins, lectures; it isn't just a matter of looking up the number, because constants aren't going to keep the same value for the duration of the program. - Interpreter::_run_e() and code which calls it: used for everything required to produce a value, from whole expressions, their sub- expressions and down to single numbers. Naturally, any improvement in it will help every program. - The "but" operation encoded "and", "or" and the more generic "but" as a single function ("but 0" meaning "and" and "but 7" meaning "or"); these have been split into separate functions and the compilers modified to produce them (the old "but" opcode still supports "and" and "or" for compatibility with older objects). Also, the base 4 "and" code has been rewritten. * The Optimiser was never actually used apart from selecting pre-compiled optimised sources if available. That's been rectified, and in the process an optimiser bug fixed. Also added new optimiser tests. * Some new code introduced with the previous escape, intended to avoid perl constructs which used to be recommended but are now discouraged, ended up being disabled by default... it was supposed to be enabled when possible and disabled when running in an old installation, but was disabled for testing and never reenabled. There is now a mechanism to disable it via environment variables and also to test after loading which mechanism was enabled. * Interpreter had a memory leak because the tracing information for each thread contained a reference to the thread itself, and the thread contained a reference to the tracing information. This made it impossible to garbage collect a thread. This is now fixed by explicitly removing one reference so the other can be freed. Changes from CLC-INTERCAL 1.-94.-2.2 to 1.-94.-2.3 * Rewrote some of the Number module to work properly on 32 bit processors when perl is built without any form of 64 bit integers. The algorithms employed would work correctly on 32 bit integers if ignoring the overflows like C does. Unfortunately perl does not ignore the overflow but convert the numbers to floating-point with loss of the lowest significant bits, just the bits we need to keep. * Added a mechanism to generated modules to report the highest version number between the code and the data used to generate; this means that another module can ask for a minimum version of the data even if the code is older (this applies to things like ByteCode which is generated from the list of opcodes and some code which doesn't change often). * Added a mechanism to allow optional packages to specify alternative modules at build time. Currently, only the INET extension uses it, to select a way to get the network interfaces depending on what's installed and what works on a particular system; other extensions may use it in future, and there's a possibility of using it in Base to install system-specific optimised modules. * Also removed all the things specific to the Docs package in the build system, and moved them to the Docs package itself. When installing it, it will extend the build system found in the Base package. * Updated the Interpreter's state to allow extra information in registers, with Interpreter::State able to load saved state with and without the new information (but always including all information when saving state). This has space for the soon-to-be-implemented trickle down mechanism. * Discovered and fixed an issue with quantum grammar operations (create, destroy, convert and swap) which didn't share changes between entangled states; in the non-quantum case, all thread share the same state, and changes made by one thread weren't visible to any other threads; in the quantum case things are more complicated but still changes need to be shared between some sets of states ando not shared with others, while the previous implementation never shared anything. * Implemented the promised (threatened) TRICKLE DOWN structure. Changes from CLC-INTERCAL 1.-94.-2.1 to 1.-94.-2.2 * Implemented the "road closures" which are a generatlisation of ABSTAIN FROM and COME FROM with a helping of extra tentacles. * Made a start on the new optimiser. * Changed some operators and bytecode with inappropriate names to something less so. For example the "OWN" bytecode is now called "BLM". Old names and old syntax will still be accepted, to be able to run old programs. * Added code to make sure that loops/events where body and condition come from different programs execute correctly. This could happen for example if one of then executes a NEXT or LEARNS, or is the target of a COME FROM / NEXT FROM. * Added functionality to allow ABSTAINing FROM a GIVE UP by label if the compiler is operating in C-INTERCAL compatibility mode. This is controlled by special register %GU which is cleared by ick.iack and set by other compilers. * The "assign to BUT / what / whirlpool" expression generated an "Impossible assignment" splat a bit too freely for bases > 4, a small change in it made it work in a lot more cases. Also added lots of new tests for all operators. * Removed the RegGrim module - it was never fully implemented, so it can't have been used (all it would do is splat). If we want something like that, it'll do with a redesign anyway. * Added a few new splat values to change generic error messages (often using SP_INTERNAL or SP_COMMENT) to be more specific. * Added a new special register to control whether a GIVE UP can be ABSTAINed FROM or REINSTATEd by label, as C-INTERCAL does, or it cannot, as we do; this register is automatically set in C-INTERCAL compatibility mode. * Added a new opcode to let compilers pass special information about a statement to the runtime, initially this can indicate the presence of PLEASE and ONCE/AGAIN. * Implemented C-INTERCAL's / Threaded INTERCAL's ONCE and AGAIN. Additionally, implemented a quantum version of it: DO (statement) ONCE AND AGAIN The statement itself could be quantum or not, all possible combinations are supported. * Updated 1972.iacc, ick.iacc and sick.iacc to record the number of PLEASE. There is no politesse checking at this point as we first need to review all the examples to see if they are in the accptable range; however the ListObject backend now prints the percentage of PLEASE for reference. * Added a new gerund to sick.iacc: EVOLUTION. It can only be used in ABSTAIN FROM and REINSTATE statements, and it means the opposite of CREATION: so PLEASE REINSTATE EVOLUTION means the same as PLEASE ABSTAIN FROM CREATION. This means that using this in a list of gerunds has the sligtly counterintuitive meaning of abstaining from some statements and reinstating others. * Re-added the option to inline INTERCAL in Perl sources which was available in very ancient versions of CLC-INTERCAL but had been removed during one of the rewrites; it now uses Sick.pm and a perl source filter, so it will remain supported no matter how much we change CLC-INTERCAL in future. * Some small changes in sick.iacc result in much improve parse time, for example hello.i (the thing which is nothing short of cruelty to compilers) now compiles in 0.2 seconds instead of 3 seconds on my system. The language accepted is not affected by this, just the time to parse it. * Major rewrite of the Interpreter to split subroutines which did multiple things into separate subroutines which can be called as needed; this means that it doesn't need to spend most of its time checking what a subroutine was expected to do. Also added some shortcuts which remove the need to scan the whole code when, for example, looking for labels (COME FROM, NEXT FROM, NEXT, LEARNS) and all this results in a substantial improvement. For the unoptimised floatlib test, this means 4 times faster; for the unoptimised syslib test, twice as fast, and for other tests it ranges from a bit faster to a lot faster: the longer a program runs, the more it gains from this. * While rewriting the Interpreter noticed that converting (for example) a COME FROM (label) to an ABSTAIN FROM (label) did not execute correctly, in general a COME FROM could be converted to a NEXT FROM and vice versa, but conversion with other compatible types of statements (e.g. REINSTATE) did not make the correct changes to the code. This now works. (Issue #11) * Removed the "MAKE NEW OPCODE" statement which was documented as "may change without notice" and never used, as the new extension mechanism does a better job * Tidy up of other code (Object, Parser, etc) to remove functions no longer required by the new Interpreter, or to improve functions which are still required and are called a large number of times during the execution of a program. * Removed the definition of bytecode opcodes which weren't actually implemented in the Interpreter: these are opcodes which will be used by an Optimiser, when one will be written, and are best added by the Optimiser itself using the new extension mechanism. * Added more tests for bitwise operations and found some issues with assigning to a BUT which must have been there since the operation was made assignable, so figured out what went wrong and fixed it. In the process, moved some operations from Interpreter to Numbers. * Removed from the Interpreter all ths save state / restore state code which is only used by the calculator; this is still in Base, but in a separate module which may be requested. Also added an option to Sick to request a non-default Interpreter. In future, there could be more options for an Interpreter implementation and this mechanism will select the one to use. * Support for C-INTERCAL's syslib and floatlib if the user has installed the sources or can provide a copy of them. * Optimised versions of C-INTERCAL's syslib and floatlib which are always available but must be requested with --optimise * Added a new special register, %SM, which control the size of the result of a select operation. CLC-INTERCAL has always made this data-dependent: if it fits in one spot, it is one spot, otherwise it is two spot. This seems to correspond to the traditional specification, but it's hard to implement in a compiler. C-INTERCAL has always made this equal to the size of the second operand. The interpretation makes a difference when the result of a select is used as argument to a unary operator, as size, in this rare case, does really matter, and this subtle difference made the syslib.i and floatlib.i occasionally fail. The value of %SM now controls this, and defaults to 1 (data-dependent) for sick and 1972, and to 0 (size of second operand) for ick. Also more changes to ick.iacc to make it more compatible with ick. Changes from CLC-INTERCAL 1.-94.-2 to 1.-94.-2.1 * Allowed --backend to specify a comma-separated list, so an object can be loaded or compiled once, then passed to several backends. * Amazing parser performance improvement by changing one single character in Parser.pm. A very important character but just one nevertheless. Now instead of adding the whole grammar every time it expands a symbol, it just adds the productions which make sense in the context. This change was made possible by the new grammar profiling. * Added a simple but effective grammar profiling code, to see what the parser is actually do when the compile time is a bit long. * Added some more test programs * Almost completely rewritten sickrc file support, which now ties with the new extension mechanism so that an extension can also register new configuration. This means that anything to do with other modules has now been removed from Base and moved to the appropriate place. * Modified Language::INTERCAL::Server for IPv6 support, where possible. Also added support for joining IPv6 multicast groups. Moved the INET-specific answer to broadcast and multicast packets to a callback specified by the caller. * Moved all the INTERNET-specific stuff to the INET package with the exception of Server, which is needed to open TCP sockets using the system call interface. * Added a few sorts when producing objects and object listings, to make the builds reproducible. * Fixed a bug in _parse_junk() which would produce the wrong message when executing comments. * Fixed a bug in _guess_charset which made it fail to detect the charset in a number of cases. * Fixed a minor grammar bug in sick.iacc; added two CREATE tests in t/11compiler-sick.t, to show how one can achieve the undocumented behaviour mentioned in alt.lang.intercal article * Moved most of t/00use.t to Language::INTERCAL::Distribute so that other modules can just use that * Removed a "grep" which managed to sneak into the ddsh distribution, making it an invalid DD/SH program. * added an option to "sick" to append any preloads to the list guessed from suffix, rather than replacing the list. * added an option to "sick" to force all outputs to go to a specified directory (instead of going to the directory which contained the source) * fixed some issues when generating objects (as opposed to running them immediately). Changes from CLC-INTERCAL 1.-94.-3 to 1.-94.-2 * Moved all documentation, user interfaces and the calculator stuff to separate packages, so their installation is now optional. The documentation is always available from the website, so people may not need to install that at all. There is a plan to move the INTERNET stuff to its own separate package as well, but this hasn't been done yet. * Changed Makefile.PL to be a thin wrapper around a new module, Language::INTERCAL::InstallModule - this is going to do all the work for CLC-INTERCAL but also for all the optional modules. One day, it'll also be possible to have a Build.PL without extra effort. * Added $VERSION (derived from $PERVERSION) to all modules; this is required so that the compiler can be uploaded to CPAN and made available to a wider unsuspecting audience. Added a check in the test programs to make sure the $VERSION can be found by ExtUtils::MakeMaker, and hence by the CPAN software. * Made generic filehandle code (GenericIO.pm) more generic and modular; this will allow extensions to define new file types. * Make some changes in Interpreter.pm because the above changes to GenericIO broke it. * FIxed some invalid HTML in the documentation. As I was there, I changed the Makefile so that it can generate the file error.html from the list of splats, and parsers.html from the list of bytecodes. The generated HTML will be produced in blib/htmldoc * A new version of Language::INTERCAL::HostIP has been produced for better integration with the rest of CLC-INTERCAL. This version is no longer derived (just inspired) from Sys::HostIP, after I tried to submit patches to it and could not contact the author. * Fixed a bug in the Hollerith encoding (thanks to ais523 for the bug report); see the end of doc/html/charset.html * Fixed a problem that caused the calculator to splat when dealing with registers overloaded by a previous line. * Fixed a problem with class WRITE IN. Also added test programs for class I/O. * Fixed a problem with the theft server when invoked with --linger=0 Changes from CLC-INTERCAL 1.-94.-4 to 1.-94.-3 * Fixed some incompatibility between the implementation of REINSTATE and the documentation. Thanks ais523 for pointing that out. * Updated documentation (see doc/html) to reflect the current state of the compiler. * Fixed error building CLC-INTERCAL when a previous version was present. I always clean up after myself :-) so I never noticed this. Thanks to Mark Brown (maintainer of the debian package of clc-intercal as well as more useful packages) for the report. A similar problem also occurred while testing (t/??intercalc-*), which has also been fixed * Added the two crawling horrors as accessible registers; however, there isn't much one can do with them apart from enslaving and overloading them. Still, they are there, ready for the time they can be used properly. * Fixed a problem where constant labels did not have the correct value if the, ehm, constant had been changed. This can happen if you use overloading. This isn't the same as computed labels. Something similar could also happen with ABSTAIN FROM (label) where the label was a modified constant. Fixed that too. * Made some changes to the grammars (see 1972.iacc, iacc.iacc, ick.iacc and sick.iacc) to speed up the compilation process (there was an urgent need for it!). My favourite example of pathological parser behaviour, examples/hello.i now takes about 2 minutes to compile, compared with the over 30 minutes of 1.-94.-4). Moreover, there is now a faster way to enable/disable the buttons in the calculator which makes it usable in "sick" mode. For this reason, the calculator now defaults to "sick" mode, the previous default was "ick" because "sick" was too slow. * Added some more tests to the test suite; this allowed me to find and fix a bug in "ick" compatibility mode which generated wrong bytecode for REINSTATE, and to notice that ABSTAIN and REINSTATE weren't supported in the calculator (they are now). * Written a reference implementation for the INTERNET (INTERcal NETworking). See files under directory doc/INTERNET in this distribution for the draft specification, which is a modification of the article originally posted on alt.lang.intercal. If you have any comments, do let me know. * Made some changes to .sickrc and system.sickrc so that they can contain defaults for programs other than sick; these are specified as mappings for weird program suffixes, to allow older versions of CLC-INTERCAL to read new sickrc files without producing an error - however in the unlikely case a program has suffix ...