Writing a recursive descent parser in Bash