Wax is a programming language created in 2020 by Lingdong Huang.
#433on PLDB | 4Years Old |
git clone https://github.com/LingDong-/wax
A tiny programming language that transpiles to C, C++, Java, TypeScript, Python, C#, Swift, Lua and WebAssembly
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) |