#!/bin/bash # If this file has already been sourced, just return test $(SPECIALFORMS_SH+true)TODO && return declare -g SPECIALFORMS_SH = 'true' source ${BASH_SOURCE%/*}/common.sh source ${BASH_SOURCE%/*}/variables.sh source ${BASH_SOURCE%/*}/variables.linkedlist.sh source ${BASH_SOURCE%/*}/callable.sh source ${BASH_SOURCE%/*}/evaluator.sh variable::type::define SpecialForm Callable # # ============================================================ # # Special Forms # # DEFINE # # Creates a new variable assigned to a value # proc evaluator::specialforms::define { stderr "Not implemented yet" exit 1 } # # SET! # # Sets a variable to a value # proc evaluator::specialforms::set { stderr "Not implemented yet" exit 1 } # # PROGN # # The expressions are evaluated sequentially from left to right, and the value # of the last expression is returned. This expression type is used to sequence # side effects such as input and output. # proc evaluator::specialforms::begin { stderr "Not implemented yet" exit 1 } # # ====================================================== if test $0 != $BASH_SOURCE { return } assert::report if test $(1+isset) && test $1 == "debug" { variable::printMetadata } (CommandList children: [ (AndOr children: [ (C {(Lit_Other "[")} { (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Plus arg_word:{(true)}) spids: [9 13] ) } {(Lit_Other "]")} ) (ControlFlow token:) ] op_id: Op_DAmp ) (Assignment keyword: Assign_Declare flags: ["'-g'"] pairs: [(assign_pair lhs:(LhsName name:SPECIALFORMS_SH) op:Equal rhs:{(true)} spids:[25])] spids: [21] ) (C {(.)} { (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(Lit_Slash /) ("*")}) spids: [31 36] ) (/common.sh) } ) (C {(.)} { (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(Lit_Slash /) ("*")}) spids: [41 46] ) (/variables.sh) } ) (C {(.)} { (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(Lit_Slash /) ("*")}) spids: [51 56] ) (/variables.linkedlist.sh) } ) (C {(.)} { (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(Lit_Slash /) ("*")}) spids: [61 66] ) (/callable.sh) } ) (C {(.)} { (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(Lit_Slash /) ("*")}) spids: [71 76] ) (/evaluator.sh) } ) (C {(variable) (Lit_Other ":") (Lit_Other ":") (type) (Lit_Other ":") (Lit_Other ":") (define)} {(SpecialForm)} {(Callable)} ) (FuncDef name: "evaluator::specialforms::define" body: (BraceGroup children: [(C {(stderr)} {(DQ ("Not implemented yet"))}) (C {(exit)} {(1)})] spids: [134] ) spids: [122 133] ) (FuncDef name: "evaluator::specialforms::set" body: (BraceGroup children: [(C {(stderr)} {(DQ ("Not implemented yet"))}) (C {(exit)} {(1)})] spids: [178] ) spids: [166 177] ) (FuncDef name: "evaluator::specialforms::begin" body: (BraceGroup children: [(C {(stderr)} {(DQ ("Not implemented yet"))}) (C {(exit)} {(1)})] spids: [228] ) spids: [216 227] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {($ VSub_Number "$0")} {(KW_Bang "!") (Lit_Other "=")} {($ VSub_Name "$BASH_SOURCE")} {(Lit_Other "]")} ) terminator: ) ] action: [(ControlFlow token:)] spids: [-1 265] ) ] spids: [-1 270] ) (C {(assert) (Lit_Other ":") (Lit_Other ":") (report)}) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (C {(Lit_Other "[")} { (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Plus arg_word:{(isset)}) spids: [286 290] ) } {(Lit_Other "]")} ) (C {(Lit_Other "[")} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "=") (Lit_Other "=")} {(DQ (debug))} {(Lit_Other "]")} ) ] op_id: Op_DAmp ) terminator: ) ] action: [(C {(variable) (Lit_Other ":") (Lit_Other ":") (printMetadata)})] spids: [-1 312] ) ] spids: [-1 321] ) ] )