-
Notifications
You must be signed in to change notification settings - Fork 1
/
ici.html
9878 lines (9847 loc) · 350 KB
/
ici.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML EXPERIMENTAL 970324//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="Adobe FrameMaker 5.5/HTML Export Filter">
<LINK REL="STYLESHEET" HREF="ici.css">
<TITLE> ICI Technical Description</TITLE></HEAD>
<BODY BGCOLOR="#ffffff">
<P CLASS="Body">
<A NAME="pgfId=184947">
</A> </P>
<DIV>
<H1 CLASS="Title">
<A NAME="pgfId=197492">
</A>ICI Technical Description</H1>
<DIV>
<H2 CLASS="Sub-title">
<A NAME="pgfId=184912">
</A>Version 1.2</H2>
</DIV>
<DIV>
<H2 CLASS="Sub-title">
<A NAME="pgfId=184948">
</A>Tim Long</H2>
<P CLASS="Legals">
<A NAME="pgfId=188317">
</A>© 1992-2000 Tim Long</P>
<P CLASS="Legals">
<A NAME="pgfId=184725">
</A>Regular expression portions © 1997-1999 University of Cambridge</P>
<P CLASS="Legals">
<A NAME="pgfId=184727">
</A>Permission granted to reproduce provided copyright notices are preserved.</P>
<P CLASS="Legals">
<A NAME="pgfId=225509">
</A> </P>
<DIV>
<H3 CLASS="Heading1">
<A NAME="pgfId=225510">
</A>Introduction</H3>
<P CLASS="Body">
<A NAME="pgfId=245249">
</A>ICI is a general purpose interpretive programming language that has dynamic typing and flexible data types with the basic syntax, flow control constructs and operators of C. It is designed for use in many environments, including embedded systems, as an adjunct to other programs, as a text-based interface to compiled libraries, and as a cross-platform scripting language with good string-handling capabilities.</P>
<P CLASS="Body">
<A NAME="pgfId=245282">
</A>The ICI language and source is not copyright in any way.</P>
<P CLASS="Body">
<A NAME="pgfId=245291">
</A>This document is the basic reference for the core language and functions. There is also an extensive man page that includes details command line invocation not described here. Additional documentation is provided in ICI source releases. The ICI web site is <A HREF="http.html#//www.zeta.org.au/~atrn/ici/" CLASS="Hypertext">
http://www.zeta.org.au/~atrn/ici/</A></P>
</DIV>
<DIV>
<H3 CLASS="Heading1">
<A NAME="pgfId=245292">
</A>Basics</H3>
<P CLASS="Body">
<A NAME="pgfId=225511">
</A>The ICI interpreter's execution engine calls on the parser to read and compile a statement from an input stream. The parser in turns calls on the lexical analyser to read tokens. Upon return from the parser the execution engine executes the compiled statement. When the statement has finished execution, the execution engine repeats the sequence.</P>
<DIV>
<H4 CLASS="Heading2">
<A NAME="pgfId=175533">
</A>The lexical analyser</H4>
<P CLASS="Body">
<A NAME="pgfId=199245">
</A>The ICI lexical analyser breaks the input stream into tokens, optionally separated by white-space (which includes comments as described below). The next token is always the longest string of following characters which could possibly be a token. The following are tokens:</P>
<TABLE>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205062"></A>/ </PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205064"></A>/= </PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205066"></A>$ </PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205068"></A>@ </PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205070"></A>( </PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205072"></A>) </PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205074"></A>{ </PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205076"></A>} </PRE>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205078"></A>,</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205080"></A>~</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205082"></A>~~</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205084"></A>~~=</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205086"></A>~~~</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205088"></A>[</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205090"></A>]</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205092"></A>.</PRE>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205094"></A>*</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205096"></A>*=</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205098"></A>%</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205100"></A>%=</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205102"></A>^</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205104"></A>^=</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205106"></A>+</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205108"></A>+=</PRE>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205110"></A>++</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205112"></A>-</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205114"></A>-=</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205116"></A>--</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205118"></A>-></PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205120"></A>></PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205122"></A>>=</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205124"></A>>></PRE>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205126"></A>>>=</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205128"></A><</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205130"></A><=</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205132"></A><=></PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205134"></A><<</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205136"></A><<=</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205138"></A>=</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205140"></A>==</PRE>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205142"></A>!</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205144"></A>!=</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205146"></A>!~</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205148"></A>&</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205150"></A>&&</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205152"></A>&=</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205154"></A>|</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205156"></A>||</PRE>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205158"></A>|=</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205160"></A>;</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205162"></A>?</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205164"></A>:</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205166"></A>:=</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205168"></A>:^</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205170"></A> </PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205172"></A> </PRE>
</TD>
</TR>
</TABLE>
<P CLASS="Body">
<A NAME="pgfId=199359">
</A>The following are also tokens:</P>
<UL>
<LI CLASS="Bullet">
<A NAME="pgfId=196439">
</A>The character '#' followed by any sequence of characters except a newline, then another '#'. This token is a regular-expression.</LI>
<LI CLASS="Bullet">
<A NAME="pgfId=175549">
</A>The character ' (single quote) followed by a single character (other than a newline) or a single backslash character sequence (described below), followed by another single quote. This token is a character-code. A single quote followed by other than the above sequence will result in an error.</LI>
<LI CLASS="Bullet">
<A NAME="pgfId=203976">
</A>The character " (double quote) followed by any sequence of characters (other than a newline) and backslash character sequences, up to another double quote character. This token is a string.</LI>
</UL>
<P CLASS="Body">
<A NAME="pgfId=204014">
</A>A backslash character sequence is any of the following:</P>
<TABLE>
<TR>
<TH ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205174"></A><CODE CLASS="+Code">\n</CODE>
</PRE>
</TH>
<TH ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=205176">
</A>newline (ASCII 0x0A)</P>
</TH>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205178"></A><CODE CLASS="+Code">\t</CODE>
</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=205180">
</A>tab (ASCII 0x09)</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205182"></A><CODE CLASS="+Code">\v</CODE>
</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=205184">
</A>vertical tab (ASCII 0x0B)</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205186"></A><CODE CLASS="+Code">\b</CODE>
</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=205188">
</A>back space (ASCII 0x08)</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205190"></A><CODE CLASS="+Code">\r</CODE>
</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=205192">
</A>carriage return (ASCII 0x0D)</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205194"></A><CODE CLASS="+Code">\f</CODE>
</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=205196">
</A>form feed (ASCII 0x0C)</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205198"></A><CODE CLASS="+Code">\a</CODE>
</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=205200">
</A>audible bell (ASCII 0x07)</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205202"></A><CODE CLASS="+Code">\e</CODE>
</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=205204">
</A>escape (ASCII 0x1B)</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205206"></A><CODE CLASS="+Code">\\</CODE>
</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=205208">
</A>backslash (ASCII 0x5C)</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205210"></A><CODE CLASS="+Code">\'</CODE>
</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=205212">
</A>single quote (ASCII 0x27)</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205214"></A><CODE CLASS="+Code">\"</CODE>
</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=205216">
</A>double quote (ASCII 0x22)</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205218"></A><CODE CLASS="+Code">\?</CODE>
</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=205220">
</A>question mark (ASCII 0x3F)</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205222"></A><CODE CLASS="+Code">\cx</CODE>
</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=205224">
</A>control-x</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205226"></A><CODE CLASS="+Code">\xx.. </CODE>
</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=205228">
</A>the character with hex code x...</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<PRE CLASS="Preformatted"><A NAME="pgfId=205230"></A><CODE CLASS="+Code">\n</CODE>
</PRE>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=205232">
</A>the character with octal code n. (1, 2 or 3 octal digits)</P>
</TD>
</TR>
</TABLE>
<P CLASS="CBullet">
<A NAME="pgfId=175571">
</A> Consecutive string-literals, seperated only by white-space, are concatenated to form a single string-literal.</P>
<UL>
<LI CLASS="Bullet">
<A NAME="pgfId=175573">
</A>Any upper or lower case letter, any digit, or '_' (underscore) followed by any number of the same (or other characters which may be involved in a floating point number while that is a valid interpretation). A token of this form may be one of three things:</LI>
</UL>
<P CLASS="CBullet">
<A NAME="pgfId=175575">
</A> If it can be interpreted as an integer, it is an integer-number.</P>
<P CLASS="CBullet">
<A NAME="pgfId=175577">
</A> Otherwise, if it can be interpreted as a floating point number, it is a floating-point-number.</P>
<P CLASS="CBullet">
<A NAME="pgfId=175579">
</A> Otherwise, it is an identifier.</P>
<P CLASS="Body">
<A NAME="pgfId=175581">
</A>Notice that keywords are not recognised directly by the lexical analyser. Instead, certain identifiers are recognised in context by the parser as described below. </P>
<P CLASS="Body">
<A NAME="pgfId=175582">
</A>There are two forms of comments (which are white-space). One starts with the characters <CODE CLASS="+Code">
/*</CODE>
and continue until the next <CODE CLASS="+Code">
*/</CODE>
. The other starts with the characters <CODE CLASS="+Code">
//</CODE>
and continues until the next end of line. Also, lines which start with a # character are ignored. (Lines may be terminated with <I CLASS="+Italic">
linefeed</I>
, <I CLASS="+Italic">
carriage return</I>
or <I CLASS="+Italic">
carrige return</I>
plus <I CLASS="+Italic">
linefeed</I>
.)</P>
</DIV>
<DIV>
<H4 CLASS="Heading2">
<A NAME="pgfId=175583">
</A>An introduction to variables, modules and scope</H4>
<P CLASS="Body">
<A NAME="pgfId=175584">
</A>Variables are simple identifiers which have a value associated with them. They are in themselves typeless, depending on the type of the value currently assigned to them.</P>
<P CLASS="Body">
<A NAME="pgfId=175585">
</A>The term module in ICI refers to a collection of functions, declarations and code which share the same variables. Typically each source file is a module, but not necessarily.</P>
<P CLASS="Body">
<A NAME="pgfId=175586">
</A>In ICI, modules may be nested in a hierarchical fashion. Within a module, variables can be declared as either local or export. When a variable is declared as local it is visible to code defined in the module of its definition, and to code defined in sub-modules of that one. This is termed the scope of the variable.</P>
<P CLASS="Body">
<A NAME="pgfId=175587">
</A>When a variable is defined as export it is declared local in the parent module. Thus the parent module and all sub-modules of the parent module have that variable in their scope. Variables of this type, whether originally declared export or local, will be henceforward referred to as local variables.</P>
<P CLASS="Body">
<A NAME="pgfId=175588">
</A>Static variables are persistent variables. That is they remain in existence even when execution completely leaves their scope, despite not being visible to any executing code. They are visible again when code flow again enters their scope.</P>
<P CLASS="Body">
<A NAME="pgfId=175589">
</A>The scoping of local variables is strictly governed by the nesting of the modules, not by the flow of execution. For example. Suppose two neighbouring modules (call them module A and module B) each define a variable called theVariable. When some code in module A calls a function defined in module B and that function refers to theVariable; it is referring to the version of theVariable defined in module B, not the one defined in module A.</P>
<P CLASS="Body">
<A NAME="pgfId=175590">
</A>Variables in sub scopes hide variables of the same name defined in outer scopes.</P>
<P CLASS="Body">
<A NAME="pgfId=175591">
</A>The second type of variable in ICI is the automatic, or auto, variable. Automatic variables are not persistent. They last only as long as a module is being parsed or a function is being executed. For instance, each time a function is entered a copy is made of the auto variables which were declared in the function. This group of variables generally only persists during the execution of the function; once the function returns they are discarded.</P>
</DIV>
<DIV>
<H4 CLASS="Heading2">
<A NAME="pgfId=175592">
</A>The parser</H4>
<P CLASS="Body">
<A NAME="pgfId=175593">
</A>The parser uses the lexical analyser to read a source input stream. The parser also has reference to the variable-scope within which this source is being parsed, so that it may define variables.</P>
<P CLASS="Body">
<A NAME="pgfId=175594">
</A>When encountering a variable definition, the parser will define variables within the current scope. When encountering normal executable code at the outermost level, the parser returns its compiled form to the execution engine for execution.</P>
<P CLASS="Body">
<A NAME="pgfId=175595">
</A>For some constructs the parser will in turn recursively call upon the execution engine to evaluate a sub-construct within a statement.</P>
<P CLASS="Body">
<A NAME="pgfId=175596">
</A>The following sections will work through the syntax of ICI with explanations and examples. Occasionally constructs will be used ahead of their full explanation. Their intent should be obvious. </P>
<P CLASS="Body">
<A NAME="pgfId=175597">
</A>The following notation is used in the syntax in these sections. Note that the syntax given in the text is not always exact, but rather designed to aid comprehension. The exact syntax is given in a later section.</P>
<TABLE>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216614">
</A><B CLASS="+Bold">
bold</B>
</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216616">
</A>The <B CLASS="+Bold">
bold</B>
text is literal ASCII text.</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216618">
</A><I CLASS="+Italic">
italic</I>
</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216620">
</A>The <I CLASS="+Italic">
italic</I>
text is a construct further described elsewhere.</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216622">
</A><I CLASS="+Italic">
[</I>
xxx <I CLASS="+Italic">
]</I>
</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216624">
</A>The xxx is optionally present.</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216626">
</A>xxx...</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216628">
</A>The xxx may be present zero or more times.</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=247285">
</A><I CLASS="+Italic">
(</I>
xxx <I CLASS="+Italic">
|</I>
yyy <I CLASS="+Italic">
) </I>
</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=247287">
</A>Either xxx or yyy may be present.</P>
</TD>
</TR>
</TABLE>
<P CLASS="Body">
<A NAME="pgfId=175602">
</A>As noted previously there are no reserved words recoginsed by the lexical anaylyser, but certain identifiers will be recognised by the parser in certain syntactic positions (as seen below). While these identifiers are not otherwise restricted, special action may need to be taken if they are used as simple variable names. They probably should be avoided. The complete list is:</P>
<TABLE>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216651">
</A> </P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216653">
</A>nullptr </P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216655">
</A>auto </P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216657">
</A>break </P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216659">
</A>case </P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216661">
</A> </P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216663">
</A>continue</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216665">
</A>default</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216667">
</A>do</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216669">
</A>else</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216671">
</A> </P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216673">
</A>export</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216675">
</A>for</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216677">
</A>forall</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216679">
</A>if</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216681">
</A> </P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216683">
</A>in</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216685">
</A>onerror</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216687">
</A>return</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216689">
</A>local</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216691">
</A> </P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216693">
</A>switch</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216695">
</A>try</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216697">
</A>while</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=216699">
</A> </P>
</TD>
</TR>
</TABLE>
<P CLASS="Body">
<A NAME="pgfId=175604">
</A>We now turn our attention to the syntax itself.</P>
<P CLASS="Body">
<A NAME="pgfId=175605">
</A>Firstly consider the basic statement which is the unit of operation of the parser. As stated earlier the execution engine will call on the parser to parse one top-level statement at a time. We split the syntax of a statement into two categories (purely for semantic clarity):</P>
<TABLE>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=219766">
</A><I CLASS="+Italic">
statement</I>
</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=219768">
</A><I CLASS="+Italic">
executable-statement</I>
</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=219770">
</A> </P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=219772">
</A><I CLASS="+Italic">
declaration</I>
</P>
</TD>
</TR>
</TABLE>
<P CLASS="Body">
<A NAME="pgfId=175607">
</A>That is, a statement is either an executable-statement or a declaration. We will first consider the executable-statement.</P>
<P CLASS="Body">
<A NAME="pgfId=175608">
</A>These are statements that, at the top-level of parsing, can be translated into code which can be returned to the execution engine. This is by far the largest category of statements:</P>
<TABLE>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245348">
</A><I CLASS="+Italic">
executable-statement </I>
</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245350">
</A><I CLASS="+Italic">
expression</I>
<B CLASS="+Bold">
;</B>
</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245352">
</A> </P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245354">
</A><I CLASS="+Italic">
compound-statement</I>
</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245356">
</A> </P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245358">
</A><B CLASS="+Bold">
if (</B>
<I CLASS="+Italic">
expression</I>
<B CLASS="+Bold">
)</B>
<I CLASS="+Italic">
statement</I>
</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245360">
</A> </P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245362">
</A><B CLASS="+Bold">
if (</B>
<I CLASS="+Italic">
expression</I>
<B CLASS="+Bold">
)</B>
<I CLASS="+Italic">
statement</I>
<B CLASS="+Bold">
else</B>
<I CLASS="+Italic">
statement</I>
</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245364">
</A> </P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245366">
</A><B CLASS="+Bold">
while</B>
<B CLASS="+Bold">
(</B>
<I CLASS="+Italic">
expression</I>
<B CLASS="+Bold">
)</B>
<I CLASS="+Italic">
statement</I>
</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245368">
</A> </P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245370">
</A><B CLASS="+Bold">
do</B>
<I CLASS="+Italic">
statement</I>
<B CLASS="+Bold">
while</B>
<B CLASS="+Bold">
(</B>
<I CLASS="+Italic">
expression</I>
<B CLASS="+Bold">
) ;</B>
</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245372">
</A> </P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245374">
</A><B CLASS="+Bold">
for (</B>
<I CLASS="+Italic">
[ expression ] </I>
<B CLASS="+Bold">
;</B>
<I CLASS="+Italic">
[ expression ] </I>
<B CLASS="+Bold">
;</B>
<I CLASS="+Italic">
[ expression ]</I>
<B CLASS="+Bold">
)</B>
<I CLASS="+Italic">
statement</I>
</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245376">
</A> </P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245378">
</A><B CLASS="+Bold">
forall (</B>
<I CLASS="+Italic">
expression [</I>
<B CLASS="+Bold">
,</B>
<I CLASS="+Italic">
expression ]</I>
<B CLASS="+Bold">
in</B>
<I CLASS="+Italic">
expression</I>
<B CLASS="+Bold">
)</B>
<I CLASS="+Italic">
statement</I>
</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245380">
</A> </P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245382">
</A><B CLASS="+Bold">
switch ( </B>
<I CLASS="+Italic">
expression</I>
<B CLASS="+Bold">
)</B>
<I CLASS="+Italic">
compound-statement</I>
</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245384">
</A> </P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="CellBody">
<A NAME="pgfId=245386">
</A><B CLASS="+Bold">
case</B>
<I CLASS="+Italic">
parser-evaluated-expression</I>
<B CLASS="+Bold">
:</B>
</P>
</TD>
</TR>
<TR>