all repos — min @ 87950395eaf08a106f123c7cbc12651aa1c515f1

A small but practical concatenative programming language.

Implemented support for .minimrc.
h3rald h3rald@h3rald.com
Sat, 03 Sep 2016 15:15:17 +0200
commit

87950395eaf08a106f123c7cbc12651aa1c515f1

parent

87aae2120723652e324af891a56582ac20a8c162

1 files changed, 14 insertions(+), 1 deletions(-)

jump to
M minim.nimminim.nim

@@ -25,6 +25,11 @@

var REPL = false var DEBUGGING = false const PRELUDE* = ".minimrc".slurp.strip +when defined(windows): + const HOME = getenv("HOMEPATH") +when not defined(windows): + const HOME = getenv("HOME") +const MINIMRC = HOME / ".minimrc" let usage* = " MiNiM v" & version & " - a tiny concatenative programming language" & """

@@ -65,6 +70,12 @@ when not(USE_LINENOISE):

stdout.write(s) return stdin.readLine +proc saverc() = + MINIMRC.writeFile(PRELUDE) + +proc loadrc(): string = + return MINIMRC.readFile() + proc stdLib(i: In) = i.lang_module i.io_module

@@ -76,7 +87,9 @@ i.sys_module

i.time_module i.fs_module i.crypto_module - i.eval PRELUDE + if not MINIMRC.fileExists: + saverc() + i.eval loadrc() proc minimStream(s: Stream, filename: string, debugging = false) = var i = newMinInterpreter(debugging)