[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The syntax of Asir is based on C language. Main differences are as follows. In this section, a variable does not mean an indeterminate, but a program variable which is written by a string which begins with a capital alphabetical letter in Asir.
[0] A = 1; 1 [1] type(A); 1 [2] A = [1,2,3]; [1,2,3] [3] type(A); 4
extern
.
Thus, the scope rule of Asir is very simple.
There are only two types of variables: global variables and local
variables.
A name that is input to the Asir’s prompt at the top level
is denotes a global variable commonly accessed at the top level.
In a function (procedure) the following rules are applied.
extern
statement in
a function, the variable used in that function denotes a global variable
at the top level.
Furthermore, if a variable in a function is preceded by an extern
declaration outside the function but in a file where the function is
defined, all the appearance of that variable in the same file denote
commonly a global variable at the top level.
extern
declaration.
% cat afo def afo() { return A;} extern A$ def bfo() { return A;} end$ % asir [0] load("afo")$ [5] A = 1; 1 [6] afo(); 0 [7] bfo(); 1
This is an unique point that differs from almost all other existing computer algebra systems. The distinction between program variables and indeterminates is adopted to avoid the possible and usual confusion that may arise in a situation where a name is used as an indeterminate but, as it was, the name has been already assigned some value. To use different type of letters, capital and small, was a matter of syntactical convention like Prolog, but it is convenient to distinguish variables and indeterminates in a program.
switch
statements, and goto
statements.
goto
statement makes it rather bothering to exit from within multiple loops.
A
, B
and C
of the constructs for (A;B;C)
or while(A)
.
The above are limitations; extensions are listed as follows.
Lists are conveniently used to represent a certain collection of objects. Use of lists enables to write programs more easily, shorter and more comprehensible than use of structure like C programs.
See section option.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] |
This document was generated on December 22, 2024 using texi2html 5.0.