The below list is an attempt to describe Chomik as opposed to the existing imperative languages.
In order to assign a simple variable we need to apply the let instruction.
variable x:integer;
let variable x=value integer 123;
We can also omit the "variable" keyword after let and write:
variable x:integer;
let x=value integer 123;
Note that the assigned value is explicitly denoted as an integer value. The unary minus is supported.
When we want to assign a variable with a different variable value we can achieve this using the <> operator:
variable x:integer,y:integer;
let x=value integer 123;
let y=<x>;
Why the strange operator? <>? Isn't it enough to use the variable name? In Chomik we must use this operator to access the variable value. This may look like a drawback next to the programming languages like C/C++, Java, Python, or even Fortran. But this tendency of making the compilers too smart looks like an early optimization to us.
Identifiers are just names. Nothing more. But the literals are also names. We often overlook this fact. For most us 10 is the number ten. But in fact it is just a name of the number ten in the decimal system. Moreover, it's meaning is different in other systems. It is, for instance, a name of the number 2 in the binary system! If literals are just names why not allow using them as variable names? Chomik allows that.
variable something named by multiple identifiers and literals 1 "hallo" 3.14159: integer;
let something named by multiple identifiers and literals 1 "hallo" 3.14159=value integer 12345;
<print <something named by multiple identifiers and literals 1 "hallo" 3.14159>>;
We can freely mix the literals with the identifiers, or even have no identifiers at all!
variable 1 "hallo" 3.14159 5:integer;
let 1 "hallo" 3.14159 5=value integer 12345;
<print <1 "hallo" 3.14159 5>>;
This bizarre code will not print 1 "hallo" 3.14159 5, but 12345, because this is the value of the variable 1 "hallo" 3.14159 5.
Isn't it dangerous? A code that does something else that we would expect? It might be. But there is a huge benefit of it: we can use values of some variables to assign other variables. Just like pointers. But without all the burden of the pointers arithmetic. We can simply write:
variable "alpha":integer, "beta":float, gamma:string;
let "alpha"=value integer 12345;
let "beta"=value float 3.14159;
let gamma=value string "alpha";
<print <<gamma>>>;
let gamma=value string "beta";
<print <<gamma>>>;
The above snippet will print out:
12345 3.14159