You are on page 1of 2

Quick Reference to ISETL Syntax

Syntax Rules Statements


; a semicolon and <enter> or a := expression;
<return> must follow any
statement. assigns the expression to variable a
! an exclamation point must expression;
precede directives. They must not
end with ; evaluate the expression
:= Variables may be assigned values.
read <list of variables>;
Data Types assign data entered from keyboard to the vari-
integer 2130 ables successively
floating point 3.5
7.5e-001 read <list of variables> from file id;
Boolean true / false
assign data from file, file id, to the variables
string "embedded in double
successively
quotes"
undefined OM /om print <list of expressions>;
tuple [2, true, 4.6]
set {7.5, false, "TOM", 6} evaluate the expressions successively print the
values line by line to the screen
Arithmetic Operators
Unary print <list of expressions> to file id;
+ positive evaluate the expressions successively write the
- negative values to the file
Binary
+ addition print <list of expression-format pairs>;
- subtraction
evaluate each expression, use the format to
* multiplication
determine how to display the value on the ter-
/ division
minal screen
** exponentiation
mod modular arithmetic writeln <list of expressions>;
Relational Operators evaluate the expressions successively write the
= equal values in a single line on the screen
/= not equal
< less than if <Boolean expression> then
<= less than or equal to <statements>;
> greater than elseif <Boolean expression> then
>= greater than or equal to <statements>;
else <statements>;
Tuple Operators end if;
+ concatenation
%+ sum elements of tuple Perform the statements following the first
Boolean expression which evaluates true, oth-
Set Operators erwise perform the statements after else. This
+ union is a conditional control statement.
* intersection
- difference for <variable> in <tuple> do
<statements>;
Boolean Operators end for;
and conjunction
or disjunction Assign each value in the tuple to the variable
not negation and perform the statements for each assign-
impl implication ment. This is a loop control statement.

1
Quick Reference to ISETL Syntax–cont.
Syntax of Funcs Type-Testers
is boolean(x); true if x is Boolean
func (<list of parameters>);
is floating(x); true if x is a floating
<statements>;
point number
end func;
is func(x); true if x is a func
The statements inside the func are executed is integer(x); true if x is an integer
as if they are a single process. A ‘return’ must is number(x); true if x is either an
be included in the statements. integer or a floating
return <expression>; point number
is om(x); true if x is undefined
evaluate the expression, the resulting value is is set(x); true if x is a set
the value returned by the func. This state- is tuple(x); true if x is a tuple
ment can only be used inside a func.

Predefined Funcs Input/Output


openr(<filename>);
Mathematical
abs(x) absolute value open the file named <filename> for reading,
ceil(x) smallest integer ≥ x return a file id value. If file does not exist,
even(x) true if x is even return OM.
exp(x) exponential function openw(<filename>);
fix(x) convert x to integer
open the file named <filename> for writing,
float(x) convert integer x to destroy any existing information , return a
floating point number file id value. If file does not exist, create it.
floor(x) largest integer ≤ x
ln(x) natural logarithm opena (<filename>);
log(x) common logarithm open the file named <filename> for writing,
do not destroy existing information, return a
max(x,y) max value file id value.
min(x,y) min value
odd(x) true if x is odd close(file id);
sgn(x) 1 if x > 0, 0 if x = 0,
−1 if x < 0 close the file corresponding to file id.
sqrt(x) square root

sin(x), cos(x), trigonometric


tan(x), sec(x), functions
csc(x), cot(x)
asin(x), acos(x), inverse trigonometric
atan(x) functions

sinh(x), cosh(x), hyperbolic


tanh(x) trigonometric
functions
asinh(x), inverse hyperbolic
acosh(x), atanh(x) functions

You might also like