chomik.tech

The below list is an attempt to describe Chomik as opposed to the existing imperative languages.

  1. Builtin types

    There are only four builtin types in Chomik:
    • integer
    • float
    • string
    • code
    That's it! There is also a builtin enumeration called "boolean", which can be treated as a type. We do not have user defined types. In fact we use the keyword "type" to define enumerations.
  2. Code is not treated in a special way

    The concepts like the "encapsulation" known from the Object Oriented Programming paradigm have no place in Chomik. Code is just data. With the small difference that it can be executed.
  3. Assigning the variables with values

    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.

  4. Triangular brackets - the evaluation operator

    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.

  5. Unified and complex variable names

    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
    

  6. There are no pointers!

    There are no pointers in Chomik. So far there was no need for them. Instead we can have complex "name expressions", like <alpha <beta <gamma>>>. They can be used to build up a name of a variable using other variables' values.