80% of the shell is just a normal interpreter. Crafting Interpreters (http://craftinginterpreters.com) is a pretty popular book for that.
The remaining parts are stuff about process and file semantics - you can find that in APUE, or really from reading manpages. You also need to learn the arcane VT100 escape sequences for the TUI, and there are plenty of articles for that too.
There are so many cool shells out there — I would suggest studying the source code of any of the popular ones written in a modern high level typed language. That way navigating the code-base to understand how things are done will be easy. No point looking at old crusty codebases written in C.
Elvish is written in golang. I’m sure that’s going to be quite grokkable if you want to understand how a shell is written ?
> No point looking at old crusty codebases written in C.
I understand why someone might not want to start there, but I think that could be a bit short-sighted. I think people are far too quick to dismiss code that's old. Yeah, it may have a lot of warts (for a lot of reasons, some more valid than others), but that doe not negate the value of understanding how something was implemented.
I'm also not suggesting this would be easy. There are some very complicated C codebases out there. I'm just saying that I disagree that there's no point in examining them.
This looks very cool, and I've been having a lot of inspiration to write my own shell, but I want to make it vaguely compatible with my system.
POSIX compatibility might be overkill for the start.