Agol 60 Versions of Syntax

 
This is a parallel listing of syntax dexcription from ALGOL 60 as defined in the Revised Report on the Algorithmic Language Algol 60 (1963) and the Modified Report on the Algorithmic Language Algol 60 (1976).

Any deviances are marked in red type. (Syntax numbers are given according to the numbers of main definition; e.g. "3.1 Variables / 3.1.1 Syntax" is to be found under "3.1 Variables".)

Deviating syntax descriptions are to be found in the following definitions:

 

The syntax of Algol 60 according to the Revised Report and the Modified Report:

 

     

Revised Report on the Algorithmic Language Algol 60

Modified Report on the Algorithmic Language Algol 60

2. Basic Symbols
     
<basic symbol> ::= <letter> | <digit> |
         <logical value> | <delimiter>
<basic symbol> ::= <letter> | <digit> |
         <logical value> | <delimiter>
2.1. Letters
     
<letter> ::= a | b | c | d | e | f | g | h | i | j | k | l |
        m | n | o | p | q | r | s | t | u | v | w | x | y | z | A |
        B | C | D | E | F | G | H | I | J | K | L | M | N | O | P |
        Q | R | S | T | U | V | W | X | Y | Z
<letter> ::= a | b | c | d | e | f | g | h | i | j | k | l |
        m | n | o | p | q | r | s | t | u | v | w | x | y | z | A |
        B | C | D | E | F | G | H | I | J | K | L | M | N | O | P |
        Q | R | S | T | U | V | W | X | Y | Z
2.2.1 Digits
     
<digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 
<digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 
2.2.2 Logical values
     
<logical value> ::= true | false
<logical value> ::= true | false
2.3. Delimiters

!

<delimiter> ::= <operator> | <separator> | <bracket> |
        <declarator> | <specificator>

<operator> ::= <arithmetic operator> | <relational operator> |
        <logical operator> | <sequential operator>

<arithmetic operator> ::= + | - | TIMES | / | ÷ | POWER

<relational operator> ::= < | NOTGREATER | = | NOTLESS | > | NOTEQUAL

<logical operator> ::= EQUIVALENCE | IMPLICATION | OR | AND | ¬

<sequential operator> ::= goto | if | then |
        else | for | do (2)

<separator> ::= , | . | 10 | : | ; | := | BLANK | step |
        until | while | comment

<bracket> ::= ( | ) | [ | ] | ` | ' | begin | end

<declarator> ::= own | Boolean | integer |
        real | array | switch |
        procedure

<specificator> ::= string | label |
        value
<delimiter> ::= <operator> | <separator> | <bracket> | <declarator> | <specificator>

<operator> ::= <arithmetic operator> | <relational operator> | <logical operator> |
               <sequential operator>

<arithmetic operator> ::= + | - | TIMES | / | ÷ | POWER

<relational operator> ::= < | NOTGREATER | = | NOTLESS | > | NOTEQUAL

<logical operator> ::= EQUIVALENT | IMPLIES | OR | AND | ¬

<sequential operator> ::= go to | if | then | else | for | do

<separator> ::= , | . | 10 | : | ; | := | BLANK | step | until | while | comment

<bracket> ::= ( | ) | [ | ] | ` | ' | begin | end

<declarator> ::= own | Boolean | integer | real | array | switch | procedure

<specificator> ::= string | label | value
2.4. Identifiers
     
<identifier> ::= letter> | <identifier>
        <letter> | <identifier> <digit>
<identifier> ::= letter> | <identifier>  <letter> | <identifier> <digit>
2.5. Numbers
     
<unsigned integer> ::= <digit> | <unsigned integer>
         <digit>

<integer> ::= <unsigned integer> | + <unsigned integer> |
        - <unsigned integer>

<decimal fraction> ::= . <unsigned integer>

<exponential part> ::= 10 <integer>

<decimal number> ::= <unsigned integer> | <decimal fraction> | 
        <unsigned integer> <decimal fraction>

<unsigned number> ::= <decimal number> | <exponential part> |
        <decimal number> <exponential part>

<number> ::= <unsigned number> | + <unsigned number> |
        - <unsigned number>
