Top 1,000 Features Creators Events Podcasts Extensions Interviews Blog Explorer CSV

Wax

< >

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

#1455on PLDB 4Years Old
Download source code:
git clone https://github.com/LingDong-/wax
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)

View source

- Build the next great programming language ยท About ยท Resources ยท Acknowledgements ยท Part of the World Wide Scroll