Recursive descent parser for Bash scripts.
Converts tokens from the Tokenizer into AST nodes.
Grammar Overview
The parser follows Bash's grammar from parse.y:
script → statement_list EOF
statement → simple_command
| compound_command
| pipeline
| control_flow
pipeline → command ('|' command)*
command → simple_command redirect*
simple_cmd → assignment* name word* redirect*
compound_cmd → '{' list '}'
| '(' list ')'
| if_clause
| for_clause
| while_clause
| case_clause
| function_def
Summary
Functions
Parse a Bash script string into an AST.
Types
@type state() :: %{tokens: [token()], pos: non_neg_integer()}
@type token() :: Bash.Tokenizer.token()
Functions
@spec parse(String.t()) :: {:ok, Bash.Script.t()} | {:error, String.t(), pos_integer(), pos_integer()}
Parse a Bash script string into an AST.