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

Wa-lang

< >

Wa-lang is an open source programming language created in 2022 by Shushan Chai and Ernan Ding.

#176on PLDB 4Years Old
Download source code:
git clone https://github.com/wa-lang/wa
Homepage · REPL · Download · Source Code · Blog · Twitter · Docs

Wa-lang is a general-purpose programming language designed for for WebAssembly. The goal is to provide a simple, reliable, easy-to-use, statically typed language for high-performance web applications. The code generator and runtime are fully independently developed (not dependent on external projects such as LLVM). Currently, Wa-lang is in the engineering trial stage.


Example from the web:
import "fmt" global year: i32 = 2023 func main { println("hello, Wa!") println(add(40, 2), year) fmt.Println(1+1) } func add(a: i32, b: i32) => i32 { return a+b }
Wa-lang Keywords
break case const continue default defer else for func if import interface map range return struct switch type global

Language features

Feature Supported Example Token
Standard Library ✓ fmt.Println("Hello, World!")
Floats ✓ // \d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)
Hexadecimals ✓ // 0[xX][0-9a-fA-F]+
Octals ✓ // 0[0-7]+
Conditionals ✓
Switch Statements ✓
Constants ✓
Case Sensitivity ✓
Assignment ✓ =
Print() Debugging ✓ println
Message Passing ✓
Line Comments ✓ // A comment //
Variadic Functions ✓ // This variadic function takes an arbitrary number of ints as arguments. func sum(nums: ...int) { print("The sum of ", nums) // Also a variadic function. total := 0 for _, num := range nums { total += num } println(" is", total) // Also a variadic function. }
Type Inference ✓
Operator Overloading ✓ #wa:operator + MyInt_add type MyInt :struct { V: int } func MyInt_add(x, y: MyInt) => int { return x.V + y.V } func main { x1 := MyInt{V: 100} x2 := MyInt{V: 42} println(x1 + x2) }
File Imports ✓ import ( "math" "strings" ) import "strings" => . import "io" => _ import "math" => m
Increment and decrement operators ✓ i := 0 i++ i--
Integers ✓ i, j := 42, 2701
Booleans ✓ c := true
MultiLine Comments ✓ /* A comment */ /* */
Comments ✓ // A comment
Pointers ✓ func main { i, j := 42, 2701 p := &i // point to i println(*p) // read i through the pointer *p = 21 // set i through the pointer println(i) // see the new value of i p = &j // point to j *p = *p / 37 // divide j through the pointer println(j) // see the new value of j }
Strings ✓ "hello world" "
Case Insensitive Identifiers X
Semantic Indentation X

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

Built with Scroll v178.2.3