LingDong- / wax

A tiny programming language that transpiles to C, C++, Java, TypeScript, Python, C#, Swift, Lua and WebAssembly 🚀
https://waxc.netlify.app/
MIT License
793 stars 45 forks source link

Fixes for Lua transpiler! #16

Closed ghost closed 3 years ago

ghost commented 3 years ago

Fixes:

  1. Let transpiler generate require for bit or bit32 module if one of them found, With edit on transpiling them...
  2. Fix ternary operators, It shouldn't be as functions (hilbert example didn't worked with that case...)
LingDong- commented 3 years ago

Hi @Rabios

Thanks so much for the fixes!

ghost commented 3 years ago

Problem with require when module not found, I tested it on https://repl.it so for this reason i decided to implement solve for bit operations...

And thanks!

About hilbert example, When did Moonscript transpiler with ternary if from Lua you did, It gives me output: 1 0 1 0 1

Just, That's from generated Lua by MoonScript compiler...

LingDong- commented 3 years ago

Hi @Rabios, thanks for the clarification

Anyways I'm happy to merge the require fix, and if you come up with an alternative ternary operator implementation with correct behavior, then that too.

Thanks again!

ghost commented 3 years ago

isn't Moonscript a language that compiles to lua?

Yes it is...

How does it relate to the output of wax?

Cause i did wax transpiler for MoonScript, So yep i transpiled hilbert to MoonScript with transpiler i made for it to test it... And from MoonScript generated code i used MoonScript to transpile generated MoonScript code to Lua...

Currently, this new and/or implementation (whatever it has to do with Moonscript), produces incorrect behavior in standard Lua, so I don't think that's very acceptable :)

OK, I think we should close this pull request and..., Just put edits on bit and bit32 (It's up to you...)

And i'm very thankful that you liked my contribution...

LingDong- commented 3 years ago

Merged, and manually reverted the ternary operator. Thanks for the PR and sorry for the delay!