Compiling TO Nim

2021-10-26 Thread enthus1ast
You could have a look at nimja (. ). It is not a full blown language on its own, but it still resembles all parts of a language/compile: Lexing/Tokenizing, Parsing, Code generation. Lexing:

Compiling TO Nim

2021-10-26 Thread PMunch
If you just want to hack around for fun you can do something like this: import macros macro parser(tokens: static seq[string]): string = var tokens_left = tokens var test_node = newCall("echo") for token in tokens: test_node.add newL

Compiling TO Nim

2021-10-25 Thread florianfmmartin
Will check that out, thanks!

Compiling TO Nim

2021-10-25 Thread Araq
Nim's macro system works at compile-time, so your language would need to be fed into the macro as constant strings. This is unlikely what you want, instead use the Nim compiler as an API. See for example how c2nim does it: You then

Compiling TO Nim

2021-10-25 Thread florianfmmartin
Hello, I am trying to write a language that compiles to nim. But i can't find out how to generate nim code and then transform it to a string. I have this "dumb" proc, but i get this error `Error: request to generate code for .compileTime proc: newCall` proc parser(tokens: seq[stri