Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Add standardTemplate = standardTemplate{ Body: `%s %s i64.add %s`, Inputs: []string{"a", "b"}, Outputs: []string{"result"}, FormatBody: func(t standardTemplate, nodeId string, varMap map[string]*ast.Junction) string { a := varMap[utils.JunctionKey(nodeId, "a")] b := varMap[utils.JunctionKey(nodeId, "b")] return fmt.Sprintf(t.Body, mapVarJunctionVariableGet(a), mapVarJunctionVariableGet(b), mapVarJunctionVariableSet(nodeId, t.Outputs[0]), ) }, }
View Source
var Divide standardTemplate = standardTemplate{ Body: `%s %s i64.div_s %s`, Inputs: []string{"a", "b"}, Outputs: []string{"result"}, FormatBody: func(t standardTemplate, nodeId string, varMap map[string]*ast.Junction) string { a := varMap[utils.JunctionKey(nodeId, "a")] b := varMap[utils.JunctionKey(nodeId, "b")] return fmt.Sprintf(t.Body, mapVarJunctionVariableGet(a), mapVarJunctionVariableGet(b), mapVarJunctionVariableSet(nodeId, t.Outputs[0]), ) }, }
View Source
var GetMemory = standardTemplate{ Body: `call $_get i64.extend_i32_s %s`, Outputs: []string{"value"}, FormatBody: func(t standardTemplate, nodeId string, nodeVarMap map[string]*ast.Junction) string { return fmt.Sprintf(t.Body, mapVarJunctionVariableSet(nodeId, t.Outputs[0])) }, }
View Source
var Modulo standardTemplate = standardTemplate{ Body: `%s %s i64.rem_s %s`, Inputs: []string{"a", "b"}, Outputs: []string{"result"}, FormatBody: func(t standardTemplate, nodeId string, varMap map[string]*ast.Junction) string { a := varMap[utils.JunctionKey(nodeId, "a")] b := varMap[utils.JunctionKey(nodeId, "b")] return fmt.Sprintf(t.Body, mapVarJunctionVariableGet(a), mapVarJunctionVariableGet(b), mapVarJunctionVariableSet(nodeId, t.Outputs[0]), ) }, }
View Source
var Move standardTemplate = standardTemplate{ Body: `%s i32.wrap_i64 call $_move`, Inputs: []string{"direction"}, FormatBody: func(t standardTemplate, nodeId string, nodeVarMap map[string]*ast.Junction) string { direction := nodeVarMap[utils.JunctionKey(nodeId, t.Inputs[0])] return fmt.Sprintf(t.Body, mapVarJunctionVariableGet(direction)) }, }
View Source
var Multiply standardTemplate = standardTemplate{ Body: `%s %s i64.mul %s`, Inputs: []string{"a", "b"}, Outputs: []string{"result"}, FormatBody: func(t standardTemplate, nodeId string, varMap map[string]*ast.Junction) string { a := varMap[utils.JunctionKey(nodeId, "a")] b := varMap[utils.JunctionKey(nodeId, "b")] return fmt.Sprintf(t.Body, mapVarJunctionVariableGet(a), mapVarJunctionVariableGet(b), mapVarJunctionVariableSet(nodeId, t.Outputs[0]), ) }, }
View Source
var Print standardTemplate = standardTemplate{ Body: `%s i32.wrap_i64 call $_log`, Inputs: []string{"text"}, FormatBody: func(t standardTemplate, nodeId string, nodeVarMap map[string]*ast.Junction) string { text := nodeVarMap[utils.JunctionKey(nodeId, t.Inputs[0])] return fmt.Sprintf(t.Body, mapVarJunctionVariableGet(text)) }, }
View Source
var SetMemory = standardTemplate{ Body: `%s i32.wrap_i64 call $_set`, Inputs: []string{"value"}, FormatBody: func(t standardTemplate, nodeId string, nodeVarMap map[string]*ast.Junction) string { value := nodeVarMap[utils.JunctionKey(nodeId, t.Inputs[0])] return fmt.Sprintf(t.Body, mapVarJunctionVariableGet(value)) }, }
View Source
var StandardTemplates = map[string]*standardTemplate{ "Print": &Print, "Add": &Add, "Subtract": &Subtract, "Multiply": &Multiply, "Divide": &Divide, "Modulo": &Modulo, "Move": &Move, "SetMemory": &SetMemory, "GetMemory": &GetMemory, }
View Source
var Subtract standardTemplate = standardTemplate{ Body: `%s %s i64.sub %s`, Inputs: []string{"a", "b"}, Outputs: []string{"result"}, FormatBody: func(t standardTemplate, nodeId string, varMap map[string]*ast.Junction) string { a := varMap[utils.JunctionKey(nodeId, "a")] b := varMap[utils.JunctionKey(nodeId, "b")] return fmt.Sprintf(t.Body, mapVarJunctionVariableGet(a), mapVarJunctionVariableGet(b), mapVarJunctionVariableSet(nodeId, t.Outputs[0]), ) }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.