Ensured that min is now a full superset of mn.
h3rald h3rald@h3rald.com
Fri, 21 Jul 2023 16:03:37 +0200
7 files changed,
46 insertions(+),
4 deletions(-)
A
cmdTest.nim
@@ -0,0 +1,9 @@
+import min +MINCOMPILED = true +var i = newMinInterpreter("cmdTest.min") +i.stdLib() +### cmdTest.min (main) +i.push MinValue(kind: minCommand, cmdVal: "ls") +i.push MinValue(kind: minString, strVal: "\n") +i.push MinValue(kind: minSymbol, symVal: "split", column: 15, line: 1, filename: "cmdTest.min") +i.push MinValue(kind: minSymbol, symVal: "puts", column: 20, line: 1, filename: "cmdTest.min")
M
minpkg/core/parser.nim
→
minpkg/core/parser.nim
@@ -20,6 +20,8 @@ tkInt,
tkFloat, tkBracketLe, tkBracketRi, + tkSqBracketLe, + tkSqBracketRi, tkBraceLe, tkBraceRi, tkSymbol,@@ -177,6 +179,8 @@ "int literal",
"float literal", "(", ")", + "[", + "]", "{", "}", "symbol",@@ -809,6 +813,11 @@ result = result.concat(instructions)
result.add indent&qvar&".add "&v eat(p, tkBracketRi) result.add op&"MinValue(kind: minQuotation, qVal: "&qvar&")" + of tkSqBracketLe, tkSqBracketRi: + discard getToken(p) + of tkCommand: + result = @[op&"MinValue(kind: minCommand, cmdVal: "&p.a.escapeEx&")"] + discard getToken(p) of tkBraceLe: result = newSeq[string](0) var val: MinValue
M
minpkg/lib/min_io.nim
→
minpkg/lib/min_io.nim
@@ -180,4 +180,10 @@ discard f.open(a.strVal, fmAppend)
f.write(b.strVal) f.close() - def.finalize("io")+ def.symbol("write") do (i: In): + i.pushSym("fwrite") + + def.symbol("read") do (i: In): + i.pushSym("fread") + + def.finalize("io")
M
minpkg/lib/min_lang.nim
→
minpkg/lib/min_lang.nim
@@ -1070,6 +1070,11 @@ let vals = i.expect("str")
let s = vals[0] i.push(@[i.newSym(s.strVal)].newVal) + def.symbol("quotecmd") do (i: In): + let vals = i.expect("str") + let s = vals[0] + i.push(@[newCmd(s.strVal)].newVal) + # Sigils def.sigil("'") do (i: In):@@ -1143,4 +1148,7 @@
def.symbol("><") do (i: In): i.pushSym("infix-dequote") - def.finalize("ROOT")+ def.symbol("lambdabind") do (i: In): + i.pushSym("lambda-bind") + + def.finalize("ROOT")
M
minpkg/lib/min_stack.nim
→
minpkg/lib/min_stack.nim
@@ -132,4 +132,10 @@ i.push b
i.dequote(a) i.push b + def.symbol("getstack") do (i: In): + i.pushSym("get-stack") + + def.symbol("setstack") do (i: In): + i.pushSym("set-stack") + def.finalize("stack")
M
next-release.md
→
next-release.md
@@ -1,10 +1,13 @@
### New Features -* Implemented support for executing commands by wrapping strings in `[ ]`, like in [mn](https://h3rald.com/mn) +* min is now a superset of [mn](https://h3rald.com/mn): + * Implemented support for executing commands by wrapping strings in `[ ]`, like in mn. + * Implemented new `quotecmd` symbol to quote command strings. + * Implement aliases for compatibility with _mn_: `getstack` (`get-stack`), `setstack` (`set-stack`), `lambdabind` (`lambda-bind`), `read` (`fread`), `write` (`fwrite`). ### Fixes and Improvements -* Documentation improvements and fixes (thanjs @agentofuser, @tristanmcd130, and @jo-he. +* Documentation improvements and fixes (thanjs @agentofuser, @tristanmcd130, and @jo-he). * Fixed #184 (thanks @inivekin) * Fixed problem with hardcoded relative paths to third-party libraries that prevented installing via nimble. * Upgraded OpenSSL to v3.1.1.