aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/std.md54
-rw-r--r--doc/syntax.md6
2 files changed, 30 insertions, 30 deletions
diff --git a/doc/std.md b/doc/std.md
index 2e7720b..681abda 100644
--- a/doc/std.md
+++ b/doc/std.md
@@ -1,42 +1,42 @@
# Standard library
-## The `:bool` module
+## The `bool` module
-- `:bool:if`: Requires exactly 3 arguments of arbitrary type. If $0 is a truthy value, evaluate and return $1. If $0 is a falsy value, evaluate and return $2. Values considered as falsy are: `:bool:false` and `:nil:nil`. Everything else is considered truthy.
-- `:bool:and`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `:bool:true` if all of the arguments are considered truthy.
-- `:bool:or`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `:bool:true` if at least one of the arguments is considered truthy.
-- `:bool:equal`: Accepts an arbitrary number of arguments of arbitrary type, but at least 2. Returns `bool:true` if either all of the arguments are considered truthy or all of the arguments are considered falsy.
-- `:bool:not`: Accepts exactly one argument of arbitrary type. Returns `:bool:true` if the $0 is considered falsy, returns `:bool:false` if $0 is considered truthy.
-- `:bool:true`: The true constant
-- `:bool:false`: The false constant
-- `:bool:is`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `:bool:true` if all arguments are booleans (`:nil:nil` is NOT considered a boolean).
+- `bool.if`: Requires exactly 3 arguments of arbitrary type. If $0 is a truthy value, evaluate and return $1. If $0 is a falsy value, evaluate and return $2. Values considered as falsy are: `bool.false` and `nil.nil`. Everything else is considered truthy.
+- `bool.and`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `bool.true` if all of the arguments are considered truthy.
+- `bool.or`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `bool.true` if at least one of the arguments is considered truthy.
+- `bool.equal`: Accepts an arbitrary number of arguments of arbitrary type, but at least 2. Returns `bool.true` if either all of the arguments are considered truthy or all of the arguments are considered falsy.
+- `bool.not`: Accepts exactly one argument of arbitrary type. Returns `bool.true` if the $0 is considered falsy, returns `bool.false` if $0 is considered truthy.
+- `bool.true`: The true constant
+- `bool.false`: The false constant
+- `bool.is`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `bool.true` if all arguments are booleans (`nil.nil` is NOT considered a boolean).
## The `:int` module
-- `:int:add`: Accepts an arbitrary number of integer arguments (or none at all) and returns the sum of all arguments, or `0` if none were given.
-- `:int:sub`: Accepts exactly 2 integer arguments and returns their difference.
-- `:int:mul`: Accepts an arbitrary number of integer arguments (or none at all) and returns the product of all arguments, or `1` if none were given.
-- `:int:div`: Accepts exactly 2 integer arguments and returns their quotient (rounded towards 0).
-- `:int:mod`: Accepts exactly 2 integer arguments and returns the reminder of their division.
-- `:int:smaller`: Accepts exactly 2 integer arguments and returns `:bool:true` if $0 is smaller than $1, `:boool:false` else.
-- `:int:greater`: Accepts exactly 2 integer arguments and returns `:bool:true` if $0 is greater than $1, `:bool:false` else.
-- `:int:equal`: Accepts an arbitrary number of integer arguments, but at least 2. Returns `bool:true` if all the arguments are equal.
-- `:int:is`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `:bool:true` if all arguments are integers.
+- `int.add`: Accepts an arbitrary number of integer arguments (or none at all) and returns the sum of all arguments, or `0` if none were given.
+- `int.sub`: Accepts exactly 2 integer arguments and returns their difference.
+- `int.mul`: Accepts an arbitrary number of integer arguments (or none at all) and returns the product of all arguments, or `1` if none were given.
+- `int.div`: Accepts exactly 2 integer arguments and returns their quotient (rounded towards 0).
+- `int.mod`: Accepts exactly 2 integer arguments and returns the reminder of their division.
+- `int.smaller`: Accepts exactly 2 integer arguments and returns `bool.true` if $0 is smaller than $1, `bool.false` else.
+- `int.greater`: Accepts exactly 2 integer arguments and returns `bool.true` if $0 is greater than $1, `bool.false` else.
+- `int.equal`: Accepts an arbitrary number of integer arguments, but at least 2. Returns `bool.true` if all the arguments are equal.
+- `int.is`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `bool.true` if all arguments are integers.
-## The `:nil` module
+## The `nil` module
-- `:nil:nil`: The nil constant
-- `:nil:is`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `:bool:true` if all arguments are strings.
+- `nil.nil`: The nil constant
+- `nil.is`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `bool.true` if all arguments are strings.
-## The `:ref` module
+## The `ref` module
-- `:ref:call`: Accepts a function reference as $0 and after that and arbitrary number of arguments of arbitrary type. Calls the function $0 with the arguments that follow and returns it's return value.
-- `:ref:is`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `:bool:true` if all arguments are function references.
+- `ref.call`: Accepts a function reference as $0 and after that and arbitrary number of arguments of arbitrary type. Calls the function $0 with the arguments that follow and returns it's return value.
+- `ref.is`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `bool.true` if all arguments are function references.
-## The `:str` module
+## The `str` module
-- `:str:cat`: Accepts an arbitrary number of arguments of arbitrary type and returns the concatenation of their string representations.
-- `:str:is`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `:bool:true` if all arguments are strings.
+- `str.cat`: Accepts an arbitrary number of arguments of arbitrary type and returns the concatenation of their string representations.
+- `str.is`: Accepts an arbitrary number of arguments of arbitrary type, but at least one. Returns `bool.true` if all arguments are strings.
### String representations
diff --git a/doc/syntax.md b/doc/syntax.md
index fcb30a0..f87b279 100644
--- a/doc/syntax.md
+++ b/doc/syntax.md
@@ -31,10 +31,10 @@ string literal
- Function reference: `&function_name`
- Function call: `function_name(args)` or just `function_name`, where args is a comma-separated list of expressions.
-**Important:** When passing arguments to a function, these arguments are not passed directly as values, but rather as expressions. Each argument is evaulated as the called function accesses it. This means that you can have constructs that would cause infinite recursion in other languages - a good example for a usecase of that are conditions: `:bool:if(condition, if_true, else)` is just a regular function from the standard library. `if_true` is only evaluated if condition is truey, meaning that if condition is falsey and `if_true` is a function call, that function will not be called.
+**Important:** When passing arguments to a function, these arguments are not passed directly as values, but rather as expressions. Each argument is evaulated as the called function accesses it. This means that you can have constructs that would cause infinite recursion in other languages - a good example for a usecase of that are conditions: `bool.if(condition, if_true, else)` is just a regular function from the standard library. `if_true` is only evaluated if condition is truey, meaning that if condition is falsey and `if_true` is a function call, that function will not be called.
Function name syntax:
- `function`: Call `function` in the current module.
-- `path:to:module:function`: Call `function` in the module located at `path/to/module`. That path is relative to the path of the module calling the function. See module paths section under Invocation.
-- `:std_module:function`: Call `function` in the module `std_module` from the standard library.
+- `.path.to.module.function`: Call `function` in the module located at `path/to/module`. That path is relative to the path of the module calling the function. See module paths section under invocation.
+- `std_module.function`: Call `function` in the module `std_module` from the standard library. The location of the standard library is the directory `std` in the path of the `uwu` binary. The standard library can be overwritten; if the environment variable UWU_MODULE_PATH is set, it is used as the standard library path. UWU_MODULE_PATH can also be a list of paths, separated by `:`. In that case, whenever a module from the standard library is requested, the paths is tried in order and the first module found is selected.