all repos — min @ 66a911108c3328a469b98030a9182850dba91484

A small but practical concatenative programming language.

Documented prefix and infix dequote
h3rald h3rald@h3rald.com
Sun, 29 Nov 2020 05:34:40 +0000
commit

66a911108c3328a469b98030a9182850dba91484

parent

172fbe14240f22e98bca3612f239a9680fb049e8

3 files changed, 38 insertions(+), 7 deletions(-)

jump to
M core/consts.nimcore/consts.nim

@@ -1,6 +1,6 @@

-const - pkgName* = "min" - pkgVersion* = "0.21.1" - pkgAuthor* = "Fabio Cevasco" - pkgDescription* = "A tiny concatenative programming language and shell." - +const + pkgName* = "min" + pkgVersion* = "0.22.0" + pkgAuthor* = "Fabio Cevasco" + pkgDescription* = "A tiny concatenative programming language and shell." +
M site/contents/reference-lang.mdsite/contents/reference-lang.md

@@ -30,6 +30,10 @@ {#sig||<||load-symbol#}

{#alias||->||dequote#} +{#alias||>>||prefix-dequote#} + +{#alias||><||infix-dequote#} + {#alias||=>||apply#} {#sig||#||quote-bind#}

@@ -154,6 +158,23 @@

{#op||import||{{sl}}||{{null}}|| Imports the a previously-loaded module {{sl}}, defining all its symbols in the current scope. #} +{#op||infix-dequote||{{q}}||{{a}}|| +> Dequotes {{q}} using infix notation. +> +> > %note% +> > No operator precedence +> > +> > No special operator preference is defined, symbols precedence is always left-to-right. However, you can use parentheses (quotes) to evaluate expressions before others. +> +> > %sidebar% +> > Example +> > +> > The following program leaves `17` on the stack: +> > (2 + (3 * 5)) infix-dequote +> > +> > while this program leaves `25` on the stack: +> > (2 + 3 * 5) infix-dequote #} + {#op||int||{{any}}||{{i}}|| > Converts {{any}} to an integer value based on the following rules: >

@@ -214,6 +235,16 @@ Returns a dictionary of all options passed to the current program, with their respective values.#}

{#op||parse||{{s}}||{{q}}|| Parses {{s}} and returns a quoted program {{q}}. #} + +{#op||prefix-dequote||{{q}}||{{a}}|| +> Dequotes {{q}} using prefix notation (essentially it reverses {{q}} and dequotes it. +> +> > %sidebar% +> > Example +> > +> > The following program leaves `4` on the stack: +> > (* 8 4) prefix-dequote +#} {#op||prompt||{{null}}||{{s}}|| > This symbol is used to configure the prompt of the min shell. By default, it is set to the following quotation:
M site/settings.jsonsite/settings.json

@@ -5,6 +5,6 @@ "templates": "templates",

"temp": "temp", "output": "output", "title": "min language", - "version": "0.21.1", + "version": "0.22.0", "rules": "rules.min" }