<unsigned integer> ::= <digit> | <unsigned integer> <digit>

<integer> ::= <unsigned integer> | + <unsigned integer> | - <unsigned integer>

<decimal fraction> ::= . <unsigned integer>

<exponential part> ::= 10 <integer>

<decimal number> ::= <unsigned integer> | <decimal fraction> | 
        <unsigned integer> <decimal fraction>

<unsigned number> ::= <decimal number> | <exponential part> |
        <decimal number> <exponential part>

<number> ::= <unsigned number> | + <unsigned number> | - <unsigned number>
2.6. Strings

!

<proper string> ::=
        <any sequence of symbols not containing ` or ' > 
        | <empty>

<open string> ::= <proper string> `<open string>' |
        <open string><open string>

<string> ::= `<open string>'
<proper string> ::= <any sequence of characters not containing ` or ' > | <empty>

<open string> ::= <proper string> | <proper string> <closed string> <open string>

<closed string> ::= `<open string>'

<string> ::= <closed string> | <closed string> <string>
3. Expressions
     
<expression> ::= <arithmetic expression> |
        <Boolean expression> | <designational expression>
<expression> ::= <arithmetic expression> |
        <Boolean expression> | <designational expression>
3.1. Variables
     
<variable identifier> ::= <identifier>

<simple variable> ::= <variable identifier>

<subscript expression> ::= <arithmetic expression>

<subscript list> ::= <subscript expression> |
        <subscript list> , <subscript expression>

<array identifier> ::= <identifier>

<subscripted value> ::= <array identifier>
        [ <subscripted list> ]

<variable> ::= <simple variable> | <subscripted variable>
<variable identifier> ::= <identifier>

<simple variable> ::= <variable identifier>

<subscript expression> ::= <arithmetic expression>

<subscript list> ::= <subscript expression> |
        <subscript list> , <subscript expression>

<array identifier> ::= <identifier>

<subscripted value> ::= <array identifier>[<subscripted list>]

<variable> ::= <simple variable> | <subscripted variable>
3.2. Function designators
     
<procedure identifier> ::= <identifier>

<actual parameter> ::= <string> | <expression> |
        <array identifier> | <switch identifier> |
        <procedure identifier>

<letter string> ::= <letter> | <letter string> <letter>

<parameter delimiter> ::= , | ) <letter string> : (

<actual parameter list> ::= <actual parameter> |
        <actual parameter list> <parameter delimiter>
        <actual parameter>

<actual parameter part> ::= <empty> |
        ( <actual parameter list> )

<function designator> ::= <procedure identifier>
        <actual parameter part>
<procedure identifier> ::= <identifier>

<actual parameter> ::= <string> | <expression> |
        <array identifier> | <switch identifier> | <procedure identifier>

<letter string> ::= <letter> | <letter string> <letter>

<parameter delimiter> ::= , | ) <letter string> : (

<actual parameter list> ::= <actual parameter> |
        <actual parameter list> <parameter delimiter> <actual parameter>

<actual parameter part> ::= <empty> | ( <actual parameter list> )

<function designator> ::= <procedure identifier> <actual parameter part>
3.3. Arithmetic expressions
     
<adding operator> ::= + | -

<multiplying operator> ::= TIMES | / | ÷

<primary> ::= <unsigned number> | <variable> |
        <function designator> | ( <arithmetic expression> )

<factor> ::= <primary> | <factor> |
        <factor> POWER <primary>

<term> ::= <factor> | <term> <multiplying operator>
        <factor>

<simple arithmetic expression> ::= <term> | 
        <adding operator> <term> |
        <simple arithmetic expression> <adding operator>
        <term>

<if clause> ::= if <Boolean expression> then

<arithmetic expression> ::= <simple arithmetic expression> |
        <if clause> <simple arithmetic expression>
        else <arithmetic expression>
<adding operator> ::= + | -

<multiplying operator> ::= TIMES | / | ÷

<primary> ::= <unsigned number> | <variable> |
        <function designator> | ( <arithmetic expression> )

<factor> ::= <primary> | <factor> POWER <primary>

<term> ::= <factor> | <term> <multiplying operator> <factor>

<simple arithmetic expression> ::= <term> | 
        <adding operator> <term> |
        <simple arithmetic expression> <adding operator> <term>

<if clause> ::= if <Boolean expression> then

<arithmetic expression> ::= <simple arithmetic expression> |
        <if clause> <simple arithmetic expression>
        else <arithmetic expression>
3.4. Boolean expressions
     
<relational operator> ::= < | NOTGREATER | = | NOTLESS | > | NOTEQUAL

<relation> ::= <simple arithmetic expression> 
        <relational operator> <simple arithmetic expression>

<Boolean primary> ::= <logical value> | <variable> |
        <function designator> | <relation> |
        ( <Boolean expression> )

<Boolean secondary> ::= <Boolean primary> |
        ¬ <Boolean primary>

<Boolean factor> ::= <Boolean secondary> |
        <Boolean factor> AND <Boolean secondary>

<Boolean term> ::= <Boolean factor> |
        <Boolean term> OR <Boolean factor>

<implication> ::= <Boolean term> |
        <implication> IMPLICATION <Boolean term>

<simple Boolean> ::= <implication> | <simple Boolean>
        EQUIVALENCE <implication>

<Boolean expression> ::= <simple Boolean> | <if clause>
        <simple Boolean> else <Boolean expression>
<relational operator> ::= < | NOTGREATER | = | NOTLESS | > | NOTEQUAL

<relation> ::= <simple arithmetic expression> 
        <relational operator> <simple arithmetic expression>

<Boolean primary> ::= <logical value> | <variable> |
        <function designator> | <relation> | ( <Boolean expression> )

<Boolean secondary> ::= <Boolean primary> |
        ¬ <Boolean primary>

<Boolean factor> ::= <Boolean secondary> |
        <Boolean factor> AND <Boolean secondary>

<Boolean term> ::= <Boolean factor> |
        <Boolean term> OR <Boolean factor>

<implication> ::= <Boolean term> |
        <implication> IMPLIES <Boolean term>

<simple Boolean> ::= <implication> | <simple Boolean>
        EQUIVALENT <implication>

<Boolean expression> ::= <simple Boolean> | <if clause>
        <simple Boolean> else <Boolean expression>
3.5. Designational expressions
     
<label> ::= <identifier> | <unsigned integer>

<switch identifier> ::= <identifier>

<switch designator> ::= <switch identifier>
        [<subscript expression>]

<simple designational expression> ::= <label> |
        <switch designator> | (<designational expression>)

<designational expression> ::= <simple designational expression> |
        <if clause> <simple designational expression>
        else <designational expression>
<label> ::= <identifier> | <unsigned integer>

<switch identifier> ::= <identifier>

<switch designator> ::= <switch identifier>[<subscript expression>]

<simple designational expression> ::= <label> |
        <switch designator> | (<designational expression>)

<designational expression> ::= <simple designational expression> |
        <if clause> <simple designational expression>
        else <designational expression>
4.1. Compound statements and blocks
     
<unlabelled basic statement> ::= <assignment statement> |
        <go to statement> | <dummy statement> |
        <procedure statement>

<basic statement> ::= <unlabelled basic statement> |
        <label>: <basic statement>

<unconditional statement> ::= <basic statement> |
        <compound statement> | <block>

<statement> ::= <unconditional statement> |
        <conditional statement> | <for statement>

<compound tail> ::= <statement> end |
        <statement> ; <compound tail>

<block head> ::= begin <declaration> |
        <block head> ; <declaration>

<unlabelled block> ::= <block head> ; <compound tail>

<unlabelled compound> ::= begin <compound tail>

<compound statement> ::= <unlabelled compound> |
        <label>: <compound statement>

<block> ::= <unlabelled block> | <label>: <block>

<program> ::= <block> | <compound statement>
<unlabelled basic statement> ::= <assignment statement> |
        <go to statement> | <dummy statement> | <procedure statement>

<basic statement> ::= <unlabelled basic statement> |
        <label>: <basic statement>

<unconditional statement> ::= <basic statement> |
        <compound statement> | <block>

<statement> ::= <unconditional statement> |
        <conditional statement> | <for statement>

<compound tail> ::= <statement> end |
        <statement> ; <compound tail>

<block head> ::= begin <declaration> |
        <block head> ; <declaration>

<unlabelled compound> ::= begin <compound tail>

<unlabelled block> ::= <block head> ; <compound tail>

<compound statement> ::= <unlabelled compound> |
        <label>: <compound statement>

<block> ::= <unlabelled block> | <label>: <block>

<program> ::= <block> | <compound statement>
4.2. Assignment statements

!

<left part> ::= <variable> := | <procedure identifier> :=

<left part list> ::= <left part> | <left part list> 
        <left part>

<assignment statement> ::= <left part list>
        <arithmetic expression> | <left part list>
        <Boolean expression>
<destination> ::= <variable> | <procedure identifier>

<left part> ::= <destination> :=

<left part list> ::= <left part> | <left part list> <left part>

<assignment statement> ::= <left part list> <arithmetic expression> |
        <left part list> <Boolean expression>
4.3. Go to statements

!

<go to statement> ::= goto <designational expression>
<go to statement> ::= go to <designational expression>
4.4. Dummy statements
     
<dummy statement> ::= <empty>
<dummy statement> ::= <empty>
4.5. Conditional statements
     
<if clause> ::= if <Boolean expression> then

<unconditional statement> ::= <basic statement> |
        <compound statement> | <block>

<if statement> ::= <if clause> <unconditional statement>

<conditional statement> ::= <if statement> |
        <if statement> else <statement> |
        <if clause> <for statement> |
        <label>: <conditional statement>
<if clause> ::= if <Boolean expression> then

<unconditional statement> ::= <basic statement> |
        <compound statement> | <block>

<if statement> ::= <if clause> <unconditional statement>

<conditional statement> ::= <if statement> |
        <if statement> else <statement> |
        <if clause> <for statement> |
        <block>: <conditional statement>
4.6. For statements
     
<for list element> ::= <arithmetic expression> | 
        <arithmetic expression> step <arithmetic expression>
        until <arithmetic expression> |
        <arithmetic expression> while <Boolean expression>

<for list> ::= <for list element> | <for list> ,
        <for list element>

<for clause> ::= for <variable> := <for list> do

<for statement> ::= <for clause> <statement> |
        <label>: <for statement>
<for list element> ::= <arithmetic expression> | 
        <arithmetic expression> step <arithmetic expression>
        until <arithmetic expression> |
        <arithmetic expression> while <Boolean expression>

<for list> ::= <for list element> | <for list> ,
        <for list element>

<for clause> ::= for <variable> := <for list> do

<for statement> ::= <for clause> <statement> |
        <label>: <for statement>
4.7. Procedure statements
     
<actual parameter> ::= <string> | <expression> |
        <array identifier> | <switch identifier> |
        <procedure identifier>

<letter string> ::= <letter> | <letter string> <letter>

<parameter delimiter> ::= , | ) <letter string> : (

<actual parameter list> ::= <actual parameter> |
        <actual parameter list> <parameter delimiter>
        <actual parameter>

<actual parameter part> ::= <empty> | ( <actual parameter list> )

<procedure statement> ::= <procedure identifier>
        <actual parameter part>
<actual parameter> ::= <string> | <expression> |
        <array identifier> | <switch identifier> | <procedure identifier>

<letter string> ::= <letter> | <letter string> <letter>

<parameter delimiter> ::= , | ) <letter string> : (

<actual parameter list> ::= <actual parameter> |
        <actual parameter list> <parameter delimiter> <actual parameter>

<actual parameter part> ::= <empty> | ( <actual parameter list> )

<procedure statement> ::= <procedure identifier> <actual parameter part>
5. Declarations
     
<declaration> ::= <type declaration> | <array declaration> |
        <switch declaration> | <procedure declaration>
<declaration> ::= <type declaration> | <array declaration> |
        <switch declaration> | <procedure declaration>
5.1. Type declarations

!

<type list> ::= <simple variable> | <simple variable> , <type list>

<type> ::= real | integer | Boolean

<local or own type> ::= <type> | own <type>

<type declaration> ::= <local or own type> <type list>
<type list> ::= <simple variable> | <simple variable> , <type list>

<type> ::= real | integer | Boolean

<local or own> ::= <empty> | own

<type declaration> ::= <local or own> <type> <type list>
5.2. Array declarations

!

<lower bound> ::= <arithmetic expression>

<upper bound> ::= <arithmetic expression>

<bound pair> ::= <lower bound> : <upper bound>

<bound pair list> ::= <bound pair> |
        <bound pair list> , <bound pair>

<array segment> ::= <array identifier> [ <bound pair list> ] |
        <array identifier> , <array segment>

<array list> ::= <array segment> | <array list> ,
        <array segment>

<array declaration> ::= array <array list> |
        <local or own type> array <array list>
<lower bound> ::= <arithmetic expression>

<upper bound> ::= <arithmetic expression>

<bound pair> ::= <lower bound> : <upper bound>

<bound pair list> ::= <bound pair> |
        <bound pair list> , <bound pair>

<array segment> ::= <array identifier> [ <bound pair list> ] |
        <array identifier> , <array segment>

<array list> ::= <array segment> |
        <array list> , <array segment>

<array declarer> ::= <type> array | array

<array declaration> ::= <local or own> <array declarer> <array list>
5.3. Switch declarations
     
<switch list> ::= <designational expression> |
        <switch list> , <designational expression>

<switch declaration> ::= switch <switch identifier>
        := <switch list>
<switch list> ::= <designational expression> |
        <switch list> , <designational expression>

<switch declaration> ::= switch <switch identifier> := <switch list>
5.4. Procedure declarations

!

<formal parameter> ::= <identifier> 

<formal parameter list> ::= <formal parameter> |
        <formal parameter list> <parameter delimiter>
        <formal parameter>

<formal parameter part> ::= <empty> | ( <formal parameter list> )

<identifier list> ::= <identifier> |
        <identifier list> , <identifier>

<value part> ::= value <identifier list> ; |
        <empty>

<specifier> ::= string | <type> | array |
        <type> array | label | switch |
        procedure | <type> procedure

<specification part> ::= <empty> | <specifier> <identifier list> ; |
        <specification part> <specifier> <identifier list>

<procedure heading> ::= <procedure identifier> <formal parameter part> ;
        <value part> <specification part>

<procedure body> ::= <statement> | <code>

<procedure declaration> ::= procedure <procedure heading>
        <procedure body> | <type> procedure
        <procedure heading> <procedure body>
<formal parameter> ::= <identifier> 

<formal parameter list> ::= <formal parameter> |
        <formal parameter list> <parameter delimiter> <formal parameter>

<formal parameter part> ::= <empty> | ( <formal parameter list> )

<identifier list> ::= <identifier> |
        <identifier list> , <identifier>

<value part> ::= value <identifier list> ; | <empty>

<specifier> ::= string | <type> | <array declarer> |
       label | switch | procedure | <type> procedure

<specification part> ::= <empty> | <specifier> <identifier list> ; |
        <specification part> <specifier> <identifier list>

<procedure heading> ::= <procedure identifier> <formal parameter part> ;
        <value part> <specification part>

<procedure body> ::= <statement> | <code>

<procedure declaration> ::= procedure <procedure heading> <procedure body> |
        <type> procedure <procedure heading> <procedure body>

 

List of symbols and their representation:

[BLANK] A blank. Printed like a half box.
[10] The ten for the exponent in a real-type number. Printed as a small lowered ten.
[POWER] The power operator: an uparrow.
[TIMES] The times sign: a cross like an x.
[÷] The integer division operator: a - with a dot above and below.
[<] Simple: less than.
[NOTGREATER] Simple: less or equal.
[=] Simple: equal.
[NOTLESS] Simple: greater or equal.
[>] Simple: greater than.
[NOTEQUAL] Simple: not equal.
[EQUIVALENCE] Simple: logical equivalence.
[IMPLICATION] Simple: logical implication.
[OR] Simple: logical or.
[AND] Simple: logical and.
[¬] Simple: logical not.

 

Compiled by N. Landsteiner (n.landsteiner@masswerk.at) 2002.

 
Other AGOL 60 related documents to be found on this site:

 


mass:werk - media environments