all repos — min @ 6107bbdd8d227400deea1b94e00fc927ce1ef888

A small but practical concatenative programming language.

Started working on js compilation
h3rald h3rald@h3rald.com
Sat, 19 Dec 2020 13:25:40 +0000
commit

6107bbdd8d227400deea1b94e00fc927ce1ef888

parent

f0b2add3fb1e58a8ed2babe6d02b14fa0ca13a2b

4 files changed, 26 insertions(+), 14 deletions(-)

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

@@ -196,7 +196,10 @@

proc dequote*(i: In, q: var MinValue) {.extern:"min_exported_symbol_$1".}= if q.kind == minQuotation: i.withScope(): - let qqval = deepCopy(q.qVal) + when defined(js): + let qqval = q.qval + else: + let qqval = deepCopy(q.qVal) for v in q.qVal: i.push v q.qVal = qqval
M core/minilogger.nimcore/minilogger.nim

@@ -26,17 +26,22 @@ of lvlFatal:

return ("(x)") else: return (" ") - -proc log*(level: Level; args: varargs[string, `$`]) = - var f = stdout - if level >= LOGLEVEL: - if level >= lvlWarn: - f = stderr - let prefix = level.logPrefix() - f.write(prefix&" ") - f.write(args.join(" ")) - f.write("\n") - if level in {lvlError, lvlFatal}: flushFile(f) +when defined(js): + proc log*(level: Level; args: varargs[string, `$`]) = + #TODOJS + discard + +else: + proc log*(level: Level; args: varargs[string, `$`]) = + var f = stdout + if level >= LOGLEVEL: + if level >= lvlWarn: + f = stderr + let prefix = level.logPrefix() + f.write(prefix&" ") + f.write(args.join(" ")) + f.write("\n") + if level in {lvlError, lvlFatal}: flushFile(f) proc fatal*(args: varargs[string, `$`]) = log(lvlFatal, args)

@@ -83,4 +88,4 @@ else:

val = "warn" lvl = lvlWarn LOGLEVEL = lvl - return val+ return val
M core/parser.nimcore/parser.nim

@@ -750,7 +750,10 @@ else:

raiseUndefined(p, "Undefined value: '"&p.a&"'") proc print*(a: MinValue) {.extern:"min_exported_symbol_$1".}= - stdout.write($$a) + when defined(js): + discard #TODOJS + else: + stdout.write($$a) # Predicates
A js.nim

@@ -0,0 +1,1 @@

+import min