Skip to content

Latest commit

 

History

History
205 lines (187 loc) · 5.66 KB

docs.org

File metadata and controls

205 lines (187 loc) · 5.66 KB

ilang Documentaiton

1 Overview

1.1 What is ilang

ilang is designed to be a new type of programming lanuage that supports different types of programming paradimes with a focus towards artificial inteligence

1.2 Arguments to process

-h this help document -f [file] the start file -v # debug level –version dispay version -d set location of database files

1.3 Major ideas

In a typical programming lanuage, nearly everything created has a name given to it, for example consider the following C++ code:

class Name {
};

In this code, the class is created under the name Name.

In ilang, the consepts are vastly different, class, objects, function, anything is created without a name. The name/scope system is mearly provided to give a programmer a means of accessing something that was created else where. In this since everything can be considered to be name-less and assigned to variables which function as pointers.

// Points_to_a_class points to a class, a new class can be created by using this class Pointer
Points_to_a_class = class {

};

// something would be an instance of an anonymous class
// NOTE: running this multiple times would create a new instance of the anonymouse class and then create the object based off that new class
//       The reason for this is because everytime that this is called, it _might_ depend on some local variables that have changed value
something = new(class {

});

2 Lanuage specifications

2.1 Functions

2.1.1 Basic syntax

Function_name = {
   // function body
};

2.1.2 Arguments

Function_name = {|argument1, argument2|
    // funciton body
};

2.1.3 Type checking

See Type system for more information

Function_name = {|Int int_type, String string_type|
    // int_type will throw an error if the argument is not of type int, same with String

    // Return types are not checked/defined inside the function
    return string_type + "something more";
};

main = {
    String some_var = Function_name(0, "aaa");
    // the system will check that the value of some_var is set to a String, so if the function returns anything else it will be an error
};

2.2 Type system

The type system is by default typeless allowing for any type like more standard scripting lanuages. The system uses type ‘qualifiers’ to performe special actions on the variables. Type qualifiers range from anything to Checking the type of variable to saving data into a persistent database.

2.2.1 Type Less

Variable_name = 1;

By defualt types are not enfored in the system

2.2.2 Type Checking

Int int_name = 1;
String String_name = "Something";
Float fLoAt_NaMe = .43;
Class Class_type = class {};
Object Object_type = object {};
Array Array_type = [];
Function Function_type = {};

A type can be specified before then name of the variable.

2.2.3 Special types

2.2.3.1 Const

Const Int int_name = 1;

The Const type means that a variable can only be set once. Note: The syntax of the lanuage does not allow for variables to be created without having a value set as a default

Function_name = {|Const variable|
};

The variable argument can not be modified inside the body of the function. Note: Classes and objects are passed as pointers and thus their internals can be modified even if it is Const

2.2.3.2 Database/Db

Db Int counter = 0;

More information is inside the Database

Database variables are saved into a seperate database file in the current directory, these variables are recalled when the program is relaunched

2.3 Classes

Class_name = class {

};

2.3.1 Basic members

Class_name = class {
    member_name: default_value,
    second_member_name: another_value
};

2.3.2 inheritance

From_class = class {

};

Class_name = class (From_class) {

};

2.4 Objects

Object_name = object {

};

2.5 Array

3 Base Libraries

3.1 Database

<<Database root>>

3.2 Modification

3.3 Import

4 Included Libraries

4.1 Curl

5 C++ interface

5.1 ILANG_LIBRARY_NAME

5.2 ILANG_FUNCTION

5.3 ILANG_CLASS

5.4 Advance Raw accessing Object

6 Example Code

6.1 Hello World

main = {
  Print("Hello world");
};

6.2 Loops

main = {
   for(a = 0; a < 10; a = a + 1) {
      Print("the loop\n");
   }
};

6.3 Inherit Class

Class animal = class {
   say_what: {
      return "default say thing";
   },
   say: {
      Print("The animal says: ", say_what(), "\n");
   }
};

Class cow = class (animal) {
   say_what: {
      return "Mooo";
   }
};

Class cat = class (animal) {
   say_what: {
      return "Mow";
   }
};

main = {
   Cat = new(cat);
   Cow = new(cow);

   Cat.say();
   Cow.say();
};