all repos — min @ 001fe20961dccac9bbea9735db8a56bf12d77f9e

A small but practical concatenative programming language.

Defines and documented ==> and return operators.
h3rald h3rald@h3rald.com
Mon, 28 Dec 2020 03:49:16 +0000
commit

001fe20961dccac9bbea9735db8a56bf12d77f9e

parent

590222095d335823c4cb23f27b4da580878fba1f

3 files changed, 19 insertions(+), 1 deletions(-)

jump to
M lib/min_lang.nimlib/min_lang.nim

@@ -1058,8 +1058,17 @@

def.symbol("--") do (i: In): i.push("reverse-expect-dequote".newSym) + def.symbol("::") do (i: In): + i.push("operator".newSym) + def.symbol("=>") do (i: In): i.push("apply".newSym) + + def.symbol("==>") do (i: In): + discard # used within operator defs + + def.symbol("return") do (i: In): + discard # used within operator defs def.symbol(">>") do (i: In): i.push("prefix-dequote".newSym)
M site/contents/reference-lang.mdsite/contents/reference-lang.md

@@ -12,6 +12,8 @@ {#sig||:||define#}

{#alias||:||define#} +{#alias||::||operator#} + {#sig||~||delete#} {#sig||+||module#}

@@ -39,6 +41,9 @@

{#alias||><||infix-dequote#} {#alias||=>||apply#} + +{#op||==>||{{none}}||{{none}}|| +Symbol used to separate input and output calues in operator signatures.#} {#alias||=-=||expect-empty-stack#}

@@ -351,6 +356,10 @@ > > 1 3.5 true

> > (int float bool) -- :my-int :my-float :my-bool #} +{#op||return||{{none}}||{{none}}|| +If used within the body quotation of an operator definition, causes the interpreter to stop pushing further body elements on the stack and start pushing tbe operator output values on the stack. + +If used outside of the body quotation of an operator definition, it raises an exception.#} {#op||ROOT||{{none}}||{{d}}|| Returns a module holding a reference to the [ROOT](class:kwd) scope.
M tests/lang.mintests/lang.min

@@ -264,7 +264,7 @@ when

"not gonna be printed if true!" puts false @result ) - ) operator + ) :: nt"float" ) assert