Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
W

wasp

> 编程语言
Open source

a web assembly programming language

324 stars0 likes0 views
WebsiteGitHub

About

a web assembly programming language

Wasp

a programming language for extremely concise web assembly modules

warning: this compiler is very alpha and error messages aren't the best, but it works and language is simple!

extern console_log(message)

pub fn main(){
  console_log("Hello World!")
}

Features

  • encourages immutability
  • immutable c-strings, memory manipulation, global variables, imported functions, 1st class functions
  • optional standard library runtime
  • functions with inline web assembly
  • test framework support
  • easy project dependency management
  • self hosting

Quickstart

Wasp depends on git and rust. Make sure you have them installed before beginning.

cargo install wasp
wasp init myproject
cd myproject
wasp build
python3 -m http.server

Open up http://localhost:8000 and look in console. At this point we will have a web assembly module that has access to the standard libraries functions. More to come in this area!

If you don't have need for the standard library (or want to write your own!). This is also an option.

wasp init myproject --no-std

At this point we will have a web assembly module with a single exported main function and nothing else.

If you think your standard library is out of date, just run wasp vendor

Simple Data Structures

Wasp is an extremely basic language and standard library.

Linked List

cons(42,nil) // returns the memory location of cons
head(cons(42,nil)) // return the head value 42
tail(cons(42,nil)) // returns the memory location of tail
cons(1,cons(2,cons(3,nil))) // returns a linked list

Structs

Structs are dictionaries

struct point { :x :y }

pub fn create_point(){
  foo = malloc(size_of(point))
  set(foo,:x,1)
  set(foo,:y,1)
  foo
}

Drawing

Using web-dom we can easily draw something to screen. Loops in wasp work differently than other languages, observe how this example uses recursion to rebind variables.

…

rust pub test_addition(){ assert(4,(2+2),"2 + 2 should be 4") assert(7,(3+4),"3 + 4 should be 7") }

See it working [here](https://wasplang.github.io/wasp/examples/testing/index.html)

## Why so few functions?
Wasp prefers to keep as little in the core functionality as possible, letting the [standard library](https://github.com/wasplang/std) evolve faster and more independent community driven manner. This project currently follows a principle that if a feature can be implemented with our primitive functions, don't include it in the core compiled language and let the standard library implement it. Also that no heap based concepts be added to the core language.

## Notes

* all functions (including extern functions) return a value, if no obvious return, it returns ()
* Web assembly global 0 is initialized to the end of the static data section (which might also be the start of a heap for a memory allocator). This value is immutable.
* Web assembly global lobal 1 also is initialized to the end of the static data section. This value is mutable and might be used to represent the end of your heap. Check out the [simple allocator example](https://github.com/richardanaya/wasp/blob/master/examples/malloc/main.w).
* Literal strings create initialize data of a c-string at the front of your memory, and can be passed around as pointers to the very start in memory to your text. A \0 is automatically added at compile time, letting you easily have a marker to denote the end of your text.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rust

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言