StormScript
Jump to navigation
Jump to search
- Not to be confused with StormLang.
- This is still a work in progress. It may be changed in the future.
- This language may change directly to another in a sudden.
Intro
== Data types Number: Fractions. 0/0 is NaN and 1/0 is infinity. Byte: 8 bits of information. Usually written as a character. List: A list of objects. List of bytes are strings. None: Just that in Python. Type: A type. Can be None, Number, Byte, List, or Type. == Syntax Use spaces to separate different things. Code block: Enclosed in {braces}. Can be executed. Variables: Directly write its name as an expression will return its value. Functions: Directly write its name will call it. It has a fixed number of arguments. Identifier: Can contain any character that is not a predefined function but it cannot contain digits. == Constants \N = Number, \B = Byte, \L = List, \T = Type, \N = None \n = NaN, \i = infinity Lists are enclosed in (parentheses). == Booleans? Positive values are truthy. infinity is Truthy. 0, NaN and negative values are falsy. Empty list is falsy, None is falsy, 0b00000000 is falsy, other things are truthy. == Type conversions == Number turn into list by range (e.g. 5 -> (1 2 3 4 5)) Number turn into byte by mod 256 (257 -> 0b00000001) List turn into number by length (e.g. (a b c) -> 3)
== Command lists
<id>
means an identifier, <expr>
means an expression, and <blk>
means a code block.
== Keywords #<name:id><expr> | Assign expr to the variable. !<name:id><arg1:id><arg2:id><...><blk> | Define a function. == Control flow ~<expr><id><blk> | For each item in A, assign it to the variable, and execute block. *<blk/expr><blk> | While the first value is truthy, executes the second block. ?<expr><expr/blk><expr/blk> | If the first value is truthy, returns/executes the second, else returns/executes the third. & | Break from a loop. == Calculations ><expr><expr> | Converts the first value to the second (type).