all repos — min @ 0d00ff6a6f4e99566295d2fadd9b291783a3781e

A small but practical concatenative programming language.

refactor(scope) Removed disposable scopes.
h3rald h3rald@h3rald.com
Fri, 03 Jun 2016 10:13:49 +0200
commit

0d00ff6a6f4e99566295d2fadd9b291783a3781e

parent

86c623a957aa83e3325656a760f046c15e873d70

4 files changed, 1 insertions(+), 24 deletions(-)

jump to
M core/interpreter.nimcore/interpreter.nim

@@ -83,19 +83,6 @@ body

#i.debug "[scope] " & scope.fullname i.scope = scope -#template newDisposableScope*(i: In, id: string, body: stmt): stmt {.immediate.}= -# var q = MinValue(kind: minQuotation, qVal: newSeq[MinValue](0)) -# q.scope = new MinScope -# q.scope.name = id -# q.scope.parent = i.scope -# q.scope.disposable = true - #i.debug "[scope] " & q.scope.fullname -# let scope = i.scope -# i.scope = q.scope -# body - #i.debug "[scope] " & scope.fullname -# i.scope = scope - proc newMinInterpreter*(debugging = false): MinInterpreter = var st:MinStack = newSeq[MinValue](0) var pr:MinParser
M core/types.nimcore/types.nim

@@ -23,7 +23,6 @@ MinScope* = object

symbols*: CritBitTree[MinOperator] sigils*: CritBitTree[MinOperator] parent*: ref MinScope - disposable*: bool name*: string stack*: MinStack MinValue* = object
M core/utils.nimcore/utils.nim

@@ -55,15 +55,6 @@ return ROOT

else: return scope.parent -proc ancestor*(scope: ref MinScope): ref MinScope = - if scope.parent.isNil: - return ROOT - else: - if scope.parent.disposable: - return scope.parent.ancestor - else: - return scope.parent - proc define*(name: string): ref MinScope = var scope = new MinScope scope.name = name
M lib/lang.nimlib/lang.nim

@@ -109,7 +109,7 @@ let p = proc(i: In) =

i.evaluating = true i.push code i.evaluating = false - i.scope.ancestor.symbols[id] = p + i.scope.symbols[id] = p i.stack = stack .symbol("import") do (i: In):