all repos — min @ 40d2fafb958d5baa7726b3a6330f434feec3792f

A small but practical concatenative programming language.

Some tests passsing with namespaces symbols
h3rald h3rald@h3rald.com
Sun, 26 May 2024 06:26:19 +0000
commit

40d2fafb958d5baa7726b3a6330f434feec3792f

parent

3666dc9a9d15735a41e129853384c064ecaf057d

2 files changed, 6 insertions(+), 6 deletions(-)

jump to
M minpkg/core/interpreter.nimminpkg/core/interpreter.nim

@@ -196,12 +196,10 @@

proc apply*(i: In, op: MinOperator, sym = "") {.effectsOf: op.} = if op.kind == minProcOp: if not op.mdl.isNil and not op.mdl.scope.isNil: + # Capture closures at module level let origScope = i.scope - let origMdlParentScope = op.mdl.scope.parent i.scope = op.mdl.scope - i.scope.parent = origScope op.prc(i) - i.scope.parent = origMdlParentScope i.scope = origScope else: op.prc(i)

@@ -447,7 +445,10 @@ raiseInvalid("Module '$#' is polluting the stack -- $#" % [s, $d.newVal])

result = newDict(i2.scope) result.objType = "module" for key, value in i2.scope.symbols.pairs: - result.scope.symbols[key] = value + var v = value + if v.kind == minProcOp: + v.mdl = result + result.scope.symbols[key] = v CACHEDMODULES[s] = result proc parse*(i: In, s: string, name = "<parse>"): MinValue =
M minpkg/core/scope.nimminpkg/core/scope.nim

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

import - std/[strutils, - critbits] + std/[strutils, sequtils, critbits] import parser