The grammar of the POSIX shell (and derivatives) is not an LR-parsed language that can be implemented with yacc.
It requires an advanced parser.
There is an effort with OCaml (and another with ADA) to create a formal and secure parser. They remark that dash is a handcrafted parser in C that cannot be formally assured.