🔫 PewPew — Syntax Reference
Full language reference for PewPew (
.pewfiles).
Table of Contents
- Data Types
- Variables
- Operators
- Conditions
- Loops
- Functions
- Bags (Arrays)
- Built-in Functions
- Comments
- Example Programs
Data Types
| PewPew Type | Meaning | Example |
|---|---|---|
whole | Integer/float | whole x = 10 |
dotted | Decimal number | dotted pi = 3.14 |
words | String | words name = "PewPew" |
vibe | Boolean | vibe flag = yes |
bag | Array | bag nums = [1, 2, 3] |
kit | Map (key→value) | kit p = ["hp": 100] |
Variables
whole x = 10
dotted pi = 3.14
words name = "PewPew"
vibe isAwesome = yes
bag scores = [95, 87, 100]
Reassignment (no type keyword needed):
x = 20
name = "BroPew"
Operators
» Arithmetic
whole a = 10 + 5 // 15
whole b = 10 - 3 // 7
whole c = 4 * 3 // 12
whole d = 10 / 2 // 5
whole e = 10 % 3 // 1
» Comparison
x == y // equal
x != y // not equal
x > y // greater than
x < y // less than
x >= y // greater than or equal
x <= y // less than or equal
» Logical
x && y // AND
x || y // OR
!x // NOT
» String Concatenation
words msg = "Hello " + "World"
yell("Score: " + 100)
Conditions
check (x > 5) {
yell("x is big fr")
} nah {
yell("x is smol")
}
Without else:
check (x == 10) {
yell("x is ten!")
}
Else-if chains with nah check:
check (x % 15 == 0) {
yell("PewPew")
} nah check (x % 3 == 0) {
yell("Pew")
} nah check (x % 5 == 0) {
yell("Pew")
} nah {
yell(x)
}
Loops
» While-style loop
whole i = 0
loop (i < 5) {
yell("i is: " + i)
i = i + 1
}
» Repeat loop
repeat 5 times {
yell("pew!")
}
whole n = 3
repeat n times {
yell("brrrr")
}
» Foreach loop (over bags)
bag names = ["pew", "bro", "yo"]
foreach name in names {
yell("Hey " + name)
}
Functions
do add(whole a, whole b) {
gimme a + b
}
whole result = add(5, 10)
yell("Result: " + result)
Functions with no return:
do greet(words name) {
yell("Yo " + name + "!")
}
greet("PewPew")
» Functions are first-class
A do can be passed around by its bare name (no quotes, no call parens) — it
becomes a function value. Mainly used to hand route handlers to the http
module:
do home(words method, words path, words body) { gimme "yo" }
http->route(8080, home) // pass the do itself, not "home"
whatisthis(home) reports do (the type word — skins print their own spelling, e.g. func in the professional skin).
Bags (Arrays)
Bags are PewPew's version of arrays.
bag scores = [95, 87, 42, 100, 73]
yell(scores) // print whole bag
yell(sizeof(scores)) // get size
yell(peek(scores, 0)) // access item at index
swap(scores, 2, 99) // update item at index
toss(scores, 55) // add item to end
whole last = yoink(scores) // remove and return last item
check (inside(scores, 100)) {
yell("100 is in the bag fr!")
}
foreach score in scores {
yell("Score: " + score)
}
Kits (Maps)
Kits are PewPew's key→value type (a map / object). Keys are strings.
kit player = ["name": "pew", "hp": 100, "level": 3]
yell(player) // print whole kit
yell(player["hp"]) // read by key -> 100
player["hp"] = 50 // update a key
player["xp"] = 999 // add a new key
yell(player["mana"]) // missing key -> nothing
kit empty = [:] // empty kit (the colon distinguishes it from [])
yell(sizeof(player)) // number of keys
check (has(player, "hp")) { // key exists?
yell("got hp")
}
foreach k in player { // iterate keys
yell(k + " = " + player[k])
}
Kits and bags nest freely:
kit inventory = ["items": ["sword", "shield"], "gold": 42]
yell(inventory["items"]) // [sword, shield]
Built-in Functions
» Output
| Function | Description | Example |
|---|---|---|
yell(x) | Print x with newline | yell("Yo!") |
YELL(x) | Print x in UPPERCASE | YELL("loud") |
» Bag Operations
| Function | Description | Example |
|---|---|---|
sizeof(bag) | Returns length of bag | sizeof(nums) |
peek(bag, i) | Returns item at index i | peek(nums, 0) |
swap(bag, i, val) | Updates item at index i | swap(nums, 0, 99) |
toss(bag, val) | Adds item to end of bag | toss(nums, 42) |
yoink(bag) | Removes + returns last item | yoink(nums) |
inside(bag, val) | Returns yes/no if val exists | inside(nums, 5) |
» Kit Operations
| Function | Description | Example |
|---|---|---|
kit[key] | Read value by key (missing→nothing) | player["hp"] |
kit[key] = val | Set / add a key | player["hp"] = 50 |
sizeof(kit) | Number of keys | sizeof(player) |
has(kit, key) | Returns yes/no if key exists | has(player, "hp") |
keys(kit) | Returns a bag of the keys | keys(player) |
foreach k in kit | Iterate over keys | foreach k in player |
» Utility
| Function | Description | Example |
|---|---|---|
rolldice(n) | Random number between 0 and n | rolldice(100) |
chill(n) | Sleep for n seconds | chill(2) |
whatisthis(x) | Prints the type of x | whatisthis(42) |
sweardown(cond) | Assert — crashes if condition false | sweardown(x > 0) |
Comments
// this is a single line comment
whole x = 10 // inline comment
Example Programs
» Hello World
yell("Yo World!")
» FizzBuzz
whole i = 1
loop (i <= 20) {
check (i % 15 == 0) {
yell("PewPew")
} nah check (i % 3 == 0) {
yell("Pew")
} nah check (i % 5 == 0) {
yell("Pew")
} nah {
yell(i)
}
i = i + 1
}
» Functions + Bags
do sum(bag nums) {
whole total = 0
foreach n in nums {
total = total + n
}
gimme total
}
bag scores = [10, 20, 30, 40]
whole result = sum(scores)
yell("Total: " + result)
» Goofy Mode
whole x = rolldice(100)
yell("You rolled: " + x)
whatisthis(x)
YELL("this is loud fr")
sweardown(x >= 0)
chill(1)
yell("okay im back")