Sometimes, there is a challenge in writing a small smart script that understands a certain embedded grammar, that is, with a mini-language within. Initially, I created a minimal implementation of jq in bash. However, as more "intelligence" was added, it became increasingly difficult to implement the recursive parsing of sub-expressions. This became so tiresome that it led me to first write a LARL(1) yacc (pre-bison) compiler to generate bash scripts, and then it smoothly resulted in a rather similar and good verification code for yacc_bash.c mini-jq in bash.
Full article:
Source: linux.org.ru
