1INTERCALC(1) User Contributed Perl Documentation INTERCALC(1)
2
3
4
6 intercalc - CLC-INTERCAL desk calculator
7
9 intercalc [options]
10
12 intercalc is a simple desk calculator, allowing the user to enter
13 INTERCAL statements (to see what they do) and expressions (to see what
14 value they produce); it uses an interpreter object from CLC-INTERCAL to
15 provide immediate feedback.
16
17 The desk calculator accepts several options, some of which are
18 documented here.
19
20 User Interface Options
21 -X / --graphic
22 Enters X-based graphical user interface. Requires Perl-GTK. This is
23 the default if Perl-GTK is installed, the environment variable
24 $DISPLAY is set and the opening of the X display succeeds.
25
26 -c / --curses
27 Enters full screen, curses-based interface. This is the default if
28 the X based interface cannot be started, the environment variable
29 $TERM is set and the terminal name is known.
30
31 --line
32 Enters the line-mode user interface. This is the default if the X
33 based and the curses based interfaces do not work.
34
35 In this mode, the program executes each line from standard input
36 according to the current mode and language, and prints results to
37 standard output. A line starting with a backspark is interpreted
38 as a command to the calculator. Use backspark-g to GIVE UP (you'll
39 need to do it twice), or backspark-h to display the ehm, help page.
40 Things which are available via menu entries on the Curses and X
41 interfaces are also available via the backspark. For now, you can
42 refer to the source code for a list.
43
44 Command-line editing and command history is provided by the
45 readline library. Command completion works if the underlying
46 compiler supports it (the compilers provided with the distributions
47 do).
48
49 --batch
50 Avoids entering interactive mode. This is the default if the
51 standard input and output are not connected to a terminal and the X
52 based interface cannot be started. This mode is very similar to the
53 line mode except that command-line editing and command history are
54 not implemented. Backspark escapes work just the same.
55
56 -itype / --interface=type
57 Selects the user interface type. Currently, only X, Curses, Line
58 and None are defined, but more can be installed as compiler plug-
59 ins. If the interface selected is None, intercalc will work in
60 batch mode. In addition, an empty string will reinstate the default
61 behaviour.
62
63 Source language and compilation options
64 --bug=number
65 Selects a different probability for the compiler bug. The compiler
66 bug is implemented by initialising the compiler's state with the
67 required probability: when a statement is compiled (usually at
68 runtime), a "BUG" instruction is emitted with the required
69 probability. The default is 1%.
70
71 --ubug=number
72 Selects a probability for the unexplainable compiler bug. This is
73 the compiler bug which occurs when the probability of a
74 (explainable) compiler bug is zero. Only wimps would use this
75 option. The default is 0.01%.
76
77 -Ipath / --include=path
78 Adds a directory before the standard search path for compiler
79 objects and source code. If a file is accessible from the current
80 directory, it is never searched in any include path.
81
82 If this option is repeated, the given paths will be searched in the
83 order given, followed by the standard paths.
84
85 -llanguage / --language=language
86 Selects the language to use when interpreting user input. This
87 should correspond to the name of a compiler, which is an INTERCAL
88 object which was originally built by iacc. Only the expression and
89 statement parsers are used, so it is possible to test incomplete
90 compilers by loading them into intercalc even if they don't work
91 with sick. The default is obtained from the sickrc option
92 .INTERCALC.LANGUAGE.
93
94 --ooption ---option=option
95 Adds a language option. For example, --o3 selects base 3
96 calculation, and --owimp selects wimp mode. If no options are
97 provided, and the default language was taken from the sickrc file,
98 the default options are taken from the sickrc file. Note that if an
99 option or a language is specified on the command line, the sickrc
100 defaults are ignored.
101
102 Unlike previous versions of intercalc, this version checks that the
103 options make sense in the context of the calculator; for example
104 trying to load a compiler as an option will cause an error, but a
105 compiler extension will be OK.
106
107 -mmode / --mode=mode
108 Select operation mode. Currently, the only valid modes are full,
109 expr and one. See "Operating Modes". If this is not specified, the
110 default is taken from the sickrc option ..INTERCALC.MODE.
111
112 Misc Options
113 -rname / --rcfile=name
114 Executes commands from file name before starting to accept input.
115 This option can be repeated, to execute more than one file. If it
116 is not specified, the standard library, the current directory, and
117 the current user's home directory are searched for files with name
118 system.sickrc or .sickrc, which are then executed. The order for
119 this search is: specified library (--include), system library, home
120 directory, current directory. This is different from the search
121 order used when looking for objects or source code. If a directory
122 contains both .sickrc and system.sickrc, the system.sickrc is
123 executed first, followed by .sickrc. Also note that if the current
124 directory or the home directory appear in the search path and
125 contain one of these files, they will be executed twice.
126
127 If filenames are explicitely specified, they must be fully
128 qualified: the search path is not used to find them.
129
130 --nouserrc
131 Prevents loading a user rcfile (.sickrc); also limits loading of
132 system.sickrc to the first one found. This option is normally only
133 used when testing the installation, to prevent interference from
134 previous versions of CLC-INTERCAL.
135
137 The calculator can operate in the following modes:
138
139 full Fully functional INTERCAL interpreter.
140 The calculator can parse and execute any statement or expression.
141
142 Statements are compiled as a one-statement program, and executed;
143 any register value etc. will be preserved between statements, so
144 entering a list of statements is equivalent to running a program
145 in which all these statements are executed in sequence.
146
147 It is important to note that some statements will not execute in
148 the normal manner. For example, a COME FROM will be parsed but
149 have no effect, unless it is something like:
150
151 (1) PLEASE COME FROM (1)
152
153 which causes the calculator to hang. On the other hand, an ABSTAIN
154 FROM or a REINSTATE will work as expected, as will CREATE and
155 DESTROY. A GIVE UP does not cause the calculator to terminate.
156 One final difference is that comments are not parsed, and
157 therefore you get a "Syntax Error" from the calculator rather than
158 a splat *000 from the INTERCAL interpreter.
159
160 For expressions, the calculator READs OUT the expression's result.
161 Any side effects will be remembered, so if the expression contains
162 overloads they will remain to haunt the calculator.
163
164 expr INTERCAL expression interpreter
165 The calculator can only parse expressions or assignments. In
166 either case, the calculated values are READ OUT; assignments will
167 also store the value to the destination, while expressions will
168 then discard the result.
169
170 oic The One Instruction Calculator.
171 This is something we've made up one early morning while discussing
172 desk calculators (as one does). It is not INTERCAL at all, in
173 fact it is inspired from the One Instruction Set Computer.
174
175 The calculator has a number of memories (default 100 - these can
176 be changed by appending a number to the operating mode, for
177 example oic10 will use a 10-memory calculator). These memories are
178 identified by the letter m followed by a number; in the default
179 100-memory version, the first two digits after m are the memory,
180 and any subsequent digit forms part of the next operand. At the
181 start, all memories are initialised to 0.
182
183 Since there is only one operation, there is no need to specify it,
184 so an "operation" is a sequence of three operands and a result.
185 The result must be a memory, while each operand can be a number or
186 a memory, with the limitation that consecutive numbers are
187 acceptable only if the parser can determine where one ends and the
188 next one starts. So for example "1-0" is two numeric operands, 1
189 and -0 (aka 0); "1.2.3" is also two operands, 1.2 and 3; "12" is a
190 single operand, even if you intended it to be two operands, 1 and
191 2, and even if you put spaces: "1 2" is still interpreted as the
192 single operand 12.
193
194 The operation performed is the difference between the first two
195 operands, divided by the third. For example, the three operations:
196
197 7 m01 2 M01
198 1 m02 1 m02
199 m1 .5 m2 m03
200
201 will produce results m01=3.5 ((7-0)/2); m02=1 ((1-0)/1); m03=3
202 ((3.5-.5)/1). and will produce the following output if the
203 calculator is running in batch mode:
204
205 m01 3.5 (7 - m01) / 2
206 m02 1 (1 - m02) / 1
207 m03 3 (m01 - .5) / m02
208
210 The INTERCAL on-line documentation, by running intercalc and finding
211 the "help" menu or key (X and Curses) or backspark escape (Line and
212 None).
213
214
215
216perl v5.12.0 2010-05-28 INTERCALC(1)