Skip to content

Language Defenition

Lucas do Drip edited this page Nov 21, 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.
For multi line comments use /* and */.

Declaring Variables & Types

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

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

OS

ReadText (pathToFile) -> string # Reads all text from a given file
Time -> float # Return the Unix epoch

General

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

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.
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.

Known bugs

Here