all repos — min @ 5cf62b0c55e466b9ff9f47aadeaeb88f8993f541

A small but practical concatenative programming language.

Fixed tests (removed include).
h3rald h3rald@h3rald.com
Tue, 18 Oct 2016 19:23:56 +0200
commit

5cf62b0c55e466b9ff9f47aadeaeb88f8993f541

parent

888c0a0abe088aab1a8971607f7ff47d047c02c2

M core/interpreter.nimcore/interpreter.nim

@@ -2,7 +2,8 @@ import

streams, strutils, critbits, - os + os, + oids import value, parser

@@ -50,6 +51,9 @@ if not scope.isNil and scope.symbols.hasKey(key):

if scope.symbols[key].sealed: raiseInvalid("Symbol '$1' is sealed." % key) scope.symbols[key] = value + # TODO remove + #if key == "total": + # echo "[bind] (scope: $1) $2 -> $3" % [scope.fullname, key, $value] result = true else: # Go up the scope chain and attempt to find the symbol

@@ -191,7 +195,7 @@ op.prc(i)

of minValOp: if op.val.kind == minQuotation: var q = op.val - i.addScope(name, q): + i.addScope(name & "#" & $genOid(), q): #echo "a1: ", i.scope.fullname for e in q.qVal: i.push e
M lib/min_lang.nimlib/min_lang.nim

@@ -170,6 +170,9 @@ i.debug "[define] (scope: $1) $2 = $3" % [i.scope.name, symbol, $q1]

if i.scope.symbols.hasKey(symbol) and i.scope.symbols[symbol].sealed: raiseUndefined("Attempting to redefine sealed symbol '$1' on scope '$2'" % [symbol, i.scope.name]) i.newScope("$1#$2" % [symbol, $genOid()], q1) + # TODO remove + #if symbol == "total": + # echo "[define] (scope: $1) $2 -> $3" % [i.scope.fullname, symbol, $q1, $q1.qVal[0]] i.scope.symbols[symbol] = MinOperator(kind: minValOp, val: q1, sealed: false) .symbol("bind") do (i: In):

@@ -181,6 +184,9 @@ if not q1.isQuotation:

q1 = @[q1].newVal symbol = sym.getString i.debug "[bind] " & symbol & " = " & $q1 + # TODO remove + #if symbol == "total": + # echo "[bind] (scope: $1) $2 " % [i.scope.fullname, symbol, $q1] #let p = proc (i: In) = # i.push q1.qVal #let res = i.scope.setSymbol(symbol, MinOperator(kind: minProcOp, prc: p))
M tests/crypto.mintests/crypto.min

@@ -1,4 +1,5 @@

-'test include +'test load +'test import "crypto" describe
M tests/fs.mintests/fs.min

@@ -1,4 +1,5 @@

-'test include +'test load +'test import "fs" describe
M tests/io.mintests/io.min

@@ -1,4 +1,5 @@

-'test include +'test load +'test import "io" describe
M tests/logic.mintests/logic.min

@@ -1,4 +1,5 @@

-'test include +'test load +'test import "logic" describe
M tests/num.mintests/num.min

@@ -1,4 +1,5 @@

-'test include +'test load +'test import "num" describe
M tests/str.mintests/str.min

@@ -1,4 +1,5 @@

-'test include +'test load +'test import "str" describe
M tests/sys.mintests/sys.min

@@ -1,4 +1,5 @@

-'test include +'test load +'test import "sys" describe
M tests/test.mintests/test.min

@@ -54,6 +54,7 @@ ()

ifte ) map + pop ;Remove results accomulator from stack ) :report ) =test
M tests/time.mintests/time.min

@@ -1,4 +1,5 @@

-'test include +'test load +'test import "time" describe