all repos — min @ 1a4c94a42628112fe606a8787a76939bc8728a51

A small but practical concatenative programming language.

Minor changes.
h3rald h3rald@h3rald.com
Sat, 30 Jun 2018 16:33:15 +0200
commit

1a4c94a42628112fe606a8787a76939bc8728a51

parent

ace95af70a425e846c40f09efa941ddbf212b89e

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

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

@@ -177,28 +177,23 @@ i.trace.add val

if not i.evaluating: i.currSym = val let symbol = val.symVal - let sigil = "" & symbol[0] - let found = i.scope.hasSymbol(symbol) - if found: - let sym = i.scope.getSymbol(symbol) - i.apply(sym) + if i.scope.hasSymbol(symbol): + i.apply i.scope.getSymbol(symbol) else: - let found = i.scope.hasSigil(sigil) - if symbol.len > 1 and found: - let sig = i.scope.getSigil(sigil) - let sym = symbol[1..symbol.len-1] - i.stack.add(MinValue(kind: minString, strVal: sym)) - i.apply(sig) + let sigil = "" & symbol[0] + if symbol.len > 1 and i.scope.hasSigil(sigil): + i.stack.add(MinValue(kind: minString, strVal: symbol[1..symbol.len-1])) + i.apply(i.scope.getSigil(sigil)) else: raiseUndefined("Undefined symbol '$1'" % [val.symVal]) discard i.trace.pop else: - var v = val - if (v.kind == minDictionary): + if (val.kind == minDictionary): + var v = val i.dequote(v) # Clear the initial quotation; only used when parsing a dictionary for the first time v.qVal = @[] - i.stack.add(v) + i.stack.add(val) proc pop*(i: In): MinValue {.extern:"min_exported_symbol_$1".}= if i.stack.len > 0: