(command.CommandList children: [ (C {(source)} { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:6) command_list: (command.CommandList children:[(C {(dirname)} {($ Id.VSub_Number '$0')})]) ) (/reader.sh) } ) (C {(source)} { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:15) command_list: (command.CommandList children:[(C {(dirname)} {($ Id.VSub_Number '$0')})]) ) (/printer.sh) } ) (command.ShFunction name: READ body: (command.BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DPipe] children: [ (C {(Id.Lit_LBracket '[')} {(DQ (${ Id.VSub_Number 1))} {(Id.Lit_RBracket ']')}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:r) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Number 1))} spids: [46] ) ] ) (C {(READLINE)}) ] ) (C {(READ_STR)} {(DQ (${ Id.VSub_Name r))}) ] ) ) (command.ShFunction name: EVAL_AST body: (command.BraceGroup children: [ (C {(local)} {(Id.Lit_VarLike 'ast=') (DQ (${ Id.VSub_Number 1))} {(Id.Lit_VarLike 'env=') (DQ (${ Id.VSub_Number 2))} ) (command.Sentence child: (C {(_obj_type)} {(DQ (${ Id.VSub_Name ast))}) terminator: (Token id:Id.Op_Semi val:';' span_id:108) ) (C {(local)} {(Id.Lit_VarLike 'ot=') (DQ (${ Id.VSub_Name r))}) (command.Case to_match: {(DQ (${ Id.VSub_Name ot))} arms: [ (case_arm pat_list: [{(symbol)}] action: [ (C {(local)} {(Id.Lit_VarLike 'val=') (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:ANON span_id:140) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w:{(DQ (${ Id.VSub_Name ast))}) ) ) ) } ) (C {(eval)} {(Id.Lit_VarLike 'r=') (DQ (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:156) ) ('{') (${ Id.VSub_Name env) ('[') ) (${ Id.VSub_Name val) (DQ (']}')) } ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(Id.Lit_LBracket '[')} {(DQ (${ Id.VSub_Name r))} {(Id.Lit_RBracket ']')}) (C {(_error)} {(DQ ("'") (${ Id.VSub_Name val) ("' not found"))}) ] ) ] spids: [131 132 193 -1] ) (case_arm pat_list: [{(list)}] action: [ (C {(_map_with_type)} {(_list)} {(EVAL)} {(DQ (${ Id.VSub_Name ast))} {(DQ (${ Id.VSub_Name env))} ) ] spids: [196 197 218 -1] ) (case_arm pat_list: [{(vector)}] action: [ (C {(_map_with_type)} {(_vector)} {(EVAL)} {(DQ (${ Id.VSub_Name ast))} {(DQ (${ Id.VSub_Name env))} ) ] spids: [221 222 243 -1] ) (case_arm pat_list: [{(hash_map)}] action: [ (C {(local)} {(Id.Lit_VarLike 'res=') (DQ )} {(Id.Lit_VarLike 'key=')} {(Id.Lit_VarLike 'val=') (DQ )} {(Id.Lit_VarLike 'hm=') (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:ANON span_id:265) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w:{(DQ (${ Id.VSub_Name ast))}) ) ) ) } ) (command.Sentence child: (C {(_hash_map)}) terminator: (Token id:Id.Op_Semi val:';' span_id:278) ) (C {(local)} {(Id.Lit_VarLike 'new_hm=') (DQ (${ Id.VSub_Name r))}) (C {(eval)} {(local)} {(Id.Lit_VarLike 'keys=') (DQ (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:296) ) ('{!') (${ Id.VSub_Name hm) ('[@]}') ) } ) (command.ForEach iter_name: key iter_words: [{(${ Id.VSub_Name keys)}] do_arg_iter: F body: (command.DoGroup children: [ (C {(eval)} {(Id.Lit_VarLike 'val=') (DQ (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\$' span_id:323) ) ('{') (${ Id.VSub_Name hm) ('[') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:329) ) (${ Id.VSub_Name key) (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:333) ) (']}') ) } ) (C {(EVAL)} {(DQ (${ Id.VSub_Name val))} {(DQ (${ Id.VSub_Name env))}) (C {(_assoc) (Id.KW_Bang '!')} {(DQ (${ Id.VSub_Name new_hm))} {(DQ (${ Id.VSub_Name key))} {(DQ (${ Id.VSub_Name r))} ) ] ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:r) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name new_hm))} spids: [378] ) ] ) ] spids: [246 247 385 -1] ) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:r) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name ast))} spids: [392] ) ] ) ] spids: [388 389 399 -1] ) ] ) ] ) ) (command.ShFunction name: EVAL body: (command.BraceGroup children: [ (C {(local)} {(Id.Lit_VarLike 'ast=') (DQ (${ Id.VSub_Number 1))} {(Id.Lit_VarLike 'env=') (DQ (${ Id.VSub_Number 2))} ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:r) op: assign_op.Equal rhs: (word.Empty) spids: [432] ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DBracket expr: (bool_expr.WordTest w:{(DQ (${ Id.VSub_Name __ERROR))}) ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:447) arg_word: {(1)} ) ] ) (command.Sentence child: (C {(_obj_type)} {(DQ (${ Id.VSub_Name ast))}) terminator: (Token id:Id.Op_Semi val:';' span_id:463) ) (C {(local)} {(Id.Lit_VarLike 'ot=') (DQ (${ Id.VSub_Name r))}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobNEqual left: {(DQ (${ Id.VSub_Name ot))} right: {(DQ (list))} ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:492) ) ] action: [ (C {(EVAL_AST)} {(DQ (${ Id.VSub_Name ast))} {(DQ (${ Id.VSub_Name env))}) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:512) ) ] spids: [475 494] ) ] ) (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (C {(_empty) (Id.Lit_QMark '?')} {(DQ (${ Id.VSub_Name ast))}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:r) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name ast))} spids: [529] ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:538) ) ] ) (C {(EVAL_AST)} {(DQ (${ Id.VSub_Name ast))} {(DQ (${ Id.VSub_Name env))}) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DBracket expr: (bool_expr.WordTest w:{(DQ (${ Id.VSub_Name __ERROR))}) ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:573) arg_word: {(1)} ) ] ) (C {(local)} {(Id.Lit_VarLike 'el=') (DQ (${ Id.VSub_Name r))}) (command.Sentence child: (C {(_first)} {(DQ (${ Id.VSub_Name el))}) terminator: (Token id:Id.Op_Semi val:';' span_id:595) ) (C {(local)} {(Id.Lit_VarLike 'f=') (DQ (${ Id.VSub_Name r))}) (command.Sentence child: (C {(_rest)} {(DQ (${ Id.VSub_Name el))}) terminator: (Token id:Id.Op_Semi val:';' span_id:614) ) (C {(local)} {(Id.Lit_VarLike 'args=') (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:ANON span_id:621) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w:{(DQ (${ Id.VSub_Name r))}) ) ) ) } ) (C {(eval)} {(${ Id.VSub_Name f)} {(${ Id.VSub_Name args)}) ] ) ) (command.ShFunction name: PRINT body: (command.BraceGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.WordTest w:{(DQ (${ Id.VSub_Name __ERROR))}) ) terminator: (Token id:Id.Op_Semi val:';' span_id:672) ) ] action: [ (C {(_pr_str)} {(DQ (${ Id.VSub_Name __ERROR))} {(yes)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:r) op: assign_op.Equal rhs: {(DQ ('Error: ') (${ Id.VSub_Name r))} spids: [688] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:__ERROR) op: assign_op.Equal rhs: (word.Empty) spids: [697] ) ] ) ] spids: [661 674] ) ] else_action: [(C {(_pr_str)} {(DQ (${ Id.VSub_Number 1))} {(yes)})] ) ] ) ) (C {(declare)} {(-A)} {(REPL_ENV)}) (command.ShFunction name: REP body: (command.BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:r) op: assign_op.Equal rhs: (word.Empty) spids: [736] ) ] ) (C {(READ)} {(DQ (${ Id.VSub_Number 1))}) (C {(EVAL)} {(DQ (${ Id.VSub_Name r))} {(REPL_ENV)}) (C {(PRINT)} {(DQ (${ Id.VSub_Name r))}) ] ) ) (command.ShFunction name: plus body: (command.BraceGroup children: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:r) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: (arith_expr.ArithWord w: { (braced_var_sub token: (Token id:Id.VSub_Name val:ANON span_id:781) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w: {(DQ (${ Id.VSub_Number 1))} ) ) ) } ) right: (arith_expr.ArithWord w: { (braced_var_sub token: (Token id:Id.VSub_Name val:ANON span_id:794) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w: {(DQ (${ Id.VSub_Number 2))} ) ) ) } ) ) ) } spids: [777] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:806) ) (command.Sentence child: (C {(_number)} {(DQ (${ Id.VSub_Name r))}) terminator: (Token id:Id.Op_Semi val:';' span_id:815) ) ] ) ) (command.ShFunction name: minus body: (command.BraceGroup children: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:r) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Minus left: (arith_expr.ArithWord w: { (braced_var_sub token: (Token id:Id.VSub_Name val:ANON span_id:830) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w: {(DQ (${ Id.VSub_Number 1))} ) ) ) } ) right: (arith_expr.ArithWord w: { (braced_var_sub token: (Token id:Id.VSub_Name val:ANON span_id:843) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w: {(DQ (${ Id.VSub_Number 2))} ) ) ) } ) ) ) } spids: [826] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:855) ) (command.Sentence child: (C {(_number)} {(DQ (${ Id.VSub_Name r))}) terminator: (Token id:Id.Op_Semi val:';' span_id:864) ) ] ) ) (command.ShFunction name: multiply body: (command.BraceGroup children: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:r) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Star left: (arith_expr.ArithWord w: { (braced_var_sub token: (Token id:Id.VSub_Name val:ANON span_id:879) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w: {(DQ (${ Id.VSub_Number 1))} ) ) ) } ) right: (arith_expr.ArithWord w: { (braced_var_sub token: (Token id:Id.VSub_Name val:ANON span_id:892) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w: {(DQ (${ Id.VSub_Number 2))} ) ) ) } ) ) ) } spids: [875] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:904) ) (command.Sentence child: (C {(_number)} {(DQ (${ Id.VSub_Name r))}) terminator: (Token id:Id.Op_Semi val:';' span_id:913) ) ] ) ) (command.ShFunction name: divide body: (command.BraceGroup children: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:r) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Slash left: (arith_expr.ArithWord w: { (braced_var_sub token: (Token id:Id.VSub_Name val:ANON span_id:928) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w: {(DQ (${ Id.VSub_Number 1))} ) ) ) } ) right: (arith_expr.ArithWord w: { (braced_var_sub token: (Token id:Id.VSub_Name val:ANON span_id:941) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w: {(DQ (${ Id.VSub_Number 2))} ) ) ) } ) ) ) } spids: [924] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:953) ) (command.Sentence child: (C {(_number)} {(DQ (${ Id.VSub_Name r))}) terminator: (Token id:Id.Op_Semi val:';' span_id:962) ) ] ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.IndexedName name:REPL_ENV index:(arith_expr.ArithWord w:{(DQ ('+'))})) op: assign_op.Equal rhs: {(plus)} spids: [967] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.IndexedName name:REPL_ENV index:(arith_expr.ArithWord w:{(DQ (-))})) op: assign_op.Equal rhs: {(minus)} spids: [978] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.IndexedName name:REPL_ENV index:(arith_expr.ArithWord w:{(DQ (__STAR__))})) op: assign_op.Equal rhs: {(multiply)} spids: [989] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.IndexedName name:REPL_ENV index:(arith_expr.ArithWord w:{(DQ (/))})) op: assign_op.Equal rhs: {(divide)} spids: [1000] ) ] ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:1015) cond: [ (command.Sentence child: (C {(true)}) terminator: (Token id:Id.Op_Semi val:';' span_id:1018) ) ] body: (command.DoGroup children: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(READLINE)} {(DQ ('user> '))}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:1031) arg_word: {(DQ ($ Id.VSub_QMark '$?'))} ) ] ) (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (command.DBracket expr:(bool_expr.WordTest w:{(DQ (${ Id.VSub_Name r))})) (C {(REP)} {(DQ (${ Id.VSub_Name r))}) (C {(echo)} {(DQ (${ Id.VSub_Name r))}) ] ) ] ) ) ] )