(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) } ) (C {(source)} { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:24) command_list: (command.CommandList children:[(C {(dirname)} {($ Id.VSub_Number '$0')})]) ) (/env.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: [55] ) ] ) (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:117) ) (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 {(ENV_GET)} {(DQ (${ Id.VSub_Name env))} {(DQ (${ Id.VSub_Name ast))}) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:159) ) ] spids: [140 141 161 -1] ) (case_arm pat_list: [{(list)}] action: [ (C {(_map_with_type)} {(_list)} {(EVAL)} {(DQ (${ Id.VSub_Name ast))} {(DQ (${ Id.VSub_Name env))} ) ] spids: [164 165 186 -1] ) (case_arm pat_list: [{(vector)}] action: [ (C {(_map_with_type)} {(_vector)} {(EVAL)} {(DQ (${ Id.VSub_Name ast))} {(DQ (${ Id.VSub_Name env))} ) ] spids: [189 190 211 -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:233) 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:246) ) (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:264) ) ('{!') (${ 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:291) ) ('{') (${ Id.VSub_Name hm) ('[') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:297) ) (${ Id.VSub_Name key) (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:301) ) (']}') ) } ) (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: [346] ) ] ) ] spids: [214 215 353 -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: [360] ) ] ) ] spids: [356 357 367 -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: [400] ) ] ) (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:415) arg_word: {(1)} ) ] ) (command.Sentence child: (C {(_obj_type)} {(DQ (${ Id.VSub_Name ast))}) terminator: (Token id:Id.Op_Semi val:';' span_id:431) ) (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:460) ) ] 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:480) ) ] spids: [443 462] ) ] ) (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: [497] ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:506) ) ] ) (command.Sentence child: (C {(_nth)} {(DQ (${ Id.VSub_Name ast))} {(0)}) terminator: (Token id:Id.Op_Semi val:';' span_id:523) ) (C {(local)} {(Id.Lit_VarLike 'a0=') (DQ (${ Id.VSub_Name r))}) (command.Sentence child: (C {(_nth)} {(DQ (${ Id.VSub_Name ast))} {(1)}) terminator: (Token id:Id.Op_Semi val:';' span_id:544) ) (C {(local)} {(Id.Lit_VarLike 'a1=') (DQ (${ Id.VSub_Name r))}) (command.Sentence child: (C {(_nth)} {(DQ (${ Id.VSub_Name ast))} {(2)}) terminator: (Token id:Id.Op_Semi val:';' span_id:565) ) (C {(local)} {(Id.Lit_VarLike 'a2=') (DQ (${ Id.VSub_Name r))}) (command.Case to_match: { (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:ANON span_id:581) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w:{(DQ (${ Id.VSub_Name a0))}) ) ) ) } arms: [ (case_arm pat_list: [{(def) (Id.KW_Bang '!')}] action: [ (C {(EVAL)} {(DQ (${ Id.VSub_Name a2))} {(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:626) arg_word: {(1)} ) ] ) (C {(ENV_SET)} {(DQ (${ Id.VSub_Name env))} {(DQ (${ Id.VSub_Name a1))} {(DQ (${ Id.VSub_Name r))} ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:652) ) ] spids: [595 597 654 -1] ) (case_arm pat_list: [{(let) (Id.Lit_Star '*')}] action: [ (command.Sentence child: (C {(ENV)} {(DQ (${ Id.VSub_Name env))}) terminator: (Token id:Id.Op_Semi val:';' span_id:668) ) (C {(local)} {(Id.Lit_VarLike 'let_env=') (DQ (${ Id.VSub_Name r))}) (C {(local)} {(Id.Lit_VarLike 'let_pairs=') (sh_array_literal left: (Token id:Id.Op_LParen val:'(' span_id:683) words: [ { (braced_var_sub token: (Token id:Id.VSub_Name val:ANON span_id:685) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w:{(DQ (${ Id.VSub_Name a1))}) ) ) } ] ) } ) (C {(local)} {(Id.Lit_VarLike 'idx=') (0)}) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:707) cond: [ (command.Sentence child: (command.DBracket expr: (bool_expr.WordTest w: { (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:let_pairs span_id:713) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w: {(DQ (${ Id.VSub_Name idx))} ) ) ) ) } ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:725) ) ] body: (command.DoGroup children: [ (C {(EVAL)} { (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:let_pairs span_id:734) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: (arith_expr.VarRef token: (Token id: Id.Lit_ArithVarLike val: idx span_id: 738 ) ) right: (arith_expr.ArithWord w: {(Id.Lit_Digits 1)} ) ) ) } ) ) ) ) } {(DQ (${ Id.VSub_Name let_env))} ) (C {(ENV_SET)} {(DQ (${ Id.VSub_Name let_env))} { (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:let_pairs span_id:766) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w:{(${ Id.VSub_Name idx)}) ) ) ) } {(DQ (${ Id.VSub_Name r))} ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:idx) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: (arith_expr.VarRef token: (Token id: Id.Lit_ArithVarLike val: idx span_id: 785 ) ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 2)}) ) ) } spids: [782] ) ] ) ] ) ) (C {(EVAL)} {(DQ (${ Id.VSub_Name a2))} {(DQ (${ Id.VSub_Name let_env))}) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:812) ) ] spids: [657 659 814 -1] ) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [ (C {(EVAL_AST)} {(DQ (${ Id.VSub_Name ast))} {(DQ (${ Id.VSub_Name env))}) (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (command.DBracket expr: (bool_expr.WordTest w:{(DQ (${ Id.VSub_Name __ERROR))}) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:r) op: assign_op.Equal rhs: (word.Empty) spids: [847] ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:851) 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:873) ) (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:892) ) (C {(local)} {(Id.Lit_VarLike 'args=') (DQ (braced_var_sub token: (Token id:Id.VSub_Name val:ANON span_id:899) 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.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:926) ) ] spids: [817 818 928 -1] ) ] ) ] ) ) (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:958) ) ] 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: [974] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:__ERROR) op: assign_op.Equal rhs: (word.Empty) spids: [983] ) ] ) ] spids: [947 960] ) ] else_action: [(C {(_pr_str)} {(DQ (${ Id.VSub_Number 1))} {(yes)})] ) ] ) ) (command.CommandList children: [ (command.Sentence child: (C {(ENV)}) terminator: (Token id:Id.Op_Semi val:';' span_id:1009) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:REPL_ENV) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name r))} spids: [1011] ) ] ) ] ) (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: [1026] ) ] ) (C {(READ)} {(DQ (${ Id.VSub_Number 1))}) (C {(EVAL)} {(DQ (${ Id.VSub_Name r))} {(DQ (${ Id.VSub_Name 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:1075) 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:1088) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w: {(DQ (${ Id.VSub_Number 2))} ) ) ) } ) ) ) } spids: [1071] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:1100) ) (command.Sentence child: (C {(_number)} {(DQ (${ Id.VSub_Name r))}) terminator: (Token id:Id.Op_Semi val:';' span_id:1109) ) ] ) ) (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:1124) 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:1137) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w: {(DQ (${ Id.VSub_Number 2))} ) ) ) } ) ) ) } spids: [1120] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:1149) ) (command.Sentence child: (C {(_number)} {(DQ (${ Id.VSub_Name r))}) terminator: (Token id:Id.Op_Semi val:';' span_id:1158) ) ] ) ) (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:1173) 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:1186) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w: {(DQ (${ Id.VSub_Number 2))} ) ) ) } ) ) ) } spids: [1169] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:1198) ) (command.Sentence child: (C {(_number)} {(DQ (${ Id.VSub_Name r))}) terminator: (Token id:Id.Op_Semi val:';' span_id:1207) ) ] ) ) (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:1222) 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:1235) bracket_op: (bracket_op.ArrayIndex expr: (arith_expr.ArithWord w: {(DQ (${ Id.VSub_Number 2))} ) ) ) } ) ) ) } spids: [1218] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:1247) ) (command.Sentence child: (C {(_number)} {(DQ (${ Id.VSub_Name r))}) terminator: (Token id:Id.Op_Semi val:';' span_id:1256) ) ] ) ) (command.CommandList children: [ (command.Sentence child: (C {(_symbol)} {(DQ ('+'))}) terminator: (Token id:Id.Op_Semi val:';' span_id:1266) ) (C {(ENV_SET)} {(DQ (${ Id.VSub_Name REPL_ENV))} {(DQ (${ Id.VSub_Name r))} {(plus)}) ] ) (command.CommandList children: [ (command.Sentence child: (C {(_symbol)} {(DQ (-))}) terminator: (Token id:Id.Op_Semi val:';' span_id:1289) ) (C {(ENV_SET)} {(DQ (${ Id.VSub_Name REPL_ENV))} {(DQ (${ Id.VSub_Name r))} {(minus)}) ] ) (command.CommandList children: [ (command.Sentence child: (C {(_symbol)} {(DQ (__STAR__))}) terminator: (Token id:Id.Op_Semi val:';' span_id:1312) ) (C {(ENV_SET)} {(DQ (${ Id.VSub_Name REPL_ENV))} {(DQ (${ Id.VSub_Name r))} {(multiply)}) ] ) (command.CommandList children: [ (command.Sentence child: (C {(_symbol)} {(DQ (/))}) terminator: (Token id:Id.Op_Semi val:';' span_id:1335) ) (C {(ENV_SET)} {(DQ (${ Id.VSub_Name REPL_ENV))} {(DQ (${ Id.VSub_Name r))} {(divide)}) ] ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:1357) cond: [ (command.Sentence child: (C {(true)}) terminator: (Token id:Id.Op_Semi val:';' span_id:1360) ) ] 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:1373) 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))}) ] ) ] ) ) ] )