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

This commit is contained in:
2023-09-11 14:13:08 +10:00
parent f6d2fc5165
commit 36b574bf5b
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)
}