static void Main(string[] args) { var codegen = new Codegen(); var cSOutput = codegen.EmitCodeForJS(@" let n = 1 function runNextFizzbuzz () { let str = '' if (n % 3 === 0) { str = 'Fizz' } if (n % 5 === 0) { str = str + 'Buzz' } if (str === '') { str = n } console.log(str) n = n + 1 if (n !== 101) { runNextFizzbuzz() } } runNextFizzbuzz() "); Console.WriteLine(cSOutput); }
//------------------------------------------------------------------- Compile() // // Compile expression into a Codeblock // public int Compile(string codeblockText) { Error err = Error.None; // Store codeblock text this.codeblockText = codeblockText; // Create new code object code = new Code(codeblockText); // Compile the block err = Codegen.CompileCodeblock(this); return(err.ErrCode); }