I get this confusing trace that I will explain below:
Sending: StmtList
Got: StmtList
Got: Ident
/home/runner/JumpLang/main.nim(6) main
/home/runner/JumpLang/jumplang/interpreter.nim(110) interpret
/home/runner/JumpLang/jumplang/interpreter.nim(100) visit
/home/runner/JumpLang/jumplang/interpreter.nim(89) visit
/home/runner/JumpLang/jumplang/interpreter.nim(100) visit
/home/runner/JumpLang/jumplang/ast.nim(92) visit
/home/runner/JumpLang/jumplang/ast.nim(32) expectKind
Error: unhandled exception: Got kind Ident but expected {OpExpr, KwExpr, StmtList, VarDecl, ArgList, CallExpr, IfStmt, FuncStmt, TemplateStmt, FlagStmt} [JlKindError]
L92 got a Node with Ident type without one being sent.
The L92 iterator:
iterator items*(n: JlNode): JlNode =
echo "Got: ", n.kind
n.expectKind lsSet
for item in n.list:
yield item
The L100 loop:
if n.kind in lsSet:
echo "Sending: ", n.kind
for child in n:
discard i.visit(child)
If anyone can tell me how to fix this it would be appreciated. Note: if you want a minimal example I do not know how to make one for this problem (I tried) and will need some help making one.