Promtgen Lang
Few days ago, I made a few prompts with responses in the shape of webpages. It was a sort of interactive birthday card I hacked together for a friend, with a combination of a crudely made DSL, a parser, and eleventy site generator.
The most interesting part of the whole exercise was the DSL. Here's a sample of the it.
> (NO) "Are you a human?"
< (YES) "Yes, I am"
< (ANS_NO) "No"
> (ANS_NO) "That's very weird! Care to try again?"
< (NO) "Please!"
> (YES) "Nice! Glad to meet you human!"
Each right angular bracket conveys a prompt, and each left angular bracket conveys a possible response for the prompt it follows. Responding with an unlabelled response would move the user to the next prompt, responding with a labelled response would lead to user to the prompt with the corresponding label.
It seemed simple enough, but it started to get tricky with reporting syntax error appropriately & validating if some path end up in a final message. Those will probably be there when I end up implementing a system to actually use these prompts (maybe on someone else's birthday), with validation and path check and so on and so forth. For now, I just re-wrote the parser that will construct the datastructure of prompts and their responses.