Warning: Using the environment variable: NIMBLE_DIR='/home/runner/GoldNim/nimble-env'
Verifying dependencies for [email protected]
Info: Dependency on cligen@>= 1.5.37 already satisfied
Verifying dependencies for [email protected]
Building goldnim/bin/gold using c backend
/home/runner/GoldNim/bin/compiler/macros2.nim(613, 8) Error: internal error: genLiteral(nkHiddenCallConv)
No stack traceback available
To create a stacktrace, rerun compilation with './koch temp c <file>', see https://nim-lang.github.io/Nim/intern.html#debugging-the- compiler for details
Tip: 3 messages have been suppressed, use --verbose to show them.
Error: Build failed for package: goldnim
... Execution failed with exit code 1
... Command: /home/runner/GoldNim/nimble-env/bin/nim c --colors:on --noNimblePath --colors:off -d:NimblePkgVersion=0.1.0 --path:/home/runner/GoldNim/nimble-env/pkgs/cligen-1.5.37 --hints:off -o:/home/runner/GoldNim/bin/gold /home/runner/GoldNim/bin/gold.nim
Bash cannot find Koch and I cannot figure out what this error is. If anyone has a fix please let me know
import system except NimNode
import compiler/macros2
import std/[os, strutils]
type GoldConfig = ref object
proc processFile(path: string, config: GoldConfig) =
echo "Gold: ", path
let data = readFile(path)
echo data.parseStmt().astGenRepr()
proc goldFiles(path: string, config: GoldConfig) =
if path.fileExists:
processFile(path, config)
else:
for dir in path.walkDirRec:
if dir.endsWith(".nim"):
processFile(dir, config)
# CLI
import cligen
proc gold(args: seq[string]) =
args[0].goldFiles(GoldConfig())
dispatch gold
you could file an issue on @elcritch's github, but i'm pretty sure this never worked properly.
to start with, it truncates the names of each node incorrectly, so you'll need to s/substr(3)/substr(2)/
This is an instance of the same issue i liked before; a converter is defined that converts to/from nnk style NimNodeKind's and nk style TNodeKind's
the astGenRepr and '$' procs can be fixed by replacing n.kind with n.kind.toEnum _or by replacing the nnkNodeKind with nkNodeKind as they are in treeTraverse (which is why lispRepr and treeRepr work)
But there are more bugs in astGenRepr for example it doesn't do the right thing with nkIdent or nkSym so be prepared for a lot of debugging. Still, if you fix them, do send a pull request to elcritch, maybe this could be useful.
What are you trying to use it for?