Home » Archimedes archive » Acorn User » AU 1997-10 A.adf » Extras » Apple][e/PD/BOB/ARMBOB/doc/Ref/Syntax

Apple][e/PD/BOB/ARMBOB/doc/Ref/Syntax

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1997-10 A.adf » Extras
Filename: Apple][e/PD/BOB/ARMBOB/doc/Ref/Syntax
Read OK:
File size: 1450 bytes
Load address: 0000
Exec address: 0000
File contents
ArmBob v.2.1 Reference                                GCW 29/11/94

         ----------------- SYNTAX ---------------

Armbob Syntax follows that of C, with some extensions and some omissions.
Every statement returns a value, including assignment statements.
This is one of the features of C that gives it its particular flavour.

Comments
--------

Armbob has two kinds of comment: single- and multi-line. They have
the same syntax as comments in C++.

Single-line comments are introduced by // and are terminated by the
end of the line or file.

Multi-line comments start with /* and end with the next */. They are 
not nestable.

Names
-----
Blank spaces, tab characters and newlines are ignored in Armbob, except in so far as they mark the end of a name. Names must begin
with a letter of the alphabet, and subsequently must consist of letters of the alphabet ('A'-'Z', 'a'-'z'), digits ('0'-'9'), or the underscore character '_'. ArmBob also permits '@', '$', '�' and '`' in names.

It may be useful, but it is not mandatory, to use these extra characters
as prefixes or suffixes on names, to indicate the type of object they
denote, in the following way

    @    for addresses of buffers in memory,
    $    for strings,
    �    for integers or 4-byte words,
    `    for bytes or characters.

This mnemonic convention fits the names for the storage functions
needed for low-level access. Thus, if s is a string, @(s) denotes
the integer address at which the contents of s are held. If a is
an address, $(a) denotes the string at a, terminated by a control
character, �(a) denotes the word stored at a, and `(a) denotes the
byte stored at a. 

Names may be up to 50 characters long. Program lines may be up to 
200 characters long.

Grammar
-------
The grammar is very similar to that of C.

Syntactic classes (non-terminal symbols) are written in angle 
brackets. Square brackets denote optional items, while '[' and 
']' denote actual square brackets (terminal symbols). A solidus
(|) denotes an alternative.

Program ::= [ <Defs> ] <Main_def> [ <Defs> ]
Defs ::= <Def> [ <Defs> ]
Def  ::= <Class_def> | <Fun_def>
Class_def ::= class <CName> [ : <CName> ] { <Class_body> }
Fun_def ::= [ <Cname> :: ] <FName> ( [ <FArgs> ] ) { <Fun_body> }
Main_def ::= main() { <Fun_body> }
Class_body ::=  <Member> ; [ <Class_body> ] 
Member ::= [static] <Data> | [static] <FName> ( [ <FArgs> ] )
Data ::= <Variable> [ , <Data> ]
FArgs ::= <Variable> [ , <FArgs> ]
Fun_body ::= [ local <Args> ; ] <Statements>
Statements ::= <Statement> <Statements>
Statement ::= [ <Single> ] ; | { <Statements> } | <Control>
Control ::= if ( <Expr> ) <Statement> [ else <Statement> ]
          | while ( <Expr> ) <Statement>
          | do <Statement> while ( <Expr> ) 
          | repeat <Statement> until ( <Expr> )
          | do <Statement> until ( <Expr> )
          | repeat <Statement> while ( <Expr> )
          | for ( <Expr> ; <Expr> ; <Expr> ) <Statement>
          | switch ( <Expr> ) { <Alternatives> [ default : <Statements> }
          | in <Expr> put { <Items> }
Single ::= break | continue | return <Expr> | <Expr>
Items ::= <Expr> ; <Items>
Alternatives ::= case <Expr> : <Statements> <Alternatives>
Expr ::= <Expr> , <Expr>
       | <Lval> <Assign> <Expr>
       | <Expr> ? <Expr> : <Expr>
       | <Expr> <Binop> <Expr>
       | <Unop> <Expr>
       | ++ <Lvalue>
       | <Lvalue> ++
       | -- <Lvalue>
       | <Lvalue> --
       | new <Cname> ( [ <Expr> ] )
       | <Expr> ( [ <Expr> ] )
       | <Expr> -> <Fname> ( [ <Expr> ] )
       | <Expr> '[' <Expr> ']'
       | vector { <Components> }
       | enum { <Data> }
       | ( <Expr> )
       | <Variable>
       | <Number>
       | "<String>"
       | '<Character>'
       | nil
       | <Constant>
Components = <Expr> ; [<Components>]
Assign ::= = | += | -= | *= | /= | %= | &= | |= | ^= | <<= | >>=
Binop ::= || | && | '|' | ^ | & | == | != | < | <= | >= | >
        | >> | << | + | - | * | % | /
Unop ::= - | ! | ~ 
Lvalue ::= <Variable> | <Expr> '[' <Expr> ']'
Number ::= <Decimal>[.<Decimal>] | &<Hexnumber>
Decimal ::= <Digit><Decimal>
Hexnumber ::= <Hexdigit><Hexnumber>
Digit ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
Hexdigit ::= a | b | c | d | e | f | <Digit>
Character ::= <Char> | "
String ::= <Char><String>
Char ::= Any ASCII character except ", \ or control codes | \n | \t | \\
Cname ::= <Identifier>
Fname ::= <Identifier>
Variable ::= <Identifier>
Identifier ::= <Alpha><Alphanum>
Alphanum ::= <Alpha> | <Digit>
Alpha ::= [A-Z] | [a-z] | _ | @ | $ | � | `


The differences from C are:

  No type declarations in Armbob. Use classes instead.

  The use of vectors or methods instead of pointers.

  Automatic memory allocation and garbage collection for strings
  and vectors.

  The 'in b put { x1; ... xn; }' structure.

  The synonym 'repeat' for 'do'.

  The use of 'nil' as well as zero as a conditional.

  The absence of coercion between integer and real numbers in addition 
  and subtraction. 

  All datatypes are first-class. For example, functions and instance
  objects can be arguments to functions or returned by functions.
                                            
             --------- END -----------
00000000  41 72 6d 42 6f 62 20 76  2e 32 2e 31 20 52 65 66  |ArmBob v.2.1 Ref|
00000010  65 72 65 6e 63 65 20 20  20 20 20 20 20 20 20 20  |erence          |
00000020  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000030  20 20 20 20 20 20 47 43  57 20 32 39 2f 31 31 2f  |      GCW 29/11/|
00000040  39 34 0a 0a 20 20 20 20  20 20 20 20 20 2d 2d 2d  |94..         ---|
00000050  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 20 53  |-------------- S|
00000060  59 4e 54 41 58 20 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |YNTAX ----------|
00000070  2d 2d 2d 2d 2d 0a 0a 41  72 6d 62 6f 62 20 53 79  |-----..Armbob Sy|
00000080  6e 74 61 78 20 66 6f 6c  6c 6f 77 73 20 74 68 61  |ntax follows tha|
00000090  74 20 6f 66 20 43 2c 20  77 69 74 68 20 73 6f 6d  |t of C, with som|
000000a0  65 20 65 78 74 65 6e 73  69 6f 6e 73 20 61 6e 64  |e extensions and|
000000b0  20 73 6f 6d 65 20 6f 6d  69 73 73 69 6f 6e 73 2e  | some omissions.|
000000c0  0a 45 76 65 72 79 20 73  74 61 74 65 6d 65 6e 74  |.Every statement|
000000d0  20 72 65 74 75 72 6e 73  20 61 20 76 61 6c 75 65  | returns a value|
000000e0  2c 20 69 6e 63 6c 75 64  69 6e 67 20 61 73 73 69  |, including assi|
000000f0  67 6e 6d 65 6e 74 20 73  74 61 74 65 6d 65 6e 74  |gnment statement|
00000100  73 2e 0a 54 68 69 73 20  69 73 20 6f 6e 65 20 6f  |s..This is one o|
00000110  66 20 74 68 65 20 66 65  61 74 75 72 65 73 20 6f  |f the features o|
00000120  66 20 43 20 74 68 61 74  20 67 69 76 65 73 20 69  |f C that gives i|
00000130  74 20 69 74 73 20 70 61  72 74 69 63 75 6c 61 72  |t its particular|
00000140  20 66 6c 61 76 6f 75 72  2e 0a 0a 43 6f 6d 6d 65  | flavour...Comme|
00000150  6e 74 73 0a 2d 2d 2d 2d  2d 2d 2d 2d 0a 0a 41 72  |nts.--------..Ar|
00000160  6d 62 6f 62 20 68 61 73  20 74 77 6f 20 6b 69 6e  |mbob has two kin|
00000170  64 73 20 6f 66 20 63 6f  6d 6d 65 6e 74 3a 20 73  |ds of comment: s|
00000180  69 6e 67 6c 65 2d 20 61  6e 64 20 6d 75 6c 74 69  |ingle- and multi|
00000190  2d 6c 69 6e 65 2e 20 54  68 65 79 20 68 61 76 65  |-line. They have|
000001a0  0a 74 68 65 20 73 61 6d  65 20 73 79 6e 74 61 78  |.the same syntax|
000001b0  20 61 73 20 63 6f 6d 6d  65 6e 74 73 20 69 6e 20  | as comments in |
000001c0  43 2b 2b 2e 0a 0a 53 69  6e 67 6c 65 2d 6c 69 6e  |C++...Single-lin|
000001d0  65 20 63 6f 6d 6d 65 6e  74 73 20 61 72 65 20 69  |e comments are i|
000001e0  6e 74 72 6f 64 75 63 65  64 20 62 79 20 2f 2f 20  |ntroduced by // |
000001f0  61 6e 64 20 61 72 65 20  74 65 72 6d 69 6e 61 74  |and are terminat|
00000200  65 64 20 62 79 20 74 68  65 0a 65 6e 64 20 6f 66  |ed by the.end of|
00000210  20 74 68 65 20 6c 69 6e  65 20 6f 72 20 66 69 6c  | the line or fil|
00000220  65 2e 0a 0a 4d 75 6c 74  69 2d 6c 69 6e 65 20 63  |e...Multi-line c|
00000230  6f 6d 6d 65 6e 74 73 20  73 74 61 72 74 20 77 69  |omments start wi|
00000240  74 68 20 2f 2a 20 61 6e  64 20 65 6e 64 20 77 69  |th /* and end wi|
00000250  74 68 20 74 68 65 20 6e  65 78 74 20 2a 2f 2e 20  |th the next */. |
00000260  54 68 65 79 20 61 72 65  20 0a 6e 6f 74 20 6e 65  |They are .not ne|
00000270  73 74 61 62 6c 65 2e 0a  0a 4e 61 6d 65 73 0a 2d  |stable...Names.-|
00000280  2d 2d 2d 2d 0a 42 6c 61  6e 6b 20 73 70 61 63 65  |----.Blank space|
00000290  73 2c 20 74 61 62 20 63  68 61 72 61 63 74 65 72  |s, tab character|
000002a0  73 20 61 6e 64 20 6e 65  77 6c 69 6e 65 73 20 61  |s and newlines a|
000002b0  72 65 20 69 67 6e 6f 72  65 64 20 69 6e 20 41 72  |re ignored in Ar|
000002c0  6d 62 6f 62 2c 20 65 78  63 65 70 74 20 69 6e 20  |mbob, except in |
000002d0  73 6f 20 66 61 72 20 61  73 20 74 68 65 79 20 6d  |so far as they m|
000002e0  61 72 6b 20 74 68 65 20  65 6e 64 20 6f 66 20 61  |ark the end of a|
000002f0  20 6e 61 6d 65 2e 20 4e  61 6d 65 73 20 6d 75 73  | name. Names mus|
00000300  74 20 62 65 67 69 6e 0a  77 69 74 68 20 61 20 6c  |t begin.with a l|
00000310  65 74 74 65 72 20 6f 66  20 74 68 65 20 61 6c 70  |etter of the alp|
00000320  68 61 62 65 74 2c 20 61  6e 64 20 73 75 62 73 65  |habet, and subse|
00000330  71 75 65 6e 74 6c 79 20  6d 75 73 74 20 63 6f 6e  |quently must con|
00000340  73 69 73 74 20 6f 66 20  6c 65 74 74 65 72 73 20  |sist of letters |
00000350  6f 66 20 74 68 65 20 61  6c 70 68 61 62 65 74 20  |of the alphabet |
00000360  28 27 41 27 2d 27 5a 27  2c 20 27 61 27 2d 27 7a  |('A'-'Z', 'a'-'z|
00000370  27 29 2c 20 64 69 67 69  74 73 20 28 27 30 27 2d  |'), digits ('0'-|
00000380  27 39 27 29 2c 20 6f 72  20 74 68 65 20 75 6e 64  |'9'), or the und|
00000390  65 72 73 63 6f 72 65 20  63 68 61 72 61 63 74 65  |erscore characte|
000003a0  72 20 27 5f 27 2e 20 41  72 6d 42 6f 62 20 61 6c  |r '_'. ArmBob al|
000003b0  73 6f 20 70 65 72 6d 69  74 73 20 27 40 27 2c 20  |so permits '@', |
000003c0  27 24 27 2c 20 27 a3 27  20 61 6e 64 20 27 60 27  |'$', '.' and '`'|
000003d0  20 69 6e 20 6e 61 6d 65  73 2e 0a 0a 49 74 20 6d  | in names...It m|
000003e0  61 79 20 62 65 20 75 73  65 66 75 6c 2c 20 62 75  |ay be useful, bu|
000003f0  74 20 69 74 20 69 73 20  6e 6f 74 20 6d 61 6e 64  |t it is not mand|
00000400  61 74 6f 72 79 2c 20 74  6f 20 75 73 65 20 74 68  |atory, to use th|
00000410  65 73 65 20 65 78 74 72  61 20 63 68 61 72 61 63  |ese extra charac|
00000420  74 65 72 73 0a 61 73 20  70 72 65 66 69 78 65 73  |ters.as prefixes|
00000430  20 6f 72 20 73 75 66 66  69 78 65 73 20 6f 6e 20  | or suffixes on |
00000440  6e 61 6d 65 73 2c 20 74  6f 20 69 6e 64 69 63 61  |names, to indica|
00000450  74 65 20 74 68 65 20 74  79 70 65 20 6f 66 20 6f  |te the type of o|
00000460  62 6a 65 63 74 20 74 68  65 79 0a 64 65 6e 6f 74  |bject they.denot|
00000470  65 2c 20 69 6e 20 74 68  65 20 66 6f 6c 6c 6f 77  |e, in the follow|
00000480  69 6e 67 20 77 61 79 0a  0a 20 20 20 20 40 20 20  |ing way..    @  |
00000490  20 20 66 6f 72 20 61 64  64 72 65 73 73 65 73 20  |  for addresses |
000004a0  6f 66 20 62 75 66 66 65  72 73 20 69 6e 20 6d 65  |of buffers in me|
000004b0  6d 6f 72 79 2c 0a 20 20  20 20 24 20 20 20 20 66  |mory,.    $    f|
000004c0  6f 72 20 73 74 72 69 6e  67 73 2c 0a 20 20 20 20  |or strings,.    |
000004d0  a3 20 20 20 20 66 6f 72  20 69 6e 74 65 67 65 72  |.    for integer|
000004e0  73 20 6f 72 20 34 2d 62  79 74 65 20 77 6f 72 64  |s or 4-byte word|
000004f0  73 2c 0a 20 20 20 20 60  20 20 20 20 66 6f 72 20  |s,.    `    for |
00000500  62 79 74 65 73 20 6f 72  20 63 68 61 72 61 63 74  |bytes or charact|
00000510  65 72 73 2e 0a 0a 54 68  69 73 20 6d 6e 65 6d 6f  |ers...This mnemo|
00000520  6e 69 63 20 63 6f 6e 76  65 6e 74 69 6f 6e 20 66  |nic convention f|
00000530  69 74 73 20 74 68 65 20  6e 61 6d 65 73 20 66 6f  |its the names fo|
00000540  72 20 74 68 65 20 73 74  6f 72 61 67 65 20 66 75  |r the storage fu|
00000550  6e 63 74 69 6f 6e 73 0a  6e 65 65 64 65 64 20 66  |nctions.needed f|
00000560  6f 72 20 6c 6f 77 2d 6c  65 76 65 6c 20 61 63 63  |or low-level acc|
00000570  65 73 73 2e 20 54 68 75  73 2c 20 69 66 20 73 20  |ess. Thus, if s |
00000580  69 73 20 61 20 73 74 72  69 6e 67 2c 20 40 28 73  |is a string, @(s|
00000590  29 20 64 65 6e 6f 74 65  73 0a 74 68 65 20 69 6e  |) denotes.the in|
000005a0  74 65 67 65 72 20 61 64  64 72 65 73 73 20 61 74  |teger address at|
000005b0  20 77 68 69 63 68 20 74  68 65 20 63 6f 6e 74 65  | which the conte|
000005c0  6e 74 73 20 6f 66 20 73  20 61 72 65 20 68 65 6c  |nts of s are hel|
000005d0  64 2e 20 49 66 20 61 20  69 73 0a 61 6e 20 61 64  |d. If a is.an ad|
000005e0  64 72 65 73 73 2c 20 24  28 61 29 20 64 65 6e 6f  |dress, $(a) deno|
000005f0  74 65 73 20 74 68 65 20  73 74 72 69 6e 67 20 61  |tes the string a|
00000600  74 20 61 2c 20 74 65 72  6d 69 6e 61 74 65 64 20  |t a, terminated |
00000610  62 79 20 61 20 63 6f 6e  74 72 6f 6c 0a 63 68 61  |by a control.cha|
00000620  72 61 63 74 65 72 2c 20  a3 28 61 29 20 64 65 6e  |racter, .(a) den|
00000630  6f 74 65 73 20 74 68 65  20 77 6f 72 64 20 73 74  |otes the word st|
00000640  6f 72 65 64 20 61 74 20  61 2c 20 61 6e 64 20 60  |ored at a, and `|
00000650  28 61 29 20 64 65 6e 6f  74 65 73 20 74 68 65 0a  |(a) denotes the.|
00000660  62 79 74 65 20 73 74 6f  72 65 64 20 61 74 20 61  |byte stored at a|
00000670  2e 20 0a 0a 4e 61 6d 65  73 20 6d 61 79 20 62 65  |. ..Names may be|
00000680  20 75 70 20 74 6f 20 35  30 20 63 68 61 72 61 63  | up to 50 charac|
00000690  74 65 72 73 20 6c 6f 6e  67 2e 20 50 72 6f 67 72  |ters long. Progr|
000006a0  61 6d 20 6c 69 6e 65 73  20 6d 61 79 20 62 65 20  |am lines may be |
000006b0  75 70 20 74 6f 20 0a 32  30 30 20 63 68 61 72 61  |up to .200 chara|
000006c0  63 74 65 72 73 20 6c 6f  6e 67 2e 0a 0a 47 72 61  |cters long...Gra|
000006d0  6d 6d 61 72 0a 2d 2d 2d  2d 2d 2d 2d 0a 54 68 65  |mmar.-------.The|
000006e0  20 67 72 61 6d 6d 61 72  20 69 73 20 76 65 72 79  | grammar is very|
000006f0  20 73 69 6d 69 6c 61 72  20 74 6f 20 74 68 61 74  | similar to that|
00000700  20 6f 66 20 43 2e 0a 0a  53 79 6e 74 61 63 74 69  | of C...Syntacti|
00000710  63 20 63 6c 61 73 73 65  73 20 28 6e 6f 6e 2d 74  |c classes (non-t|
00000720  65 72 6d 69 6e 61 6c 20  73 79 6d 62 6f 6c 73 29  |erminal symbols)|
00000730  20 61 72 65 20 77 72 69  74 74 65 6e 20 69 6e 20  | are written in |
00000740  61 6e 67 6c 65 20 0a 62  72 61 63 6b 65 74 73 2e  |angle .brackets.|
00000750  20 53 71 75 61 72 65 20  62 72 61 63 6b 65 74 73  | Square brackets|
00000760  20 64 65 6e 6f 74 65 20  6f 70 74 69 6f 6e 61 6c  | denote optional|
00000770  20 69 74 65 6d 73 2c 20  77 68 69 6c 65 20 27 5b  | items, while '[|
00000780  27 20 61 6e 64 20 0a 27  5d 27 20 64 65 6e 6f 74  |' and .']' denot|
00000790  65 20 61 63 74 75 61 6c  20 73 71 75 61 72 65 20  |e actual square |
000007a0  62 72 61 63 6b 65 74 73  20 28 74 65 72 6d 69 6e  |brackets (termin|
000007b0  61 6c 20 73 79 6d 62 6f  6c 73 29 2e 20 41 20 73  |al symbols). A s|
000007c0  6f 6c 69 64 75 73 0a 28  7c 29 20 64 65 6e 6f 74  |olidus.(|) denot|
000007d0  65 73 20 61 6e 20 61 6c  74 65 72 6e 61 74 69 76  |es an alternativ|
000007e0  65 2e 0a 0a 50 72 6f 67  72 61 6d 20 3a 3a 3d 20  |e...Program ::= |
000007f0  5b 20 3c 44 65 66 73 3e  20 5d 20 3c 4d 61 69 6e  |[ <Defs> ] <Main|
00000800  5f 64 65 66 3e 20 5b 20  3c 44 65 66 73 3e 20 5d  |_def> [ <Defs> ]|
00000810  0a 44 65 66 73 20 3a 3a  3d 20 3c 44 65 66 3e 20  |.Defs ::= <Def> |
00000820  5b 20 3c 44 65 66 73 3e  20 5d 0a 44 65 66 20 20  |[ <Defs> ].Def  |
00000830  3a 3a 3d 20 3c 43 6c 61  73 73 5f 64 65 66 3e 20  |::= <Class_def> |
00000840  7c 20 3c 46 75 6e 5f 64  65 66 3e 0a 43 6c 61 73  || <Fun_def>.Clas|
00000850  73 5f 64 65 66 20 3a 3a  3d 20 63 6c 61 73 73 20  |s_def ::= class |
00000860  3c 43 4e 61 6d 65 3e 20  5b 20 3a 20 3c 43 4e 61  |<CName> [ : <CNa|
00000870  6d 65 3e 20 5d 20 7b 20  3c 43 6c 61 73 73 5f 62  |me> ] { <Class_b|
00000880  6f 64 79 3e 20 7d 0a 46  75 6e 5f 64 65 66 20 3a  |ody> }.Fun_def :|
00000890  3a 3d 20 5b 20 3c 43 6e  61 6d 65 3e 20 3a 3a 20  |:= [ <Cname> :: |
000008a0  5d 20 3c 46 4e 61 6d 65  3e 20 28 20 5b 20 3c 46  |] <FName> ( [ <F|
000008b0  41 72 67 73 3e 20 5d 20  29 20 7b 20 3c 46 75 6e  |Args> ] ) { <Fun|
000008c0  5f 62 6f 64 79 3e 20 7d  0a 4d 61 69 6e 5f 64 65  |_body> }.Main_de|
000008d0  66 20 3a 3a 3d 20 6d 61  69 6e 28 29 20 7b 20 3c  |f ::= main() { <|
000008e0  46 75 6e 5f 62 6f 64 79  3e 20 7d 0a 43 6c 61 73  |Fun_body> }.Clas|
000008f0  73 5f 62 6f 64 79 20 3a  3a 3d 20 20 3c 4d 65 6d  |s_body ::=  <Mem|
00000900  62 65 72 3e 20 3b 20 5b  20 3c 43 6c 61 73 73 5f  |ber> ; [ <Class_|
00000910  62 6f 64 79 3e 20 5d 20  0a 4d 65 6d 62 65 72 20  |body> ] .Member |
00000920  3a 3a 3d 20 5b 73 74 61  74 69 63 5d 20 3c 44 61  |::= [static] <Da|
00000930  74 61 3e 20 7c 20 5b 73  74 61 74 69 63 5d 20 3c  |ta> | [static] <|
00000940  46 4e 61 6d 65 3e 20 28  20 5b 20 3c 46 41 72 67  |FName> ( [ <FArg|
00000950  73 3e 20 5d 20 29 0a 44  61 74 61 20 3a 3a 3d 20  |s> ] ).Data ::= |
00000960  3c 56 61 72 69 61 62 6c  65 3e 20 5b 20 2c 20 3c  |<Variable> [ , <|
00000970  44 61 74 61 3e 20 5d 0a  46 41 72 67 73 20 3a 3a  |Data> ].FArgs ::|
00000980  3d 20 3c 56 61 72 69 61  62 6c 65 3e 20 5b 20 2c  |= <Variable> [ ,|
00000990  20 3c 46 41 72 67 73 3e  20 5d 0a 46 75 6e 5f 62  | <FArgs> ].Fun_b|
000009a0  6f 64 79 20 3a 3a 3d 20  5b 20 6c 6f 63 61 6c 20  |ody ::= [ local |
000009b0  3c 41 72 67 73 3e 20 3b  20 5d 20 3c 53 74 61 74  |<Args> ; ] <Stat|
000009c0  65 6d 65 6e 74 73 3e 0a  53 74 61 74 65 6d 65 6e  |ements>.Statemen|
000009d0  74 73 20 3a 3a 3d 20 3c  53 74 61 74 65 6d 65 6e  |ts ::= <Statemen|
000009e0  74 3e 20 3c 53 74 61 74  65 6d 65 6e 74 73 3e 0a  |t> <Statements>.|
000009f0  53 74 61 74 65 6d 65 6e  74 20 3a 3a 3d 20 5b 20  |Statement ::= [ |
00000a00  3c 53 69 6e 67 6c 65 3e  20 5d 20 3b 20 7c 20 7b  |<Single> ] ; | {|
00000a10  20 3c 53 74 61 74 65 6d  65 6e 74 73 3e 20 7d 20  | <Statements> } |
00000a20  7c 20 3c 43 6f 6e 74 72  6f 6c 3e 0a 43 6f 6e 74  || <Control>.Cont|
00000a30  72 6f 6c 20 3a 3a 3d 20  69 66 20 28 20 3c 45 78  |rol ::= if ( <Ex|
00000a40  70 72 3e 20 29 20 3c 53  74 61 74 65 6d 65 6e 74  |pr> ) <Statement|
00000a50  3e 20 5b 20 65 6c 73 65  20 3c 53 74 61 74 65 6d  |> [ else <Statem|
00000a60  65 6e 74 3e 20 5d 0a 20  20 20 20 20 20 20 20 20  |ent> ].         |
00000a70  20 7c 20 77 68 69 6c 65  20 28 20 3c 45 78 70 72  | | while ( <Expr|
00000a80  3e 20 29 20 3c 53 74 61  74 65 6d 65 6e 74 3e 0a  |> ) <Statement>.|
00000a90  20 20 20 20 20 20 20 20  20 20 7c 20 64 6f 20 3c  |          | do <|
00000aa0  53 74 61 74 65 6d 65 6e  74 3e 20 77 68 69 6c 65  |Statement> while|
00000ab0  20 28 20 3c 45 78 70 72  3e 20 29 20 0a 20 20 20  | ( <Expr> ) .   |
00000ac0  20 20 20 20 20 20 20 7c  20 72 65 70 65 61 74 20  |       | repeat |
00000ad0  3c 53 74 61 74 65 6d 65  6e 74 3e 20 75 6e 74 69  |<Statement> unti|
00000ae0  6c 20 28 20 3c 45 78 70  72 3e 20 29 0a 20 20 20  |l ( <Expr> ).   |
00000af0  20 20 20 20 20 20 20 7c  20 64 6f 20 3c 53 74 61  |       | do <Sta|
00000b00  74 65 6d 65 6e 74 3e 20  75 6e 74 69 6c 20 28 20  |tement> until ( |
00000b10  3c 45 78 70 72 3e 20 29  0a 20 20 20 20 20 20 20  |<Expr> ).       |
00000b20  20 20 20 7c 20 72 65 70  65 61 74 20 3c 53 74 61  |   | repeat <Sta|
00000b30  74 65 6d 65 6e 74 3e 20  77 68 69 6c 65 20 28 20  |tement> while ( |
00000b40  3c 45 78 70 72 3e 20 29  0a 20 20 20 20 20 20 20  |<Expr> ).       |
00000b50  20 20 20 7c 20 66 6f 72  20 28 20 3c 45 78 70 72  |   | for ( <Expr|
00000b60  3e 20 3b 20 3c 45 78 70  72 3e 20 3b 20 3c 45 78  |> ; <Expr> ; <Ex|
00000b70  70 72 3e 20 29 20 3c 53  74 61 74 65 6d 65 6e 74  |pr> ) <Statement|
00000b80  3e 0a 20 20 20 20 20 20  20 20 20 20 7c 20 73 77  |>.          | sw|
00000b90  69 74 63 68 20 28 20 3c  45 78 70 72 3e 20 29 20  |itch ( <Expr> ) |
00000ba0  7b 20 3c 41 6c 74 65 72  6e 61 74 69 76 65 73 3e  |{ <Alternatives>|
00000bb0  20 5b 20 64 65 66 61 75  6c 74 20 3a 20 3c 53 74  | [ default : <St|
00000bc0  61 74 65 6d 65 6e 74 73  3e 20 7d 0a 20 20 20 20  |atements> }.    |
00000bd0  20 20 20 20 20 20 7c 20  69 6e 20 3c 45 78 70 72  |      | in <Expr|
00000be0  3e 20 70 75 74 20 7b 20  3c 49 74 65 6d 73 3e 20  |> put { <Items> |
00000bf0  7d 0a 53 69 6e 67 6c 65  20 3a 3a 3d 20 62 72 65  |}.Single ::= bre|
00000c00  61 6b 20 7c 20 63 6f 6e  74 69 6e 75 65 20 7c 20  |ak | continue | |
00000c10  72 65 74 75 72 6e 20 3c  45 78 70 72 3e 20 7c 20  |return <Expr> | |
00000c20  3c 45 78 70 72 3e 0a 49  74 65 6d 73 20 3a 3a 3d  |<Expr>.Items ::=|
00000c30  20 3c 45 78 70 72 3e 20  3b 20 3c 49 74 65 6d 73  | <Expr> ; <Items|
00000c40  3e 0a 41 6c 74 65 72 6e  61 74 69 76 65 73 20 3a  |>.Alternatives :|
00000c50  3a 3d 20 63 61 73 65 20  3c 45 78 70 72 3e 20 3a  |:= case <Expr> :|
00000c60  20 3c 53 74 61 74 65 6d  65 6e 74 73 3e 20 3c 41  | <Statements> <A|
00000c70  6c 74 65 72 6e 61 74 69  76 65 73 3e 0a 45 78 70  |lternatives>.Exp|
00000c80  72 20 3a 3a 3d 20 3c 45  78 70 72 3e 20 2c 20 3c  |r ::= <Expr> , <|
00000c90  45 78 70 72 3e 0a 20 20  20 20 20 20 20 7c 20 3c  |Expr>.       | <|
00000ca0  4c 76 61 6c 3e 20 3c 41  73 73 69 67 6e 3e 20 3c  |Lval> <Assign> <|
00000cb0  45 78 70 72 3e 0a 20 20  20 20 20 20 20 7c 20 3c  |Expr>.       | <|
00000cc0  45 78 70 72 3e 20 3f 20  3c 45 78 70 72 3e 20 3a  |Expr> ? <Expr> :|
00000cd0  20 3c 45 78 70 72 3e 0a  20 20 20 20 20 20 20 7c  | <Expr>.       ||
00000ce0  20 3c 45 78 70 72 3e 20  3c 42 69 6e 6f 70 3e 20  | <Expr> <Binop> |
00000cf0  3c 45 78 70 72 3e 0a 20  20 20 20 20 20 20 7c 20  |<Expr>.       | |
00000d00  3c 55 6e 6f 70 3e 20 3c  45 78 70 72 3e 0a 20 20  |<Unop> <Expr>.  |
00000d10  20 20 20 20 20 7c 20 2b  2b 20 3c 4c 76 61 6c 75  |     | ++ <Lvalu|
00000d20  65 3e 0a 20 20 20 20 20  20 20 7c 20 3c 4c 76 61  |e>.       | <Lva|
00000d30  6c 75 65 3e 20 2b 2b 0a  20 20 20 20 20 20 20 7c  |lue> ++.       ||
00000d40  20 2d 2d 20 3c 4c 76 61  6c 75 65 3e 0a 20 20 20  | -- <Lvalue>.   |
00000d50  20 20 20 20 7c 20 3c 4c  76 61 6c 75 65 3e 20 2d  |    | <Lvalue> -|
00000d60  2d 0a 20 20 20 20 20 20  20 7c 20 6e 65 77 20 3c  |-.       | new <|
00000d70  43 6e 61 6d 65 3e 20 28  20 5b 20 3c 45 78 70 72  |Cname> ( [ <Expr|
00000d80  3e 20 5d 20 29 0a 20 20  20 20 20 20 20 7c 20 3c  |> ] ).       | <|
00000d90  45 78 70 72 3e 20 28 20  5b 20 3c 45 78 70 72 3e  |Expr> ( [ <Expr>|
00000da0  20 5d 20 29 0a 20 20 20  20 20 20 20 7c 20 3c 45  | ] ).       | <E|
00000db0  78 70 72 3e 20 2d 3e 20  3c 46 6e 61 6d 65 3e 20  |xpr> -> <Fname> |
00000dc0  28 20 5b 20 3c 45 78 70  72 3e 20 5d 20 29 0a 20  |( [ <Expr> ] ). |
00000dd0  20 20 20 20 20 20 7c 20  3c 45 78 70 72 3e 20 27  |      | <Expr> '|
00000de0  5b 27 20 3c 45 78 70 72  3e 20 27 5d 27 0a 20 20  |[' <Expr> ']'.  |
00000df0  20 20 20 20 20 7c 20 76  65 63 74 6f 72 20 7b 20  |     | vector { |
00000e00  3c 43 6f 6d 70 6f 6e 65  6e 74 73 3e 20 7d 0a 20  |<Components> }. |
00000e10  20 20 20 20 20 20 7c 20  65 6e 75 6d 20 7b 20 3c  |      | enum { <|
00000e20  44 61 74 61 3e 20 7d 0a  20 20 20 20 20 20 20 7c  |Data> }.       ||
00000e30  20 28 20 3c 45 78 70 72  3e 20 29 0a 20 20 20 20  | ( <Expr> ).    |
00000e40  20 20 20 7c 20 3c 56 61  72 69 61 62 6c 65 3e 0a  |   | <Variable>.|
00000e50  20 20 20 20 20 20 20 7c  20 3c 4e 75 6d 62 65 72  |       | <Number|
00000e60  3e 0a 20 20 20 20 20 20  20 7c 20 22 3c 53 74 72  |>.       | "<Str|
00000e70  69 6e 67 3e 22 0a 20 20  20 20 20 20 20 7c 20 27  |ing>".       | '|
00000e80  3c 43 68 61 72 61 63 74  65 72 3e 27 0a 20 20 20  |<Character>'.   |
00000e90  20 20 20 20 7c 20 6e 69  6c 0a 20 20 20 20 20 20  |    | nil.      |
00000ea0  20 7c 20 3c 43 6f 6e 73  74 61 6e 74 3e 0a 43 6f  | | <Constant>.Co|
00000eb0  6d 70 6f 6e 65 6e 74 73  20 3d 20 3c 45 78 70 72  |mponents = <Expr|
00000ec0  3e 20 3b 20 5b 3c 43 6f  6d 70 6f 6e 65 6e 74 73  |> ; [<Components|
00000ed0  3e 5d 0a 41 73 73 69 67  6e 20 3a 3a 3d 20 3d 20  |>].Assign ::= = |
00000ee0  7c 20 2b 3d 20 7c 20 2d  3d 20 7c 20 2a 3d 20 7c  || += | -= | *= ||
00000ef0  20 2f 3d 20 7c 20 25 3d  20 7c 20 26 3d 20 7c 20  | /= | %= | &= | |
00000f00  7c 3d 20 7c 20 5e 3d 20  7c 20 3c 3c 3d 20 7c 20  ||= | ^= | <<= | |
00000f10  3e 3e 3d 0a 42 69 6e 6f  70 20 3a 3a 3d 20 7c 7c  |>>=.Binop ::= |||
00000f20  20 7c 20 26 26 20 7c 20  27 7c 27 20 7c 20 5e 20  | | && | '|' | ^ |
00000f30  7c 20 26 20 7c 20 3d 3d  20 7c 20 21 3d 20 7c 20  || & | == | != | |
00000f40  3c 20 7c 20 3c 3d 20 7c  20 3e 3d 20 7c 20 3e 0a  |< | <= | >= | >.|
00000f50  20 20 20 20 20 20 20 20  7c 20 3e 3e 20 7c 20 3c  |        | >> | <|
00000f60  3c 20 7c 20 2b 20 7c 20  2d 20 7c 20 2a 20 7c 20  |< | + | - | * | |
00000f70  25 20 7c 20 2f 0a 55 6e  6f 70 20 3a 3a 3d 20 2d  |% | /.Unop ::= -|
00000f80  20 7c 20 21 20 7c 20 7e  20 0a 4c 76 61 6c 75 65  | | ! | ~ .Lvalue|
00000f90  20 3a 3a 3d 20 3c 56 61  72 69 61 62 6c 65 3e 20  | ::= <Variable> |
00000fa0  7c 20 3c 45 78 70 72 3e  20 27 5b 27 20 3c 45 78  || <Expr> '[' <Ex|
00000fb0  70 72 3e 20 27 5d 27 0a  4e 75 6d 62 65 72 20 3a  |pr> ']'.Number :|
00000fc0  3a 3d 20 3c 44 65 63 69  6d 61 6c 3e 5b 2e 3c 44  |:= <Decimal>[.<D|
00000fd0  65 63 69 6d 61 6c 3e 5d  20 7c 20 26 3c 48 65 78  |ecimal>] | &<Hex|
00000fe0  6e 75 6d 62 65 72 3e 0a  44 65 63 69 6d 61 6c 20  |number>.Decimal |
00000ff0  3a 3a 3d 20 3c 44 69 67  69 74 3e 3c 44 65 63 69  |::= <Digit><Deci|
00001000  6d 61 6c 3e 0a 48 65 78  6e 75 6d 62 65 72 20 3a  |mal>.Hexnumber :|
00001010  3a 3d 20 3c 48 65 78 64  69 67 69 74 3e 3c 48 65  |:= <Hexdigit><He|
00001020  78 6e 75 6d 62 65 72 3e  0a 44 69 67 69 74 20 3a  |xnumber>.Digit :|
00001030  3a 3d 20 30 20 7c 20 31  20 7c 20 32 20 7c 20 33  |:= 0 | 1 | 2 | 3|
00001040  20 7c 20 34 20 7c 20 35  20 7c 20 36 20 7c 20 37  | | 4 | 5 | 6 | 7|
00001050  20 7c 20 38 20 7c 20 39  0a 48 65 78 64 69 67 69  | | 8 | 9.Hexdigi|
00001060  74 20 3a 3a 3d 20 61 20  7c 20 62 20 7c 20 63 20  |t ::= a | b | c |
00001070  7c 20 64 20 7c 20 65 20  7c 20 66 20 7c 20 3c 44  || d | e | f | <D|
00001080  69 67 69 74 3e 0a 43 68  61 72 61 63 74 65 72 20  |igit>.Character |
00001090  3a 3a 3d 20 3c 43 68 61  72 3e 20 7c 20 22 0a 53  |::= <Char> | ".S|
000010a0  74 72 69 6e 67 20 3a 3a  3d 20 3c 43 68 61 72 3e  |tring ::= <Char>|
000010b0  3c 53 74 72 69 6e 67 3e  0a 43 68 61 72 20 3a 3a  |<String>.Char ::|
000010c0  3d 20 41 6e 79 20 41 53  43 49 49 20 63 68 61 72  |= Any ASCII char|
000010d0  61 63 74 65 72 20 65 78  63 65 70 74 20 22 2c 20  |acter except ", |
000010e0  5c 20 6f 72 20 63 6f 6e  74 72 6f 6c 20 63 6f 64  |\ or control cod|
000010f0  65 73 20 7c 20 5c 6e 20  7c 20 5c 74 20 7c 20 5c  |es | \n | \t | \|
00001100  5c 0a 43 6e 61 6d 65 20  3a 3a 3d 20 3c 49 64 65  |\.Cname ::= <Ide|
00001110  6e 74 69 66 69 65 72 3e  0a 46 6e 61 6d 65 20 3a  |ntifier>.Fname :|
00001120  3a 3d 20 3c 49 64 65 6e  74 69 66 69 65 72 3e 0a  |:= <Identifier>.|
00001130  56 61 72 69 61 62 6c 65  20 3a 3a 3d 20 3c 49 64  |Variable ::= <Id|
00001140  65 6e 74 69 66 69 65 72  3e 0a 49 64 65 6e 74 69  |entifier>.Identi|
00001150  66 69 65 72 20 3a 3a 3d  20 3c 41 6c 70 68 61 3e  |fier ::= <Alpha>|
00001160  3c 41 6c 70 68 61 6e 75  6d 3e 0a 41 6c 70 68 61  |<Alphanum>.Alpha|
00001170  6e 75 6d 20 3a 3a 3d 20  3c 41 6c 70 68 61 3e 20  |num ::= <Alpha> |
00001180  7c 20 3c 44 69 67 69 74  3e 0a 41 6c 70 68 61 20  || <Digit>.Alpha |
00001190  3a 3a 3d 20 5b 41 2d 5a  5d 20 7c 20 5b 61 2d 7a  |::= [A-Z] | [a-z|
000011a0  5d 20 7c 20 5f 20 7c 20  40 20 7c 20 24 20 7c 20  |] | _ | @ | $ | |
000011b0  a3 20 7c 20 60 0a 0a 0a  54 68 65 20 64 69 66 66  |. | `...The diff|
000011c0  65 72 65 6e 63 65 73 20  66 72 6f 6d 20 43 20 61  |erences from C a|
000011d0  72 65 3a 0a 0a 20 20 4e  6f 20 74 79 70 65 20 64  |re:..  No type d|
000011e0  65 63 6c 61 72 61 74 69  6f 6e 73 20 69 6e 20 41  |eclarations in A|
000011f0  72 6d 62 6f 62 2e 20 55  73 65 20 63 6c 61 73 73  |rmbob. Use class|
00001200  65 73 20 69 6e 73 74 65  61 64 2e 0a 0a 20 20 54  |es instead...  T|
00001210  68 65 20 75 73 65 20 6f  66 20 76 65 63 74 6f 72  |he use of vector|
00001220  73 20 6f 72 20 6d 65 74  68 6f 64 73 20 69 6e 73  |s or methods ins|
00001230  74 65 61 64 20 6f 66 20  70 6f 69 6e 74 65 72 73  |tead of pointers|
00001240  2e 0a 0a 20 20 41 75 74  6f 6d 61 74 69 63 20 6d  |...  Automatic m|
00001250  65 6d 6f 72 79 20 61 6c  6c 6f 63 61 74 69 6f 6e  |emory allocation|
00001260  20 61 6e 64 20 67 61 72  62 61 67 65 20 63 6f 6c  | and garbage col|
00001270  6c 65 63 74 69 6f 6e 20  66 6f 72 20 73 74 72 69  |lection for stri|
00001280  6e 67 73 0a 20 20 61 6e  64 20 76 65 63 74 6f 72  |ngs.  and vector|
00001290  73 2e 0a 0a 20 20 54 68  65 20 27 69 6e 20 62 20  |s...  The 'in b |
000012a0  70 75 74 20 7b 20 78 31  3b 20 2e 2e 2e 20 78 6e  |put { x1; ... xn|
000012b0  3b 20 7d 27 20 73 74 72  75 63 74 75 72 65 2e 0a  |; }' structure..|
000012c0  0a 20 20 54 68 65 20 73  79 6e 6f 6e 79 6d 20 27  |.  The synonym '|
000012d0  72 65 70 65 61 74 27 20  66 6f 72 20 27 64 6f 27  |repeat' for 'do'|
000012e0  2e 0a 0a 20 20 54 68 65  20 75 73 65 20 6f 66 20  |...  The use of |
000012f0  27 6e 69 6c 27 20 61 73  20 77 65 6c 6c 20 61 73  |'nil' as well as|
00001300  20 7a 65 72 6f 20 61 73  20 61 20 63 6f 6e 64 69  | zero as a condi|
00001310  74 69 6f 6e 61 6c 2e 0a  0a 20 20 54 68 65 20 61  |tional...  The a|
00001320  62 73 65 6e 63 65 20 6f  66 20 63 6f 65 72 63 69  |bsence of coerci|
00001330  6f 6e 20 62 65 74 77 65  65 6e 20 69 6e 74 65 67  |on between integ|
00001340  65 72 20 61 6e 64 20 72  65 61 6c 20 6e 75 6d 62  |er and real numb|
00001350  65 72 73 20 69 6e 20 61  64 64 69 74 69 6f 6e 20  |ers in addition |
00001360  0a 20 20 61 6e 64 20 73  75 62 74 72 61 63 74 69  |.  and subtracti|
00001370  6f 6e 2e 20 0a 0a 20 20  41 6c 6c 20 64 61 74 61  |on. ..  All data|
00001380  74 79 70 65 73 20 61 72  65 20 66 69 72 73 74 2d  |types are first-|
00001390  63 6c 61 73 73 2e 20 46  6f 72 20 65 78 61 6d 70  |class. For examp|
000013a0  6c 65 2c 20 66 75 6e 63  74 69 6f 6e 73 20 61 6e  |le, functions an|
000013b0  64 20 69 6e 73 74 61 6e  63 65 0a 20 20 6f 62 6a  |d instance.  obj|
000013c0  65 63 74 73 20 63 61 6e  20 62 65 20 61 72 67 75  |ects can be argu|
000013d0  6d 65 6e 74 73 20 74 6f  20 66 75 6e 63 74 69 6f  |ments to functio|
000013e0  6e 73 20 6f 72 20 72 65  74 75 72 6e 65 64 20 62  |ns or returned b|
000013f0  79 20 66 75 6e 63 74 69  6f 6e 73 2e 0a 20 20 20  |y functions..   |
00001400  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00001420  20 20 20 20 20 20 20 20  20 0a 20 20 20 20 20 20  |         .      |
00001430  20 20 20 20 20 20 20 2d  2d 2d 2d 2d 2d 2d 2d 2d  |       ---------|
00001440  20 45 4e 44 20 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  | END -----------|
00001450