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
783 stars 45 forks source link

Wax compiler in wax - working implementation #25

Open jacoblister opened 2 years ago

jacoblister commented 2 years ago

@LingDong- I've made some surprisingly rapid progress on a self hosted compiler implementation, please see:

https://github.com/jacoblister/wax/blob/compiler/examples/compiler.wax

To use, copy the wax code into the Playground and run - this will output javascript , copy and paste into a browser console window, and get - working example programs!

The following programs are working so far:

just uncomment to example to run in the compiler 'main' function to see the others.

I've only been worked on this for about a week in my spare time/weekends, and already have this much working, so I think the minimal wax language might really be on to something. Looking at what it can do so far, I don't think I'll be too far away from having a self hosted compiler working pretty soon, and all in < 1000 lines of code, with embedded examples!

I have also made a merge request for a Brainfu*k implementation as well - getting that working so easily that got me motivated to try to do a compiler: https://github.com/LingDong-/wax/pull/24/commits/28ae5ebdce2dc4ca888f35ac91a3b49a2acb8a59

Could you please have a look at that and perhaps merge it into the examples if that's ok?

I'll be having a look at the C language target as well after I get all the basic functionality covered. I would be quite interested in collaborating with you as I make more progress. I can do a longer brain dump about thoughts on approaches if you'd like.

Thanks Kindly,

Jacob