Lets say we have this code:
const msg = "JS Backend"
for _ in 0..10: echo msg
The loop is converted to while-do block, and the echo is passed trough
rawEcho(makeNimstrLit("JS Backend"));
function rawEcho() {
var buf = "";
for (var i = 0; i < arguments.length; ++i) {
buf += toJSStr(arguments[i]);
}
console.log(buf);
How hard is to change the generator to convert the echo msg into console.log(msg); directly?
@Araq my intent is to output more readable and debbugable code. Im currently looking at jsgen.nim
Lets say I want to make a new backend target - Typescript
The resulting code shoud look like this:
const msg:string = "TS Backend";
for(i = 0; i<=10 ; i++) {
console.log(msg);
}
and thats it, no string converters, no raw echo.
Ideally, I want to copy all the files used for the JS backend, and start tweaking them, first the echo, than the most basic for loops etc. but idk where to start :)