INTERCALC(1p)
πΈ NAME πΈ
intercalc β the CLC-INTERCAL desk calculator, bestie π
(Also: this is a 1p page, aka User Contributed Perl Documentation, and yes that's a whole vibe.)
β¨ SYNOPSIS β¨
intercalc [options]
π¦ DESCRIPTION π¦
okay so intercalc is literally just a simple desk calculator, except it's the fun kind: you type in INTERCAL statements (to see what they do) and expressions (to see what value they produce), and it uses an interpreter object from CLC-INTERCAL to give you immediate feedback. no cap, instant gratification π
The desk calculator accepts several options, and some of them are documented right here. Others are not. We move. π«Ά
π User Interface Options π
-X,--graphicβ Enters the X-based graphical user interface. Requires Perl-GTK. This is the default if Perl-GTK is installed, the environment variable$DISPLAYis set, and the opening of the X display succeeds. Three green flags, then she's the main character β¨-c,--cursesβ Enters the full screen, curses-based interface. This is the default if the X based interface cannot be started, the environment variable$TERMis set, and the terminal name is known. Plan B but make it cute πΈ--lineβ Enters the line-mode user interface. This is the default if the X based and the curses based interfaces do not work. Plan C, she's resilient πͺ
In this mode, the program executes each line from standard input according to the current mode and language, and prints results to standard output. A line starting with a backspark is interpreted as a command to the calculator. Use backspark-g to GIVE UP (you'll need to do it twice), or backspark-h to display the ehm, help page. Things which are available via menu entries on the Curses and X interfaces are also available via the backspark. For now, you can refer to the source code for a list.
Command-line editing and command history is provided by the readline library. Command completion works if the underlying compiler supports it (the compilers provided with the distributions do). iykyk π
--batchβ Avoids entering interactive mode. This is the default if the standard input and output are not connected to a terminal and the X based interface cannot be started. This mode is very similar to the line mode except that command-line editing and command history are not implemented. Backspark escapes work just the same. Introvert mode fr fr π-itype,--interface=typeβ Selects the user interface type. Currently, only X, Curses, Line and None are defined, but more can be installed as compiler plug-ins. If the interface selected is None,intercalcwill work in batch mode. In addition, an empty string will reinstate the default behaviour. Pick your fighter π
π§ Source language and compilation options π§
--bug=numberβ Selects a different probability for the compiler bug. The compiler bug is implemented by initialising the compiler's state with the required probability: when a statement is compiled (usually at runtime), a"BUG"instruction is emitted with the required probability. The default is 1%. chaotic on purpose π--ubug=numberβ Selects a probability for the unexplainable compiler bug. This is the compiler bug which occurs when the probability of a (explainable) compiler bug is zero. Only wimps would use this option. The default is 0.01%.
bestie. only wimps. you've been warned π«£
-Ipath,--include=pathβ Adds a directory before the standard search path for compiler objects and source code. If a file is accessible from the current directory, it is never searched in any include path.
If this option is repeated, the given paths will be searched in the order given, followed by the standard paths. Order matters, she's a queue π
-llanguage,--language=languageβ Selects the language to use when interpreting user input. This should correspond to the name of a compiler, which is an INTERCAL object which was originally built byiacc. Only the expression and statement parsers are used, so it is possible to test incomplete compilers by loading them intointercalceven if they don't work withsick. The default is obtained from thesickrcoption.INTERCALC.LANGUAGE. Testing your half-finished compiler? lowkey iconic β--ooption,---option=optionβ Adds a language option. For example,--o3selects base 3 calculation, and--owimpselects wimp mode. If no options are provided, and the default language was taken from thesickrcfile, the default options are taken from thesickrcfile. Note that if an option or a language is specified on the command line, thesickrcdefaults are ignored.
Unlike previous versions of intercalc, this version checks that the options make sense in the context of the calculator; for example trying to load a compiler as an option will cause an error, but a compiler extension will be OK. She grew up, she has boundaries π
-mmode,--mode=modeβ Select operation mode. Currently, the only valid modes arefull,exprandone. See "Operating Modes". If this is not specified, the default is taken from thesickrcoption..INTERCALC.MODE.--interpreter=moduleβ Uses an alternative CLC-INTERCAL Interpreter; the selected Interpreter must provide methods to access its internal state so that the calculator can display results. The default is whichever compatible Interpreter is considered the best at the time the program is distributed. She picks the bestie for you π
π Misc Options π
-rname,--rcfile=nameβ Executes commands from file name before starting to accept input. This option can be repeated, to execute more than one file. If it is not specified, the standard library, the current directory, and the current user's home directory are searched for files with namesystem.sickrcor.sickrc, which are then executed. The order for this search is: specified library (--include), system library, home directory, current directory. This is different from the search order used when looking for objects or source code. If a directory contains both.sickrcandsystem.sickrc, thesystem.sickrcis executed first, followed by.sickrc. Also note that if the current directory or the home directory appear in the search path and contain one of these files, they will be executed twice.
If filenames are explicitly specified, they must be fully qualified: the search path is not used to find them.
so likeβ¦ yes, twice. we don't make the rules, we just document them π
--nouserrcβ Prevents loading a user rcfile (.sickrc); also limits loading ofsystem.sickrcto the first one found. This option is normally only used when testing the installation, to prevent interference from previous versions of CLC-INTERCAL. stay in your lane, old versions π ββοΈ--nosystemrcβ Prevents loading system rcfiles (usually in/etc/sick) if any exist. This option is normally only used during installation, to prevent interference from previous versions of CLC-INTERCAL.-Rverb,---rcskip=verbβ Makes the program ignore the verb in asickrcfile. selective hearing, but make it a feature β¨
π OPERATING MODES π
The calculator can operate in the following modes:
π full
Fully functional INTERCAL interpreter.
The calculator can parse and execute any statement or expression.
Statements are compiled as a one-statement program, and executed; any register value etc. will be preserved between statements, so entering a list of statements is equivalent to running a program in which all these statements are executed in sequence. She remembers everything, no cap π§
It is important to note that some statements will not execute in the normal manner. For example, a COME FROM will be parsed but have no effect, unless it is something like:
(1) PLEASE COME FROM (1)
which causes the calculator to hang. On the other hand, an ABSTAIN FROM or a REINSTATE will work as expected, as will CREATE and DESTROY. A GIVE UP does not cause the calculator to terminate. One final difference is that comments are not parsed, and therefore you get a "Syntax Error" from the calculator rather than a splat *000 from the INTERCAL interpreter. Different grammar, same chaos π₯
For expressions, the calculator READs OUT the expression's result. Any side effects will be remembered, so if the expression contains overloads they will remain to haunt the calculator. literally haunting the narrative π»
π expr
INTERCAL expression interpreter.
The calculator can only parse expressions or assignments. In either case, the calculated values are READ OUT; assignments will also store the value to the destination, while expressions will then discard the result. no thoughts, just vibes π¦
π oic
The One Instruction Calculator.
This is something we've made up one early morning while discussing desk calculators (as one does). It is not INTERCAL at all, in fact it is inspired from the One Instruction Set Computer.
The calculator has a number of memories (default 100 - these can be changed by appending a number to the operating mode, for example oic10 will use a 10-memory calculator). These memories are identified by the letter m followed by a number; in the default 100-memory version, the first two digits after m are the memory, and any subsequent digit forms part of the next operand. At the start, all memories are initialised to 0.
Since there is only one operation, there is no need to specify it, so an "operation" is a sequence of three operands and a result. The result must be a memory, while each operand can be a number or a memory, with the limitation that consecutive numbers are acceptable only if the parser can determine where one ends and the next one starts. So for example "1-0" is two numeric operands, 1 and -0 (aka 0); "1.2.3" is also two operands, 1.2 and 3; "12" is a single operand, even if you intended it to be two operands, 1 and 2, and even if you put spaces: "1 2" is still interpreted as the single operand 12. she does not care about your intentions π
The operation performed is the difference between the first two operands, divided by the third. For example, the three operations:
7 m01 2 M01
1 m02 1 m02
m1 .5 m2 m03
will produce results m01=3.5 ((7-0)/2); m02=1 ((1-0)/1); m03=3 ((3.5-.5)/1). and will produce the following output if the calculator is running in batch mode:
m01 3.5 (7 - m01) / 2
m02 1 (1 - m02) / 1
m03 3 (m01 - .5) / m02
π SEE ALSO π
The INTERCAL on-line documentation, by running intercalc and finding the "help" menu or key (X and Curses) or backspark escape (Line and None).
okay bestie that's the whole page π this one came out as part of perl v5.40.0 and it's dated 2025-02-09 β go forth and calculate, you absolute icon πβ¨π¦
π¦ where this page comes from
- debian trixie: clc-intercal 1:1.00-3
- ubuntu questing: clc-intercal 1:1.00-3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms