all repos — min @ 0c6001a4f6897edb3ccb4d06305f2b036b81334f

A small but practical concatenative programming language.

Updated docs.
h3rald h3rald@h3rald.com
Sat, 01 Jun 2024 15:53:02 +0200
commit

0c6001a4f6897edb3ccb4d06305f2b036b81334f

parent

b3545f0880e1703d866d36d1e868edea75000bf9

M next-release.mdnext-release.md

@@ -1,10 +1,13 @@

### BREAKING CHANGES - User-defined symbols can no longer contain dots (`.`). - +- The symbol `invoke` and the `*` sigil have been removed in favor of symbol dot notation. +- The `.` and `..` symbols have been renamed to `pwd` and `parent-dir` respectively. ### New Features +- It is now possible to access dictionary (and module) keys (even nested) via dot notation. This replaces the `invoke` symbol. +- Added shell auto-completion for symbols using dot notation - Added a new `color` symbol to the `io` module to enable/disable terminal color output. - Added a new `from-html` symbol to the `xml` module to parse HTML documents and fragments. - Added a new `xentity2utf8` symbol to the `xml` module to convert an XML entity to its corresponding UTF-8 string.
M site/contents/learn-operators.mdsite/contents/learn-operators.md

@@ -14,10 +14,12 @@ There are two types of operators: _symbols_ and _sigils_.

## Symbols -_Symbols_ are the most common type of operator. A min symbol is a single word that is either provided by one of the predefined min {#link-page||reference||modules#} like `dup` or `.` or defined by the user. User-defined symbols must: +_Symbols_ are the most common type of operator. A min symbol is a single word that is either provided by one of the predefined min {#link-page||reference||modules#} like `dup` or `pwd` or defined by the user. User-defined symbols must: * Start with a letter or an underscore (\_). -* Contain zero or more letters, numbers and/or any of the following characters: `/ ! ? + * . _ -` +* Contain zero or more letters, numbers and/or any of the following characters: `/ ! ? + * _ -` + +If a symbol contains a dot (`.`) then it is namespaced by its containing module or dictionary. For example, `fs.dirname` identifies the {{#link-operator||fs||dirname}} operator defined in the {{#link-module||fs}} module. It is possible to define operator symbols using the {#link-operator||global||operator#} symbol. The following min program defines a new symbol called square that duplicates the first element on the stack and multiplies the two elements:

@@ -71,8 +73,6 @@ '

: Alias for {#link-operator||global||quote#}. \: : Alias for {#link-operator||global||define#}. -* -: Alias for {#link-operator||global||invoke#}. @ : Alias for {#link-operator||global||bind#}. ^
M site/contents/reference-global.mdsite/contents/reference-global.md

@@ -22,8 +22,6 @@ {#sig||~||lambda-bind#}

{#alias||~||lambda-bind#} -{#sig||*||invoke#} - {#sig||@||bind#} {#alias||@||bind#}

@@ -224,17 +222,6 @@ > * If {{any}} is {{null}}, it is converted to `0`.

> * If {{any}} is an integer, no conversion is performed. > * If {{any}} is a float, it is converted to an integer value by truncating its decimal part. > * If {{any}} is a string, it is parsed as an integer value.#} - -{#op||invoke||{{sl}}||{{a0p}}|| -> Assuming that {{sl}} is a formatted like *dictionary*/*symbol*, calls *symbol* defined in *dictionary* (note that this also works for nested dictionaries. -> -> > %sidebar% -> > Example -> > -> > The following program leaves `100` on the stack: -> > -> > {{100 :b} :a} :test *test/a/b - #} {#op||lambda||{{q}} {{sl}}||{{none}}|| > Defines a new symbol {{sl}}, containing the specified quotation {{q}}. Unlike with `define`, in this case {{q}} will not be quoted, so its values will be pushed on the stack when the symbol {{sl}} is pushed on the stack.
M site/contents/reference-sys.mdsite/contents/reference-sys.md

@@ -16,12 +16,6 @@ {#sig||&||run#}

{#alias||&||run#} -{#op||.||{{none}}||{{s}}|| -Returns the full path to the current directory. #} - -{#op||..||{{none}}||{{s}}|| -Returns the full path to the parent directory. #} - {#op||admin?||{{none}}||{{b}}|| Returns {{t}} if the program is being run with administrative privileges. #}

@@ -68,8 +62,14 @@

{#op||os||{{none}}||{{s}}|| Returns the host operating system. It can be one of the following strings: windows, macosx, linux, netbsd, freebsd, openbsd, solaris, aix, standalone. #} +{#op||parent-dir||{{none}}||{{s}}|| +Returns the full path to the parent directory. #} + {#op||put-env||{{sl1}} {{sl2}}||{{s}}|| Sets environment variable {{sl2}} to {{sl1}}. #} + +{#op||pwd||{{none}}||{{s}}|| +Returns the full path to the current directory. #} {#op||rm||{{sl}}||{{none}}|| Deletes the specified file {{sl}}. #}
M site/contents/reference.mdsite/contents/reference.md

@@ -23,7 +23,7 @@ : Provides operators for accessing file information and properties.

{#link-module||logic#} : Provides comparison operators for all min data types and other boolean logic operators. {#link-module||str#} -: Provides operators to perform operations on strings, use regular expressions, interpolation, etc.. +: Provides operators to perform operations on strings, use regular expressions, interpolation, etc. {#link-module||sys#} : Provides operators to use as basic shell commands, access environment variables, and execute external commands. {#link-module||num#}