jansegers is a user on mastodon.host. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.
jansegers @jansegers

Generate an understandable sentence

Rust + Toki Pona

Any language is accepted, so I wrote a program in Rust that generates some sentences in Toki Pona.

Toki Pona is an attempt to create a minimal natural language, and it has a super simple and regular grammar. That's a very useful property for this contest!

[...]

I don't speak Toki Pona, but I found the syntax of Toki Pona as a set of BNF rules on Wikipedia. I created one struct or enum for each BNF rule, and I annotated them with deriving(Rand), which gives me a way to generate a random Phrase struct for free! Then, I implemented ToStr for each of these structs to convert them to a string.

[...]

codegolf.stackexchange.com/que

· Web · 0 · 0