Top 1K Features Creators Events Podcasts Books Extensions Interviews Blog Explorer CSV

Wax

< >

Wax is a programming language created in 2020 by Lingdong Huang.

#435on PLDB 4Years Old
Download source code:
git clone https://github.com/LingDong-/wax
Homepage · REPL · Source Code

A tiny programming language that transpiles to C, C++, Java, TypeScript, Python, C#, Swift, Lua and WebAssembly


Language features

Feature Supported Example Token
Operators ;; << >> = && || >= <= <> ;; + - * / ^ % & | ! ~ < >
Line Comments ; a comment ;
Macros (@define MY_CONSTANT 5) (@if MY_CONSTANT 5 (print "yes, it's") (print @MY_CONSTANT) )
Ternary operators (set y (? (= x 0) 1 2))
Prefix Notation (+ 1 1)
Structs (struct point (let x float) (let y float) )
Lists (let x (arr (vec 3 float)))
Maps (let m (map str int) (alloc (map str int))) (set m "xyz" 123) (insert m "abc" 456) ; exactly same as 'set' (print (get m "xyz")) (remove m "xyz") (print (get m "xyz")) ;^ if a value is not there, the "zero" value of the element type is returned ; for numbers, 0; for compound types, null.
Strings
Floats
Assignment (set x 42)
Integers (let x int 42)

- Build the next great programming language · Add · Issues · About · Search · Keywords · Livestreams · Labs · Resources · Acknowledgements

Built with Scroll v164.7.0