first.go
first.go is a tiny concatenative esolang that User:Zero created to get used to Go, as the creators first Golang program.
Overview
Family
The language is stack-based concatenative, but it reads backwards. When you type a command, you begin with the bottom of the program stack and you end with the top of the stack: foo dup bar will first push bar on the data stack, then dup it, then push foo on it, so you end up like
+-----------+ | foo | +-----------+ | bar | +-----------+ | bar | +-----------+
Data types
The only data type is strings, the language doesn't even know about numbers or booleans. For booleans, the string "1" means true, and anything else means false. For numbers, we can use the length of words to simulate values, like ||| means 3. Well, since you can do a lot with the programming language Thue, I guess you can do a lot with this one too (we have a "find and replace" function).
Grouping
Many concatenative languages use brackets or parentheses to group things and nest them. There's no grouping in first.go, but the underscore characters are always automatically replaced by space characters, which allows easier function definitions. Nesting is byebye though.
Vocabulary
The following verbs are available: pop, dup, pick, swap, popd, popop, dupd, swapd, rollup, rolldown, choice, output, input, cons, uncons, append, remove, replace, removeall, replaceall, do, get, set, def, if, ife, and, or, not, equals, contains, prefix, suffix, quote, nothing, space.
External resources
- Github readme, which contains the complete first.go manual.
- Compiled windows executable, which accepts a -tron command-line option to show execution steps.