language: add unary plus & minus, post increment & decrement operators, non-newline print builtin. fix block comments (#4)

This commit is contained in:
a dinosaur
2023-09-11 14:34:10 +10:00
committed by GitHub
parent c3afd790b5
commit 8d310e337a
18 changed files with 235 additions and 32 deletions

20
examples/suffix.pork Normal file
View File

@ -0,0 +1,20 @@
/* Barber shop sign generator! */
func generatePole(width, height) {
var i = 0
while i < height {
let index = i++ mod width
var j = 0
while j < width {
if j == index { print("#") } else { print("_") }
j++
}
println()
}
}
export func main() {
println("nobody:")
println()
println("barber pole:")
generatePole(6, 18)
}