1. SparkScript Docs
  1. Download
  1. You can download SparkScript on GitHub.
  2. The sourcecode is free and you can modify it how you want.
    Arithmetic Expressions
  1. You can use Arithmetic expressions mostly like in other languages. But of course I will list them here.
  2. The sign for Plus is a normal + so you can add numbers like this a + b
  3. Minus Works exactly like Plus so you can subtract numbers like this a - b
  4. You can multiply numbers like this a * b
  5. You can divide numbers like this a / b
  6. You can raise a number by a power like this a ^ b
  7. You can also calculate with parentesis like a * (b + c)
  1. Logical Operators
  1. First of it is to say that the number 1 represents True and the number 0 represents False.
  2. You can test if a number is equal another by writing a == b. If it is True, you will get 1 and if it is False you will get 0
  3. You can test if a number is not equal another by writing a != b. If it is True, you will get 1 and if it is False you will get 0
  4. You can test if a number is bigger or smaller than another by writing a < b or b > a. If it is True, you will get 1 and if it is False you will get 0
  1. Variables
  1. You can define a variable relatively simple like this.
  2. VAR a = b
    Strings
  1. Strings are basically the same as in most other languages. You are marking a String like in most other languages with quotation marks like this.
  2. "text"
  3. You can also initialize a new line with a \n like this
  4. "text \n text"
  1. Lists
  1. You can create Lists with square brackets like this. The elements a separated with commas.
  2. [elements]
  3. You can add an other element to the List like this.
  4. [elements] + element
  5. You can also combine two lists like this.
  6. [elements] * [elements]
  7. You can remove an element like this
  8. [elements] - elements_number(starts with 0)
  9. To get an element out of a List you can use / like this
  10. [elements] / elements_number(starts with 0)
  1. If-Statement
  1. An IF statement is structured like this.
  2. IF condition THEN expression
  3. You can also use the ELIF-Statement like this to get another condition and expression.
  4. IF condition THEN expression ELIF condition THEN expression
  5. You can also use the ELSE-Statement like this to get only another expression.
  6. IF condition THEN expression ELSE expression
  1. For and While-Statements
  1. A For-Statement is structured like this.
  2. FOR variable_name = start_value TO end_value THEN expression
  3. You can also implement a step into the For-Statement like this.
  4. FOR variable_name = start_value TO end_value STEP step_value THEN expression
  5. A While-Statement is simpler. It is structured like this
  6. WHILE condition THEN expression
  1. Functions
  1. A simple Function is structured like this.
  2. FUN function_name (arguments) -> combination_of_the_arguments
  3. You can call the Function then like this.
  4. function_name (arguments)
  5. You can give a Function an other name like this
  6. VAR other_function_name = functions_name
  7. and then call the Function with the other name
  8. other_function_name (arguments)
  9. You can also create anonymous Functions without names like this
  10. FUN (arguments) -> combination_of_the_arguments
  11. and assign these Functions some Variable like before
  12. function_name = FUN (arguments) -> combination_of_the_arguments
  13. and also call these like this.
  14. function_name (arguments)
  1. Build in Functions
  1. The Function PRINT prints out a given String or Integer in the Console like this.
  2. PRINT("text") or this PRINT(integer)
  3. The Function PRINT_RET will return the printed value.
  4. The Function INPUT takes String inputs and the Function INPUT_INT takes Integer inputs
  5. The Function CLEAR clears the console.
  6. The Functions IS_NUMBER, IS_STRING, IS_LIST, IS_FUNCTION are checking if some data is an Integer, a String, a List or a Function.
  7. The Function APPEND adds an element to a List, POP will remove an element from a List and Extend will combine two Lists together.
  8. You can return the length of a List with the Function LIST .
    Multi-Line-Statements
  1. If you have a Multi-Line-Statement like this.
  2. FUN name()
    expression1
    expression2
    expression3
  3. Then you have to end it like this
  4. FUN name()
    expression1
    expression2
    expression3
    END
  5. with the word END
  1. Return, Break, Continue-Statement
  1. The Return-Statement can be used like this to return a value of a Function.
  2. FUN function_name(arguments) return combination_of_the_arguments END
  3. You can use the Break-Statement inside a For-Loop like this to break out of the Loop with some condition.
  4. FOR variable_name = start_value TO end_value THEN IF condition THEN BREAK END END
  5. You can use the Continue-Statement like this to Continue-Statement so if there is some other condition you can continue.
  6. FOR variable_name = start_value TO end_value THEN IF condition THEN BREAK IF other_condition THEN CONTINUE END END
  1. Run-Statement
  1. You can use the Run-Statement like this to run a program which is written in SparkScript.
  2. RUN("path_to_program")
  1. Comments
  1. You can comment in your Script with putting a # before the comment.