See also https://en.wikipedia.org/wiki/S-Lang (https://www.jedsoft.org/slang/index.html), a (stack-based) scripting language implementing a terminal UI toolkit. Mutt can use use S-Lang instead of ncurses.