- C-INTERCAL (v 0.3)
+ C-INTERCAL (v 0.5)
NOTE! THIS IS A PRE-RELEASE VERSION WITH SOME KNOWN BUGS!
SEE THE `BUGS' FILE FOR DETAILS, AND EARN THE ETERNAL GRATITUDE
unsigned int popnext(n)
int n;
{
- while (n--)
- if (nextindex > 0)
- nextindex--;
- return(nextindex ? next[nextindex - 1] : -1);
+ nextindex -= n;
+ if (nextindex < 0) {
+ nextindex = 0;
+ return(-1);
+ }
+ return(next[nextindex]);
}
unsigned int resume(n)
if (fgets(buf, BUFSIZ, stdin) == (char *)NULL)
lose(lineno, E562);
+ buf[strlen(buf)-1] = '\0';
cp = strtok(buf, " ");
do {
} while
(cp = strtok((char *)NULL, " "));
- if (width = 16 && result > 0xffff)
+ if (width == 16 && result > 0xffff)
lose(lineno, E579);
+ return(result);
}
/**********************************************************************
{
char result[2*MAXROMANS+1];
- butchar(val, result);
+ butcher(val, result);
(void) puts(result);
}
void stashinit()
{
- memset(stashes, sizeof(stashes));
+ memset(stashes, '\0', sizeof(stashes));
}
static stashbox *fetch(type, index)
np->opcode = type;
np->lval = car;
np->rval = cdr;
+
+ return(np);
}
/*************************************************************************
}
/* fold XOR operations on constants */
- if (np->opcode == AND && np->rval->opcode == MESH)
+ if (np->opcode == XOR && np->rval->opcode == MESH)
{
np->opcode = MESH;
np->constant = xor16(np->lval->constant, np->rval->constant);
break;
case XOR:
- (void) fprintf(fp, "or%d(", np->width);
+ (void) fprintf(fp, "xor%d(", np->width);
prexpr(np->rval, fp);
(void) fprintf(fp, ")");
break;
if (tn->exechance && tn->exechance < 100)
(void) fprintf(fp, "roll(%d) && ", tn->exechance);
if (tn->type == GIVE_UP)
- (void) fprintf(fp, "!abstained[lineno = %d])\n", tn - tuples + 1);
+ (void) fprintf(fp, "!abstained[(lineno = %d)-1])\n", tn - tuples + 1);
else
- (void) fprintf(fp, "!abstained[lineno = %d] && %s)\n",
+ (void) fprintf(fp, "!abstained[(lineno = %d)-1] && %s)\n",
tn-tuples + 1, enablers[tn->type-GETS]);
(void) fprintf(fp, " {\n");
if (tn->comefrom)
(void) fprintf(fp,
- "\tif (!abstained[%d] && comingfrom)\t/* COME FROM */\n\t goto C%d;\n",
+ "\tif (!abstained[%d-1] && comingfrom)\t/* COME FROM */\n\t goto C%d;\n",
tn->comefrom, tn->comefrom);
/* now emit the code for the statement body */
(void) fprintf(fp,"\tif (!%s[%d])\n\t ",
nameof(np->lval->opcode, forgetbits),
np->constant);
- if (np->opcode == ONESPOT || np->opcode == TWOSPOT)
+ if (np->lval->opcode == ONESPOT || np->lval->opcode == TWOSPOT)
{
prvar(np->lval, fp);
(void) fprintf(fp, " = ");
}
else
{
- (void) fprintf("aput(");
+ (void) fprintf(fp, "aput(");
prexpr(tn->u.node->rval, fp);
- (void) fprintf(", ");
+ (void) fprintf(fp, ", ");
prvar(np->lval, fp);
(void) fprintf(fp, ")");
}
break;
case ABSTAIN:
- (void) fprintf(fp, "\tabstained[%d] = FALSE;\n", tn->u.target);
+ (void) fprintf(fp, "\tabstained[%d-1] = FALSE;\n", tn->u.target);
break;
case REINSTATE:
- (void) fprintf(fp, "\tabstained[%d] = TRUE;\n", tn->u.target);
+ (void) fprintf(fp, "\tabstained[%d-1] = TRUE;\n", tn->u.target);
break;
case ENABLE:
(void) fprintf(fp,"\tif (!%s[%d])\n\t ",
nameof(np->lval->opcode, forgetbits),
np->constant);
- if (np->opcode == ONESPOT || np->opcode == TWOSPOT)
+ if (np->lval->opcode == ONESPOT || np->lval->opcode == TWOSPOT)
{
prvar(np->lval, fp);
(void) fprintf(fp, " = pin()");
}
else
{
- (void) fprintf("aput(pin(), ");
+ (void) fprintf(fp, "aput(pin(), ");
prvar(np->lval, fp);
(void) fprintf(fp, ")");
}
case SPLATTERED:
(void) fprintf(fp,
- "(void) puts(\"%s\");\n", textlines[tn - tuples]);
+ "(void) puts(\"%s\");\n", textlines[tn->lineno]);
(void) fprintf(fp,
- "exit(%d);\n", tn - tuples);
+ "exit(%d);\n", tn->lineno);
break;
default:
* deducible type of the operand.
*/
for (tp = tuples; tp < tuples + lineno; tp++)
- if (tp->type == GETS || tp->type == RESIZE)
+ if (tp->type == GETS || tp->type == RESIZE
+ || tp->type == FORGET || tp->type == RESUME)
typecast(tp->u.node);
codecheck(); /* check for compile-time errors */
/* perform optimizations */
if (dooptimize)
for (tp = tuples; tp < tuples + lineno; tp++)
- if (tp->type == GETS || tp->type == RESIZE)
+ if (tp->type == GETS || tp->type == RESIZE
+ || tp->type == FORGET || tp->type == RESUME)
optimize(tp->u.node);
/* strip off the file extension */
for (i = 0; i < 32; i++)
if (BIT(i, s))
- result |= ((1 << n++) & r);
+ result |= BIT(i,r) << n++;
return(result);
}
unsigned int target; /* for NEXT statements */
node *node; /* attached expression node(s) */
} u;
+ int lineno; /*For splatters*/
} tuple;
/* the lexical analyzer keeps copies of the source logical lines */
static node *rlist; /* pointer to current right-hand node list */
static node *llist; /* pointer to current left-hand node list */
static node *np; /* variable for building node lists */
+static int whichline = 1;
#define ACTION(x, nt, nn) x = newtuple(); x->type = nt; x->u.node = nn
#define TARGET(x, nt, nn) x = newtuple(); x->type = nt; x->u.target = nn
/* A program description consists of a sequence of statements */
program : /* EMPTY */
| program statemnt NEWLINE
+ {
+ whichline++;
+ }
;
statemnt: command
perform : lvalue GETS expr {ACTION($$, GETS,cons(GETS,$1,$3));}
| array GETS byexpr {ACTION($$,RESIZE,cons(RESIZE,$1,$3));}
| LABEL NEXT {TARGET($$, NEXT, $1);}
- | FORGET expr {ACTION($$, RESUME, $2);}
+ | FORGET expr {ACTION($$, FORGET, $2);}
| RESUME expr {ACTION($$, RESUME, $2);}
| STASH varlist {ACTION($$, STASH, rlist);}
| RETRIEVE varlist {ACTION($$, RETRIEVE, rlist);}
inspired by one ambition; to have a compiler language which has nothing at
all in common with any other major language. By 'major' was meant anything
with which the authors were at all familiar, e.g., FORTRAN, BASIC, COBOL,
-ALGOL, SNOBOL, SPITBOL, FOCAL, SOLVE, TEACH, APL, LISP, and PI/I. For the
+ALGOL, SNOBOL, SPITBOL, FOCAL, SOLVE, TEACH, APL, LISP, and PL/I. For the
most part, INTERCAL has remained true to this goal, sharing only the basic
elements such as variables, arrays, and the ability to do I/O, and eschewing
all conventional operations other than the assignment statement (FORTRAN
initiate a novice into a search for another line of work. As it turns out,
INTERCAL is more useful (which isn't saying much) as a challenge to
professional programmers. Those who doubt this need only refer back to the
-sample program in section 2.1. This 23-statement program took somewhere
+sample program in section 2.1. This 22-statement program took somewhere
from 15 to 30 minutes to write, whereas the same objectives can be achieved
by single-statement programs in either SNOBOL;
managers, winning friends, and influencing people. It is a well-known and
oft-demonstrated fact that a person whose work is incomprehensible is held
in high esteem. For example, if one were to state that the simplest way to
-store a value of 65535 in a 32-bit INTERCAL variable is:
+store a value of 65536 in a 32-bit INTERCAL variable is:
- DO :1 <- #0?#256
+ DO :1 <- #0$#256
any sensible programmer would say that that was absurd. Since this is
indeed the simplest method, the programmer would be made to look foolish in
#65535.
The select operator takes from the first operand whichever bits correspond
-to 1's in the second operand, and packs these bits as the right in the result.
+to 1's in the second operand, and packs these bits to the right in the result.
Both operands are automatically padded on the left with zeros to 32 bits
before the selection takes place, so the variable types are unrestricted.
If more than 16 bits are selected, the result is a 32-bit value, otherwise
values: low, high, undefined (value of an uninitialized flip-flop), and
oscillating (output of a NOR gate with one input low and the other input
connected to the output). These values are represented symbolically by '0',
-'1', '2', and 'F'. Note in particular that, while NOT-0 is 1 and NOT-2
+'1', '?', and 'F'. Note in particular that, while NOT-0 is 1 and NOT-1
is 0 as in two-valued logic, NOT-? is ? and NOT-F is F. The functions
-of the various gates are listed on Table 1.
+of the various gates are listed in Table 1.
\f
The effect is that of rotating the operand one place to the right and
ANDing, ORing, or XORing with its initial value. Thus, #&77 (binary =
1001101) is binary 0000000000000100 = 4, #V77 is binary 1000000001101111 =
-32879, and #V77 is binary 1000000001101011 = 32875.
+32879, and #?77 is binary 1000000001101011 = 32875.
3.4.3 PRECEDENCE
a spark-spot combination ('.) to be replaced with a wow (!). Thus '.1~.2'
is equivalent to !1~.2', and 'V.1c.2' is equivalent to "V!1c.2'".
-Combining a rabbit-ears with a spot to form a rabbit (V) is not permitted,
+Combining a rabbit-ears with a spot to form a rabbit ("\b.) is not permitted,
although the programmer is free to use it should he find an EBCDIC reader
which will properly translate a 12-3-7-8 punch.
The above statements are obviously meaningless. (For that matter, so are
the statements
- DO .1 <- ".1c\b/"&:51~"#V1C\b!12~;&75SUB"V'V.1~
+ DO .1 <- ".1c\b/"&:51~"#V1c!12~;&75SUB"V'V.1~
.2'C,&1SUB:5~/333578"'"'"~#65535c\b/"V'V#&85'"'
DO .2 <- '"!1c\b/"&';V79SUB",&7SUB:173"'~!V9c
#8196'"'~.1"c.2'~'#&5c\b/"'#1279c!4351'~#65535"'
The program listing begins on the second page following. It is in the same
format as would be produced by the Princeton INTERCAL compiler in FORMAT
-mode with WDITH=62 (see section 8). For a description of the functions
+mode with WIDTH=62 (see section 8). For a description of the functions
performed by the Library, see section 5.2.
6.2 Analysis
depending on whether .5 contains #1 or #2, respectively. The value of .5
is determined in statement 9, which demonstrates another handy technique.
To turn an expression, exp, with value #0 or #1, into #1 or #2 (for use in
-a "GO TO"), use "V'exp'c\b/#1"~#3. To reverse the condition (i.e., convert #0
-to #2 and leave #1 alone) use "V'exp'c\b/#2"~#3.
+a "GO TO"), use "V\b-'exp'c\b/#1"~#3. To reverse the condition (i.e., convert #0
+to #2 and leave #1 alone) use "V\b-'exp'c\b/#2"~#3.
Certain conditions are easily checked. For example, to test for zero,
select the value from itself and select the bottom bit (see statement 54).
To test for all bits being 1's, select the value from itself and select the
-top bit (see statement 261). The test to greater than, performed in
+top bit (see statement 261). The test for greater than, performed in
statements 192 and 193 on 32-bit values, employs binary logical operations,
which are performed as follows:
| ' spark grouper |
| ` backspark |
| ! wow equivalent to spark-spot |
-| ? what unary exlusive OR (ATARI only)|
+| ? what unary exlusive OR (ASCII) |
| " rabbit-ears grouper |
-| !` rabbit equivalent to ears-spot |
+| "\b. rabbit equivalent to ears-spot |
| | spike |
| % double-oh-seven percentage qualifier |
| - worm used with angles |
| (or book) |
| V\b- bookworm unary exclusive OR |
| (or universal qualifier) |
-| $ big money |
+| $ big money unary exclusive OR (ASCII) | |
| c\b| change binary mingle |
| ~ sqiggle binary select |
| _ flat worm |
and the correct over-punch for V is "V<backspace>-". These codes will be
properly printed if you have a proper printer, and the corresponding EBCDIC
code will be produced by the /IBM option on the LIST command.
-
% This is the file ick.sty: macros for typesetting the INTERCAL Manual.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% TO DO
+%
+
+% Document this thing.
+
+% Make ASCII->EBCDIC translation settable by a switch.
+
+% Is this how the rabbit is really supposed to look?
+
+% ``lines 192 and 193'' is wrong
+
+% ICverbatim environment
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% PAGE SIZE
+%
+
\setlength{\textwidth}{6.5in}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\headsep}{0in}
\setlength{\headheight}{0in}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% TONSILS
+%
+
+\def\tonsil#1#2{\section*{Tonsil #1: #2}%
+ \addtonsilline{#1}{#2}}
+
+\def\addtonsilline#1#2{\addcontentsline{toc}{section}{\protect\numberline{#1}#2}}
+
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SPECIAL INTERCAL CHARACTERS
%
% \def\bookworm{\mathify{\forall}}
\def\bookworm{\rlap V-}
\def\change{\rlap c/}
+\def\Change{\change}
%\def\altchange{\rlap /c}
\def\zero{\={}}
\def\spike{\verb+|+}
\def\althookworm{-\llap '}
\def\hookworm{'\llap -}
\def\blotch{\#\llap I\llap [\llap ]}
+\def\blotCh{\blotch}
+\def\rabbit{\rlap".}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Just surround the code with vertical bars.
-
\catcode`|=\active % The `|' is active from now on.
\def|{\ifmmode\vert%
\else\bgroup\tt\usespecials\def|{\null\egroup}%
\fi}
+% True if $ and c should become \change, and ? should become \bookworm
+\newif\ifasciitoebcdic
+
+\def\activateebcdicspecials{%
+ \catcode`$=\active
+ \catcode`?=\active
+ \catcode`c=\active}
+
+% I think these need to be global
+\def\Change{\change}
+\def\ativateebdispeials{\activateebcdicspecials}
+{% Now blow away the lowercase c.
+ \activateebcdicspecials
+ \gdef\useebdispeials{%
+ \def${\Change}%
+ \defc{\Change}%
+ \def?{\bookworm}%
+ \ativateebdispeials}}
+
+\def\useebcdicspecials{\useebdispeials}
+\def\useebcdicspecialsmaybe{\ifasciitoebcdic\useebcdicspecials\fi}
+
+
% To get backslat, embrace, or bracelet in a | | environment, use the
% respective macros.
-% I might want to translate $ and ? as in the verbatim macros.
\def\activatespecials{%
\catcode`\%=\active
\catcode`\&=\active
\def${\bigmoney}+
\def^{\shark}+
\def_{\flatworm}+
- \def#{\mesh}}}
+ \def#{\mesh}+
+ \useebcdicspecialsmaybe}}
+
% Typeset a one-line INTERCAL example. This is pretty gross.
\def\IConeline#1{\vspace\topsep\par\noindent{\tt\ \ \ \ \ \ \ \ }#1\vspace\topsep}
% --- alien@uk.ac.essex.ese
% --- ---and further latexification by Chris Rowley,
% --- ca_rowley@uk.ac.open.acs.vax.
-% And finally, modified for INTERCAL by Michael Ernst.
+% And finally, ever-so-slightly modified for INTERCAL by Michael Ernst.
\def\verbatimfile#1{\begingroup
\@verbatim \frenchspacing \@vobeyspaces
% better to make \, clobbered by \@verbatim, the escape character again,
% and then define a whole wad of escape sequences, with \^^M being one.
-\newif\ifnonumber
+\newif\ifnonumber % True if the next line shouldn't be numbered.
-\def\activateverbspecials{%
- \catcode`$=\active
- \catcode`?=\active}
+%\def\activateverbspecials{%
+% \catcode`$=\active
+% \catcode`?=\active}
-{\activateverbspecials
+{%\activateverbspecials
\catcode`|=0
\catcode`\\=\active
|gdef|useverbspecials{%
|def\{|nonumbertrue}%
- |def${|change}%
- |def?{|bookworm}%
- |activateverbspecials}}
+ |useebcdicspecialsmaybe}}
+% |def${|change}%
+% |def?{|bookworm}%
+% |activateverbspecials}}
\def\ICverbatimlisting#1{\setcounter{lineno}{0}%
\begingroup \@verbatim \frenchspacing \@vobeyspaces \parindent=20pt
\input#1
\endgroup
}
-
% -*- Mode: TeX -*-
% for LaTeX
-\documentstyle[ick]{article}
+\documentstyle[intercal]{article}
\title{ The INTERCAL Programming Language \\
Reference Manual}
\author{ Donald R. Woods \& James M. Lyon}
\date{ Copyright Donald R. Woods \& James M. Lyon 1973}
+% Online version provided by Ken Johnson (ken@aiai.ed.ac.uk)
+% Corrected and typeset by Michael Ernst (mernst@theory.lcs.mit.edu), with
+% help from the global INTERCAL community.
+% Please send corrections to Michael Ernst (mernst@theory.lcs.mit.edu).
+% If you don't have TeX, and so can't format this manual, I will send you
+% the postscript version. If you have neither TeX nor Postscript, I'm
+% afraid I can't help you.
+
+% sample.i and syslib.i use the continuation character convention
+\continuationchartrue
+% Convert c,$ => \change and ? => \bookworm
+\asciitoebcdictrue
+
+
\begin{document}
\maketitle
by Donald R. Woods and James M. Lyon, at Princeton University. Exactly
when in the morning will become apparent in the course of this manual. It
was inspired by one ambition; to have a compiler language which has nothing
-at all in common with any other major language. By 'major' was meant
+at all in common with any other major language. By ``major'' was meant
anything with which the authors were at all familiar, e.g., FORTRAN, BASIC,
-COBOL, ALGOL, SNOBOL, SPITBOL, FOCAL, SOLVE, TEACH, APL, LISP, and PI/I.
+COBOL, ALGOL, SNOBOL, SPITBOL, FOCAL, SOLVE, TEACH, APL, LISP, and PL/I.
For the most part, INTERCAL has remained true to this goal, sharing only
the basic elements such as variables, arrays, and the ability to do I/O,
and eschewing all conventional operations other than the assignment
\subsection{Acronym}
The full name of the compiler is ``Compiler Language With No Pronounceable
-Acronym'', which is, for obvious reasons, abbreviated ``INTERCAL''.
+Acronym,'' which is, for obvious reasons, abbreviated ``INTERCAL.''
\subsection{Acknowledgments}
A more detailed analysis of a program is made in section 6 of this manual.
-\continuationchartrue % sample.i uses the continuation character convention
\ICverbatimlisting{sample.i}
initiate a novice into a search for another line of work. As it turns out,
INTERCAL is more useful (which isn't saying much) as a challenge to
professional programmers. Those who doubt this need only refer back to the
-sample program in section 2.1. This 23-statement program took somewhere
+sample program in section 2.1. This 22-statement program took somewhere
from 15 to 30 minutes to write, whereas the same objectives can be achieved
by single-statement programs in either SNOBOL;
managers, winning friends, and influencing people. It is a well-known and
oft-demonstrated fact that a person whose work is incomprehensible is held
in high esteem. For example, if one were to state that the simplest way to
-store a value of 65535 in a 32-bit INTERCAL variable is:
+store a value of 65536 in a 32-bit INTERCAL variable is:
\begin{verbatim}
- DO :1 <- #0?#256
+ DO :1 <- #0$#256
\end{verbatim}
any sensible programmer would say that that was absurd. Since this is
indeed the simplest method, the programmer would be made to look foolish in
These variables may contain only non-negative numbers; thus they have the
respective ranges of values: 0 to 65535 and 0 to 4294967295. Note: |.123|
and |:123| are two distinct variables. On the other hand, |.1| and |.0001|
-are identical. Furthermore, the latter may NOT be written as |1E-3|.
+are identical. Furthermore, the latter may {\em not} be written as |1E-3|.
\subsection{Constants}
\subsubsection{Binary Operators}
-The binary operators are INTERLEAVE (also called MINGLE) and SELECT, which
-are represented by a change (|\change|) and a sqiggle (|~|), respectively.
+The binary operators are {\sl interleave} (also called {\sl mingle}) and
+{\sl select}, which are represented by a change (|$|) and a sqiggle
+(|~|), respectively.
The interleave operator takes two 16-bit values and produces a 32-bit
result by alternating the bits of the operands. Thus, |#65535c#0| has the
|#65535|.
The select operator takes from the first operand whichever bits correspond
-to 1's in the second operand, and packs these bits as the right in the
+to 1's in the second operand, and packs these bits to the right in the
result. Both operands are automatically padded on the left with zeros to
32 bits before the selection takes place, so the variable types are
unrestricted. If more than 16 bits are selected, the result is a 32-bit
invalid. This will be covered later when precedence is discussed. These
operators perform their respective logical operations on all pairs of
adjacent bits, the result from the first and last bits going into the first
-bit of the result. The effect is that of rotating the operand one place to
-the right and ANDing, ORing, or XORing with its initial value. Thus,
-|#&77| (binary = 1001101) is binary 0000000000000100 = 4, |#V77| is binary
-1000000001101111 = 32879, and |#V77| is binary 1000000001101011 = 32875.
-\typeout{typo here}
+(most significant) bit of the result. The effect is that of rotating the
+operand one place to the right and ANDing, ORing, or XORing with its
+initial value. Thus, |#&77| (|#77| = binary 1001101) is binary 0000000000000100
+= 4, |#V77| is binary 1000000001101111 = 32879, and |#?77| is binary
+1000000001101011 = 32875.
\subsubsection{Precedence}
-Precedence of operators is as follows:
-
-
-\vspace{2 in}
-\hspace{4 in}
-\footnote{Keep in mind that the aim in designing INTERCAL was to have no
+Precedence of operators is as follows:\footnote{Keep in mind that the aim in designing INTERCAL was to have no
precedents.}
\stepcounter{footnote}
-\vspace{1 in}
-(The remainder of this page intentionally left blank.)
+% \vspace{2 in}
+% \hspace{4 in}
+% \footnote{Keep in mind that the aim in designing INTERCAL was to have no
+% precedents.}
+% \stepcounter{footnote}
+% \vspace{1 in}
+% (The remainder of this page intentionally left blank.)
+
+\vfill
+(The remainder of this page intentionally left blank.)
\newpage
-
+%% This manual only strictly checked up to (but not including) the 34815.
This precedence (or lack thereof) may be overruled by grouping expressions
between pairs of sparks (|'|) or rabbit-ears (|"|). Thus
sometimes overly-complex form of expressions, INTERCAL allows a spark-spot
combination (|'.|) to be replaced with a wow (|!|). Thus |'.1~.2'| is
equivalent to |!1~.2'|, and |'V.1c.2'| is equivalent to |"V!1c.2'"|.
+%\typeout{Note that unary ops must go INSIDE delimiters!}
-Combining a rabbit-ears with a spot to form a rabbit (|V|\typeout{Rabbit?})
+Combining a rabbit-ears with a spot to form a rabbit (|\rabbit|)
is not permitted, although the programmer is free to use it should he find
an EBCDIC reader which will properly translate a 12-3-7-8 punch.
the statements
\begin{verbatim}
- DO .1 <- ".1c"&:51~"#V1C\b!12~;&75SUB"V'V.1~
+ DO .1 <- ".1c"&:51~"#V1c!12~;&75SUB"V'V.1~
.2'C,&1SUB:5~/333578"'"'"~#65535c"V'V#&85'"'
DO .2 <- '"!1c"&';V79SUB",&7SUB:173"'~!V9c
#8196'"'~.1"c.2'~'#&5c"'#1279c!4351'~#65535"'
\subsection{Labels}
-A statement may begin with a LOGICAL LINE LABEL enclosed in wax-wane pairs
+A statement may begin with a {\sl logical line label} enclosed in wax-wane pairs
(|()|). A statement may not have more than one label, although it is
possible to omit the label entirely. A line label is any integer from 1 to
65535, which must be unique within each program. The user is cautioned,
|DO READ OUT| {\em list}, where the list contains variables, array
elements, and/or constants. Output is in the form of ``extended'' Roman
numerals (also called ``butchered'' Roman numerals), with an overline
-(\zero) indicating the value below is ``times 1000'', and lower-case
-letters indicating ``times 1000000''. Zero is indicated by an overline
+(\zero) indicating the value below is ``times 1000,'' and lower-case
+letters indicating ``times 1000000.'' Zero is indicated by an overline
with no character underneath. Thus, the range of (32-bit) output values
possible is from \zero\ through \=i\=vccxciv\=C\=M\=L\=X\=V\=I\=ICCXCV.
Note: For values whose residues modulo 1000000 are less than 4000, M is
is used. Thus |#3999| would read out as MMMIM while |#4000| would read out
as \=I\=V. Similar rules apply to the use of \=M and i for 1000000, and to
that of \=m and \=i for 1000000000.
-\typeout{Do they really mean MMMIM and not MMMCMXCIX??}
+
+% \typeout{Do they mean MMMIM and not MMMCMXCIX??}
\f
The program listing begins on the second page following. It is in the same
format as would be produced by the Princeton INTERCAL compiler in FORMAT
-mode with WDITH=62 (see section 8). For a description of the functions
+mode with WIDTH=62 (see section 8). For a description of the functions
performed by the Library, see section 5.2.
\subsection{Analysis}
shall point out some of the general techniques applicable to a wide range
of problems.
-Statements 10, 14, 15, and 26 make up a virtual ``computed |GO TO|''. When
+Statements 10, 14, 15, and 26 make up a virtual ``computed |GO TO|.'' When
statement 10 is executed, control passes eventually to statement 16 or 11,
depending on whether |.5| contains |#1| or |#2|, respectively. The value
of |.5| is determined in statement 9, which demonstrates another handy
technique. To turn an expression, {\em exp}, with value |#0| or |#1|, into
-|#1| or |#2| (for use in a ``|GO TO|''), use |"V'{\em exp}'c#1"~#3|. To
+|#1| or |#2| (for use in a ``|GO TO|''), use |"?'{\em exp}'c#1"~#3|. To
reverse the condition (i.e., convert |#0| to |#2| and leave |#1| alone) use
-|"V'{\em exp}'c#2"~#3|.
+|"?'{\em exp}'c#2"~#3|.
Certain conditions are easily checked. For example, to test for zero,
select the value from itself and select the bottom bit (see statement 54).
To test for all bits being 1's, select the value from itself and select the
-top bit (see statement 261). The test to greater than, performed in
+top bit (see statement 261). The test for greater than, performed in
statements 192 and 193 on 32-bit values, employs binary logical operations,
which are performed as follows:
\f
\subsection{Program Listing}
-\continuationchartrue % syslib.i uses the continuation character convention
+% Thanks to David Moews (moews@math.berkeley.edu) for help debugging this.
+% There is still much to be done!
\ICverbatimlisting{syslib.i}
-\typeout{Where's line 1551? 1900? 1910?}
+%\typeout{Where's line 1551? 1900? 1910?}
\f
\ttitem{436} A retrieval has been attempted for an un|STASH|ed value.
-\ttitem{533} A |WRITE IN| statement or interleave (|\change|) operation has
+\ttitem{533} A |WRITE IN| statement or interleave (|$|) operation has
produced a value requiring over 32 bits to represent.
\ttitem{562} Insufficient data.
\section*{Tonsil\footnote{Since all other reference manuals
have Appendices, it was decided that the INTERCAL manual should contain
some other type of removable organ.} A: The Official INTERCAL Character Set}
-
-
-
-
-
-
-Tabulated on page 18 are all the characters used in INTERCAL, excepting
-letters and digits, along with their names and interpretations. Also
-included are several characters not used in INTERCAL, which are presented
-for completeness and to allow for future expansion.
+\addtonsilline{A}{The Official INTERCAL Character Set}
+%\addcontentsline{toc}{section}{\protect\numberline{A}The Official INTERCAL Character Set}
+
+Tabulated on page~\pageref{Tonsil-A-table} are all the characters used in
+INTERCAL, excepting letters and digits, along with their names and
+interpretations. Also included are several characters not used in
+INTERCAL, which are presented for completeness and to allow for future
+expansion.
\stepcounter{footnote}
\footnotetext{This footnote intentionally unreferenced.}
{\catcode`.=\active \catcode`|=12 % Use . instead of | for code mode
\def.{\bgroup\tt\usespecials\def.{\null\egroup}}
\begin{table}
-\begin{minipage}{\textwidth} % so the footnote works out.
+\label{Tonsil-A-table}
+\begin{minipage}{\textwidth} % use a minipage so the footnote works
\begin{tabular}{|r|l|p{3in}|}
\hline
Character & Name & Use (if any) \\
.!. & wow & equivalent to spark-spot \\
\verb|?|& what & unary exlusive OR (ASCII) \\
.". & rabbit-ears & grouper \\
-{\verb|!`|}& rabbit & equivalent to ears-spot \\
+.\rabbit.& rabbit & equivalent to ears-spot \\
{\verb+|+}& spike & \\
.\%. & double-oh-seven & percentage qualifier \\
.-. & worm & used with angles \\
.V. & V (or book) & unary logical OR \\
.\bookworm. & bookworm (or universal qualifier) & unary exclusive OR \\
.\$. & big money & binary mingle (ASCII) \\
-.\change.& change & binary mingle \\
+.\Change.& change & binary mingle \\
.\~{}. & sqiggle & binary select \\
.\_. & flat worm & \\
.\zero. & overline & indicates ``times 1000'' \\
.@. & whirlpool & \\
.\hookworm.& hookworm & \\
{\verb|^|}& shark (or simply sharkfin) & \\
-.\blotch.& blotch \\
+.\blotCh.& blotch \\
\hline
\end{tabular}
\catcode`.=12
\caption{ INTERCAL character set (top view).}
-\typeout{What does Rabbit really look like?}
\def\thempfootnote{\arabic{mpfootnote}}
\footnotetext[\thefootnote]{Got any better ideas?}
\label{character-set}
}
\f
-\section*{Tonsil B:
-Notes On The Atari Implementation}
+\tonsil{B}{Notes On The Atari Implementation}
+% \section*{Tonsil B:
+% Notes On The Atari Implementation}
+% \addtonsilline{B}{Notes On The Atari Implementation}
+%\addcontentsline{toc}{section}{\protect\numberline{B}{Notes On The Atari Implementation}}
The Atari implementation of INTERCAL differs from the original Princeton
version primarily in the use of ASCII rather than EBCDIC. Since there is
-no ``change'' sign (|\change|) in ASCII, we have substituted the ``big
-money'' (|$|) as the mingle operator. We feel that this correctly
-represents the increasing cost of software in relation to hardware.
-(Consider that in 1970 one could get RUNOFF for free, to run on a \$20K
-machine, whereas today a not quite as powerful formatter costs \$99 and
-runs on a \$75 machine.) We also feel that there should be no defensible
-contention that INTERCAL has any sense. Also, since overpunches are
-difficult to read on the average VDT, the exclusive-or operator may be
-written ?. This correctly expresses the average person's reaction on first
-encountering exclusive-or, especially on a PDP-11. Note that in both of
-these cases, the over-punched symbol may also be used if one is
+no ``change'' sign ({\tt\change}) in ASCII, we have substituted the ``big
+money'' ({\tt\bigmoney}) as the mingle operator. We feel that this
+correctly represents the increasing cost of software in relation to
+hardware. (Consider that in 1970 one could get RUNOFF for free, to run on
+a \$20K machine, whereas today a not quite as powerful formatter costs \$99
+and runs on a \$75 machine.) We also feel that there should be no
+defensible contention that INTERCAL has any sense. Also, since overpunches
+are difficult to read on the average VDT, the exclusive-or operator may be
+written {\tt ?}. This correctly expresses the average person's reaction on
+first encountering exclusive-or, especially on a PDP-11. Note that in both
+of these cases, the over-punched symbol may also be used if one is
masochistic, or concerned with portability to the Princeton compiler. The
correct over-punch for ``change'' is ``c{\sc
$\langle$backspace$\rangle$}/'' and the correct over-punch for |\bookworm|
will be produced by the |/IBM| option on the |LIST| command.
\end{document}
-
(1) PLEASE DO (2) NEXT
PLEASE FORGET #1
DO READ OUT :1
- PLEASE DO .1 <- 'V"':1~:1'~#1"$#1'~#3
+ PLEASE DO .1 <- '?"':1~:1'~#1"$#1'~#3
DO (3) NEXT
PLEASE DO (5) NEXT
(3) DO (2) NEXT