-
Notifications
You must be signed in to change notification settings - Fork 0
Language Defenition
No parenthesis are needed for the logic but a block is. This applies for the following keywords
- if
- while
- until # same as while but with the logic reversed
Use # for single line comments.
For multi line comments use /* and */.
The language is dynamic so no need for inferring types and no need for declaration keywords. There are currently 5 types.
myInt = 69; # int
myStr = "lorem ipsum"; # string you can also use ''
myFloat = 420.666; # float
myArr = [69, "lorem ipsum", 420.666]; # the values inside of an array can be of any type
myDict = {"name": "Obama", "age": 69, "height": 1.79} # the keys must be string and the values can be of any type
It's as simple as putting the name of the function and passing the arguments separated by a comma.
Example:
myFunction(arg1, arg2)
.
Functions won't always return a value.
Declaring a functions is currently impossible 😞.
Still have no idea how to do that!
There isn't a lot yet
Global functions and variables:
PI -> float # returns PI
Sqrt (num) -> float
Pow (num, raiseNum) -> float
Write (*args) -> null # Writes to stdout
WriteLine (*args) -> null # Writes to stdout with a "\n"
ReadLine (inputStr) -> string # Prompts the user for input in stdin
Sum (arr) -> float # Return the sum of a given array
Add (arr, value) -> null # Appends a given value to a given array
Remove (arr, index) -> null # Removes a element from a given array with a given index
Split (arr, seperator) -> array # Splits a string into an array
Len (arr | string) -> int # Return the length of a string or array
ReadText (pathToFile) -> string # Reads all text from a given file
Time -> float # Return the Unix epoch
Convert (variable, typeAsString) -> variable # converts a variable to a given type
Delay (mills) -> null # Delays the execution of the program by any given time in milliseconds
CritVersion -> string # Returns the version of the language
Type (variable) -> # Returns the type of a given variable
All "normal" operators are supported.
'*' | '/' | '%' | '+' | '-'
'=' | '*=' | '/=' | '%=' | '+=' | '-='
'==' | '!=' | '<' | '>' | '<=' | '>='
'and' | 'or'
Array indexing works as expected: myArray[0]
will get the first element of the array.
If you try to assign a value to an element that does not exist in the array the value will be appended to the given array.
You can add things to a string and it will concatenate the string.
You can put an else
block after a while
or until
block. That else
block will only run if the initial loop condition isn't met.