Skip to content

Language Defenition

Lucas do Drip edited this page Jul 5, 2022 · 7 revisions

Keywords (3)

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

Comments

Use # for single line comments. Multi line comments are coming soon.

Declaring Variables & Types

The language is dynamic so no need for inferring types and no need for declaration keywords. There are currently 4 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

Functions Calls

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.

Functions Declaration

Declaring a functions is currently impossible 😞
Still have no idea how to do that!

Standard Library

There isn't a lot yet 🥲 Global functions and variables:

Math

PI -> float # returns PI
Sqrt (num) -> float
Pow (num, raiseNum) -> float

Console

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

Array

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

OS

ReadText (pathToFile) -> string # reads all text from a given file

Gerenal

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
Split (arr, seperator) -> array # Splits a string into an array
Len (arr | string) -> int # Return the length of a string or array

Operators

All "normal" operators are supported.

Arithmetic

'*' | '/' | '%' | '+' | '-'

Assignment

'=' | '*=' | '/=' | '%=' | '+=' | '-='

Compare

'==' | '!=' | '<' | '>' | '<=' | '>='

Boolean

'and' | 'or'

Things to know!

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.

Known bugs

Sometimes for some reason semicolon are not needed.
Big numbers might get truncated / broken.

Clone this wiki locally