Summary of TL

Adapted from Appendix A, Tonge, Fred M., Julian Feldman. Computing: An Introduction to Procedures and Procedure-Followers. McGraw-Hill Book Company, 1975. ISBN 0-07-064947-2.

What is TL?

TL is a language for describing procedures or algorithms. It is not intended for direct translation into machine code. The intent is to provide a common description of an algorithm or procedure that can then be translated by a programmer into his or her language of choice.

Structure

Data Types

Numerical
integers and mixed fractions
String
sequence of characters within quotation marks, initial index is 1
Logical
true or false
Variable names
any sequence of characters excluding punctuation marks and not a constant

Operators

The lower the number, the higher the precedence of the operator. Operator precedence may be altered using parentheses.

Symbol Meaning Precedence
# Length 10
@ Substring† 9
& Concatenation 8
Exponentiation 7
* Multiplication 6
/ Division 6
+ Addition 5
- Subtraction 5
not Not 4
= Equal 3
Not equal 3
> Greater than 3
Greater than or equal 3
< Less than 3
Less then or equal 3
and And 2
or Or 1

† May be of form (string)@(<number>) or (string)@(<number>,<number>). First number is offset, starting from 1, for the start of the substring. Second number is count of characters to use.

Statement Types

<assignment> ::==<variable>←<expression>
<read>::==read <variable>, <variable>,...
<write>::==write <expression>,<expression>,...
<conditional>::==if <logical> then <statement> else <statement> | if <logical> then <statement>
<to>::==to <statement-label>
<done>::==done
<repetition>::==<control clause> <statement>
<control clause>::==<until> | <for>
<until>::==until <logical>
<for>::==for <variable> ← <for-list>
<for-list>::==<for-element> | <for-element>, <for-list>
<for-element>::== <arith-expr> | <arith-expr> thru <arith-expr> | <arith-expr> thru <arith-expr> by <arith-expr>
<block-evocation>::==<statement-label> | <statement-label> (<argument-list>)
<local>::==local <variable-list>
<return>::==return <expression>
<comment>::=="(any string excluding quotation marks)"

Last updated: Mon, Sep 16, 2002