input: list '\n' list EOF | '\n' | EOF list: and_or ((';'|'&') and_or)* ['&'|';'] and_or: pipeline (('&&'|'||') ('\n')* pipeline)* pipeline: ['!'] command ('|' ('\n')* command)* command: simple_command | shell_command (redirection)* | funcdec simple_command: (cmp_prefix)* (element)+ shell_command: '{' compound_list '}' | '(' compound_list ')' | rule_for | rule_while | rule_until | rule_case | rule_if funcdec: ['function'] WORD '(' ')' ('\n')* shell_command (redirection)* redirection: [NUMBER] '>' WORD | [NUMBER] '<' WORD | [NUMBER] '>>' WORD | [NUMBER] '<<' WORD | [NUMBER] '<<-' WORD | [NUMBER] '>&' WORD | [NUMBER] '<&' WORD | [NUMBER] '>|' WORD | [NUMBER] '<>' WORD cmd_prefix: ASSIGMENT_WORD | redirection element: WORD | redirection compound_list: ('\n')* and_or ((';'|'&'|'\n') ('\n')* and_or)* [(('&'|';'|'\n') ('\n')*)] rule_for: 'for' WORD ('\n')* ['in' (WORD)+ (';'|'\n') ('\n')*] do_group rule_while: 'while' compound_list do_group rule_until: 'until' compound_list do_group rule_case: 'case' WORD ('\n')* 'in' ('\n')* [case_clause] 'esac' rule_if: 'if' compound_list 'then' compound_list [else_clause] 'fi' else_clause: 'else' compound_list | 'elif' compound_list 'then' compound_list [else_clause] do_group: 'do' compound_list 'done' case_clause: case_item (';;' (\n)* case_item)* [;;] case_item: ['('] WORD ('|' WORD)* ')' ( ('\n')* | compound_list )