Skip to the content.

Source

    
  ______  _____   ______  
 |   ___||     | |   ___| 
  `-.`-. |     \ |   |__  
 |______||__|\__\|______|

Weclome to Source Lang 0.0.1 [rlxos GNU/Linux]

  * Documentation: https://docs.rlxos.dev/src
  * Support:       https://community.rlxos.dev/src

 type '.exit' to exit and '.symbols' to view all defined symbols

Source is a Simple and easy to learn dynamically typed scripting programming language.

Concept

Source is a single line is “data and its flow”.

Data

Data in source is defined as a block of information with a name given to it.

Supported data blocks

Block Type Type Id Description Example
Integer int Signed Integer value in range −2,147,483,647 -> +2,147,483,647 x := 10;
Floating float Floating point value in range 1.7E-308 to 1.7E+308 x := 10.0
String string Mutable string buffer x := "Hello World";
Array array Mutable array of source data blocks x := [1, 2.0, false, ["hello"]];
Dictionary dict Mutable hash map of string and source data blocks x := {"hello": "world"};
Function closure List of flows packed in a data block x := func (a, b) { ret a + b; }

Flow

Statements to manipulate the data blocks

Conditions

Branch the current flow on the basis of conditions

Example

x := 5;
if x > 5 {
  println("bigger than 5");
} else if x < 5 {
  println("smaller than 5");
} else {
  println("equal to 5");
}

Loops

Repeat the specific flow until the condition is satisified

Example

x := 0;
for x < 10 {
  x = x + 1;
}

Example

for i in [10, 20, 30, 40] {
  println(i);
}