lisp (.) notation works for nice compact level notation aka outside (.) is parent environment, inside (.) is various levels of () abstraction, evaluating pair of () gives result of the () application evaluated. Where something like the bash shell, the (.) is what happens in the shell file, outside of the (.) is the command line environment, and inside () may be multiple nested shell file abstraction/other shell file references. Note: can extend the (.) concept to spreadsheets, where each cell in spread sheet is shell file & spreadsheet is "file directory".
Could check out how treesitter is used in vim/neovim vs. emacs. and/or 70's tex & nroff put together things.
ed fairly barebones editor, one step up from command line sed.
Slightly more modern approach, search engine term 'text editor written in ' adding language of choice/familiar with after 'in' aka 'text editor writtin in bash'. play around with source code.