From bcd76c19842a540110bfdf2461c1ee94da19c59a Mon Sep 17 00:00:00 2001 From: kumaraswamy Date: Mon, 16 Feb 2026 01:56:38 +0530 Subject: [PATCH 1/8] feat: start matrix block support --- lang/code/ast/common/func_call.go | 14 +++++++++- lang/code/parsers/blocklytomist/parser.go | 31 +++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/lang/code/ast/common/func_call.go b/lang/code/ast/common/func_call.go index 6cccf249..832edbe1 100644 --- a/lang/code/ast/common/func_call.go +++ b/lang/code/ast/common/func_call.go @@ -80,6 +80,8 @@ var signatures = map[string]*FuncCallSignature{ "makeColor": makeSignature("makeColor", 1, ast.SignNumb), "splitColor": makeSignature("splitColor", 1, ast.SignList), + "makeNdArray": makeSignature("makeNdArray", 2, ast.SignList), + "set": makeSignature("set", 4, ast.SignVoid), "get": makeSignature("get", 3, ast.SignAny), "call": makeSignature("call", -1-(3), ast.SignVoid), @@ -180,17 +182,20 @@ func (f *FuncCall) Blockly(flags ...bool) ast.Block { case "getPlainStartText": return f.ctrlSimpleBlock("controls_getPlainStartText") case "closeScreenWithPlainText": + return f.closeScreenWithPlainText() case "copyList": return f.copyList() case "copyDict": return f.copyDict() - case "makeColor": return f.makeColor() case "splitColor": return f.splitColor() + case "makeNdArray": + return f.makeNdArray() + case "set": return f.genericSet() case "get": @@ -318,6 +323,13 @@ func (f *FuncCall) genericSet() ast.Block { } } +func (f *FuncCall) makeNdArray() ast.Block { + return ast.Block{ + Type: "matrices_create_multidim", + Values: ast.MakeValues(f.Args, "DIM", "INITIAL"), + } +} + func (f *FuncCall) splitColor() ast.Block { return ast.Block{ Type: "color_make_color", diff --git a/lang/code/parsers/blocklytomist/parser.go b/lang/code/parsers/blocklytomist/parser.go index 15890ed7..40401b8b 100644 --- a/lang/code/parsers/blocklytomist/parser.go +++ b/lang/code/parsers/blocklytomist/parser.go @@ -216,6 +216,11 @@ func (p *Parser) parseBlock(block ast.Block) ast.Expr { case "math_convert_angles": return p.mathConvertAngles(block) + case "matrices_create": + return p.matricesCreate(block) + case "matrices_create_multidim": + return p.matricesNdArray(block) + case "lists_create_with": return &fundamentals.List{Elements: p.fromMinVals(block.Values, 0)} case "lists_add_items": @@ -947,6 +952,32 @@ func (p *Parser) textCompare(block ast.Block) ast.Expr { return p.makeBinary(pOperation, p.fromMinVals(block.Values, 2)) } +func (p *Parser) matricesNdArray(block ast.Block) ast.Expr { + pVals := p.makeValueMap(block.Values) + return common.MakeFuncCall("makeNdArray", pVals.get("DIM"), pVals.get("INITIAL")) +} + +func (p *Parser) matricesCreate(block ast.Block) ast.Expr { + pFields := p.makeFieldMap(block.Fields) + numRows, err := strconv.Atoi(pFields["ROWS"]) + if err != nil { + panic(err) + } + numCols, err := strconv.Atoi(pFields["COLS"]) + if err != nil { + panic(err) + } + matrix := make([]ast.Expr, numRows) + for i := range matrix { + row := make([]ast.Expr, numCols) + for j := range row { + row[j] = &fundamentals.Number{Content: pFields["MATRIX_"+strconv.Itoa(i)+"_"+strconv.Itoa(j)]} + } + matrix[i] = &fundamentals.List{Elements: row} + } + return &fundamentals.List{Elements: matrix} +} + func (p *Parser) mathConvertAngles(block ast.Block) ast.Expr { var funcName string switch block.SingleField() { From 41482931318e826e33c1567514974da91b52eb8b Mon Sep 17 00:00:00 2001 From: kumaraswamy Date: Mon, 16 Feb 2026 02:31:47 +0530 Subject: [PATCH 2/8] feat: impl matrices_get_cell --- lang/code/parsers/blocklytomist/parser.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lang/code/parsers/blocklytomist/parser.go b/lang/code/parsers/blocklytomist/parser.go index 40401b8b..09c0d7e9 100644 --- a/lang/code/parsers/blocklytomist/parser.go +++ b/lang/code/parsers/blocklytomist/parser.go @@ -216,10 +216,12 @@ func (p *Parser) parseBlock(block ast.Block) ast.Expr { case "math_convert_angles": return p.mathConvertAngles(block) - case "matrices_create": + case "matrices_create": // todo: we need to be able to form the matrix block from syntax (currently can't!, only lists) return p.matricesCreate(block) case "matrices_create_multidim": return p.matricesNdArray(block) + case "matrices_get_cell": + return p.matricesGetCell(block) // todo: same, we need to preserve matrix reconversion at the end using comment blocks case "lists_create_with": return &fundamentals.List{Elements: p.fromMinVals(block.Values, 0)} @@ -952,6 +954,21 @@ func (p *Parser) textCompare(block ast.Block) ast.Expr { return p.makeBinary(pOperation, p.fromMinVals(block.Values, 2)) } +func (p *Parser) matricesGetCell(block ast.Block) ast.Expr { + numItems := block.Mutation.ItemCount + pVals := p.makeValueMap(block.Values) + + matrix := pVals.get("MATRIX") + var currHead ast.Expr + currHead = matrix + + for i := 0; i < numItems; i++ { + dim := pVals.get("DIM" + strconv.Itoa(i)) + currHead = &list.Get{List: currHead, Index: dim} + } + return currHead +} + func (p *Parser) matricesNdArray(block ast.Block) ast.Expr { pVals := p.makeValueMap(block.Values) return common.MakeFuncCall("makeNdArray", pVals.get("DIM"), pVals.get("INITIAL")) From 0c5845248b8a3c3d59c763374ac4ec76dc0fdf35 Mon Sep 17 00:00:00 2001 From: kumaraswamy Date: Mon, 16 Feb 2026 02:51:52 +0530 Subject: [PATCH 3/8] feat: impl matrices_set_cell --- lang/code/parsers/blocklytomist/parser.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lang/code/parsers/blocklytomist/parser.go b/lang/code/parsers/blocklytomist/parser.go index 09c0d7e9..7f2c8a09 100644 --- a/lang/code/parsers/blocklytomist/parser.go +++ b/lang/code/parsers/blocklytomist/parser.go @@ -222,6 +222,8 @@ func (p *Parser) parseBlock(block ast.Block) ast.Expr { return p.matricesNdArray(block) case "matrices_get_cell": return p.matricesGetCell(block) // todo: same, we need to preserve matrix reconversion at the end using comment blocks + case "matrices_set_cell": + return p.matricesSetCell(block) // todo: same thing case "lists_create_with": return &fundamentals.List{Elements: p.fromMinVals(block.Values, 0)} @@ -954,6 +956,21 @@ func (p *Parser) textCompare(block ast.Block) ast.Expr { return p.makeBinary(pOperation, p.fromMinVals(block.Values, 2)) } +func (p *Parser) matricesSetCell(block ast.Block) ast.Expr { + numItems := block.Mutation.ItemCount + pVals := p.makeValueMap(block.Values) + + matrix := pVals.get("MATRIX") + var currHead ast.Expr + currHead = matrix + + for i := 0; i < numItems-1; i++ { + dim := pVals.get("DIM" + strconv.Itoa(i)) + currHead = &list.Get{List: currHead, Index: dim} + } + return &list.Set{List: currHead, Index: pVals.get("DIM" + strconv.Itoa(numItems-1)), Value: pVals.get("VALUE")} +} + func (p *Parser) matricesGetCell(block ast.Block) ast.Expr { numItems := block.Mutation.ItemCount pVals := p.makeValueMap(block.Values) From 95badab0853d01f96013a6261059e76591284353 Mon Sep 17 00:00:00 2001 From: kumaraswamy Date: Mon, 16 Feb 2026 03:14:57 +0530 Subject: [PATCH 4/8] feat: impl row() and col() methods for matrix datatype --- lang/code/ast/method/call.go | 5 ++++ lang/code/ast/method/matrix.go | 28 +++++++++++++++++++++++ lang/code/parsers/blocklytomist/parser.go | 24 +++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 lang/code/ast/method/matrix.go diff --git a/lang/code/ast/method/call.go b/lang/code/ast/method/call.go index 1a5f7c91..2e0ad79f 100644 --- a/lang/code/ast/method/call.go +++ b/lang/code/ast/method/call.go @@ -91,6 +91,9 @@ var signatures = map[string]*CallSignature{ "keys": makeSignature("dict", "dictionaries_getters", 0, true, ast.SignList), "values": makeSignature("dict", "dictionaries_getters", 0, true, ast.SignList), "toPairs": makeSignature("dict", "dictionaries_dict_to_alist", 0, true, ast.SignList), + + "row": makeSignature("matrix", "matrices_get_row", 1, true, ast.SignAny), + "col": makeSignature("matrix", "matrices_get_column", 1, true, ast.SignAny), } func TestSignature(methodName string, argsCount int) (string, *CallSignature) { @@ -133,6 +136,8 @@ func (c *Call) Blockly(flags ...bool) ast.Block { return c.listMethods(signature) case "dict": return c.dictMethods(signature) + case "matrix": + return c.matrixMethods(signature) default: panic("Unknown module " + signature.Module) } diff --git a/lang/code/ast/method/matrix.go b/lang/code/ast/method/matrix.go new file mode 100644 index 00000000..b3541fc6 --- /dev/null +++ b/lang/code/ast/method/matrix.go @@ -0,0 +1,28 @@ +package method + +import "Falcon/code/ast" + +func (c *Call) matrixMethods(signature *CallSignature) ast.Block { + switch signature.BlocklyName { + case "matrices_get_row": + return c.matrixGetRow() + case "matrices_get_column": + return c.matrixGetColumn() + default: + panic("Unknown matrix method: " + signature.BlocklyName) + } +} + +func (c *Call) matrixGetRow() ast.Block { + return ast.Block{ + Type: "matrices_get_row", + Values: ast.MakeValueArgs(c.On, "MATRIX", c.Args, "ROW"), + } +} + +func (c *Call) matrixGetColumn() ast.Block { + return ast.Block{ + Type: "matrices_get_column", + Values: ast.MakeValueArgs(c.On, "MATRIX", c.Args, "COLUMN"), + } +} diff --git a/lang/code/parsers/blocklytomist/parser.go b/lang/code/parsers/blocklytomist/parser.go index 7f2c8a09..629f606d 100644 --- a/lang/code/parsers/blocklytomist/parser.go +++ b/lang/code/parsers/blocklytomist/parser.go @@ -224,6 +224,10 @@ func (p *Parser) parseBlock(block ast.Block) ast.Expr { return p.matricesGetCell(block) // todo: same, we need to preserve matrix reconversion at the end using comment blocks case "matrices_set_cell": return p.matricesSetCell(block) // todo: same thing + case "matrices_get_row": + return p.matricesGetRow(block) // we are done + case "matrices_get_column": + return p.matricesGetColumn(block) // we are done case "lists_create_with": return &fundamentals.List{Elements: p.fromMinVals(block.Values, 0)} @@ -956,6 +960,26 @@ func (p *Parser) textCompare(block ast.Block) ast.Expr { return p.makeBinary(pOperation, p.fromMinVals(block.Values, 2)) } +func (p *Parser) matricesGetRow(block ast.Block) ast.Expr { + pVals := p.makeValueMap(block.Values) + return &method.Call{ + Where: lex.MakeFakeToken(lex.OpenSquare), + On: pVals.get("MATRIX"), + Name: "row", + Args: []ast.Expr{pVals.get("ROW")}, + } +} + +func (p *Parser) matricesGetColumn(block ast.Block) ast.Expr { + pVals := p.makeValueMap(block.Values) + return &method.Call{ + Where: lex.MakeFakeToken(lex.OpenSquare), + On: pVals.get("MATRIX"), + Name: "col", + Args: []ast.Expr{pVals.get("COLUMN")}, + } +} + func (p *Parser) matricesSetCell(block ast.Block) ast.Expr { numItems := block.Mutation.ItemCount pVals := p.makeValueMap(block.Values) From 2773d7ee72973bbe0fa78d121488ffa0f9c8d846 Mon Sep 17 00:00:00 2001 From: kumaraswamy Date: Mon, 16 Feb 2026 03:21:57 +0530 Subject: [PATCH 5/8] feat: impl dimension() method for matrix datatype --- lang/code/ast/method/call.go | 5 +++-- lang/code/ast/method/matrix.go | 9 +++++++++ lang/code/parsers/blocklytomist/parser.go | 12 ++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lang/code/ast/method/call.go b/lang/code/ast/method/call.go index 2e0ad79f..908b5735 100644 --- a/lang/code/ast/method/call.go +++ b/lang/code/ast/method/call.go @@ -92,8 +92,9 @@ var signatures = map[string]*CallSignature{ "values": makeSignature("dict", "dictionaries_getters", 0, true, ast.SignList), "toPairs": makeSignature("dict", "dictionaries_dict_to_alist", 0, true, ast.SignList), - "row": makeSignature("matrix", "matrices_get_row", 1, true, ast.SignAny), - "col": makeSignature("matrix", "matrices_get_column", 1, true, ast.SignAny), + "row": makeSignature("matrix", "matrices_get_row", 1, true, ast.SignAny), + "col": makeSignature("matrix", "matrices_get_column", 1, true, ast.SignAny), + "dimension": makeSignature("matrix", "matrices_get_dims", 1, true, ast.SignList), } func TestSignature(methodName string, argsCount int) (string, *CallSignature) { diff --git a/lang/code/ast/method/matrix.go b/lang/code/ast/method/matrix.go index b3541fc6..65b8890a 100644 --- a/lang/code/ast/method/matrix.go +++ b/lang/code/ast/method/matrix.go @@ -8,11 +8,20 @@ func (c *Call) matrixMethods(signature *CallSignature) ast.Block { return c.matrixGetRow() case "matrices_get_column": return c.matrixGetColumn() + case "matrices_get_dims": + return c.matrixGetDimensions() default: panic("Unknown matrix method: " + signature.BlocklyName) } } +func (c *Call) matrixGetDimensions() ast.Block { + return ast.Block{ + Type: "matrices_get_dims", + Values: []ast.Value{{Name: "MATRIX", Block: c.On.Blockly()}}, + } +} + func (c *Call) matrixGetRow() ast.Block { return ast.Block{ Type: "matrices_get_row", diff --git a/lang/code/parsers/blocklytomist/parser.go b/lang/code/parsers/blocklytomist/parser.go index 629f606d..237e90ce 100644 --- a/lang/code/parsers/blocklytomist/parser.go +++ b/lang/code/parsers/blocklytomist/parser.go @@ -228,6 +228,8 @@ func (p *Parser) parseBlock(block ast.Block) ast.Expr { return p.matricesGetRow(block) // we are done case "matrices_get_column": return p.matricesGetColumn(block) // we are done + case "matrices_get_dims": + return p.matricesGetDimension(block) // we are done case "lists_create_with": return &fundamentals.List{Elements: p.fromMinVals(block.Values, 0)} @@ -970,6 +972,16 @@ func (p *Parser) matricesGetRow(block ast.Block) ast.Expr { } } +func (p *Parser) matricesGetDimension(block ast.Block) ast.Expr { + pVals := p.makeValueMap(block.Values) + return &method.Call{ + Where: lex.MakeFakeToken(lex.OpenSquare), + On: pVals.get("MATRIX"), + Name: "dimension", + Args: []ast.Expr{}, + } +} + func (p *Parser) matricesGetColumn(block ast.Block) ast.Expr { pVals := p.makeValueMap(block.Values) return &method.Call{ From 1e3c95f5e13d23df05fdfa1f243fd7e2a57062a8 Mon Sep 17 00:00:00 2001 From: kumaraswamy Date: Mon, 16 Feb 2026 03:25:43 +0530 Subject: [PATCH 6/8] feat: impl is ? matrix question for matric datatype --- lang/code/ast/common/question.go | 9 +++++++++ lang/code/parsers/blocklytomist/parser.go | 2 ++ 2 files changed, 11 insertions(+) diff --git a/lang/code/ast/common/question.go b/lang/code/ast/common/question.go index 67f704d0..1161732b 100644 --- a/lang/code/ast/common/question.go +++ b/lang/code/ast/common/question.go @@ -31,6 +31,8 @@ func (q *Question) Blockly(flags ...bool) ast.Block { return q.listQuestion() case "dict": return q.dictQuestion() + case "matrix": + return q.matrixQuestion() case "emptyText": return q.textIsEmpty() case "emptyList": @@ -89,6 +91,13 @@ func (q *Question) textIsEmpty() ast.Block { } } +func (q *Question) matrixQuestion() ast.Block { + return ast.Block{ + Type: "matrices_is_matrix", + Values: []ast.Value{{Name: "VALUE", Block: q.On.Blockly(false)}}, + } +} + func (q *Question) dictQuestion() ast.Block { return ast.Block{ Type: "dictionaries_is_dict", diff --git a/lang/code/parsers/blocklytomist/parser.go b/lang/code/parsers/blocklytomist/parser.go index 237e90ce..7f5abdbc 100644 --- a/lang/code/parsers/blocklytomist/parser.go +++ b/lang/code/parsers/blocklytomist/parser.go @@ -230,6 +230,8 @@ func (p *Parser) parseBlock(block ast.Block) ast.Expr { return p.matricesGetColumn(block) // we are done case "matrices_get_dims": return p.matricesGetDimension(block) // we are done + case "matrices_is_matrix": + return p.makeQuestion(lex.OpenSquare, block, "matrix") case "lists_create_with": return &fundamentals.List{Elements: p.fromMinVals(block.Values, 0)} From 4b074051e24d12268b6d27f6188c45b083abc372 Mon Sep 17 00:00:00 2001 From: kumaraswamy Date: Mon, 16 Feb 2026 03:40:02 +0530 Subject: [PATCH 7/8] feat: impl. matrix operations --- lang/code/ast/method/call.go | 10 ++++++--- lang/code/ast/method/matrix.go | 23 +++++++++++++++++++++ lang/code/parsers/blocklytomist/parser.go | 25 +++++++++++++++++++++++ testing/hi.mist | 15 +------------- 4 files changed, 56 insertions(+), 17 deletions(-) diff --git a/lang/code/ast/method/call.go b/lang/code/ast/method/call.go index 908b5735..66ca69dc 100644 --- a/lang/code/ast/method/call.go +++ b/lang/code/ast/method/call.go @@ -92,9 +92,13 @@ var signatures = map[string]*CallSignature{ "values": makeSignature("dict", "dictionaries_getters", 0, true, ast.SignList), "toPairs": makeSignature("dict", "dictionaries_dict_to_alist", 0, true, ast.SignList), - "row": makeSignature("matrix", "matrices_get_row", 1, true, ast.SignAny), - "col": makeSignature("matrix", "matrices_get_column", 1, true, ast.SignAny), - "dimension": makeSignature("matrix", "matrices_get_dims", 1, true, ast.SignList), + "row": makeSignature("matrix", "matrices_get_row", 1, true, ast.SignAny), + "col": makeSignature("matrix", "matrices_get_column", 1, true, ast.SignAny), + "dimension": makeSignature("matrix", "matrices_get_dims", 1, true, ast.SignList), + "inverse": makeSignature("matrix", "matrices_operations", 0, true, ast.SignList), + "transpose": makeSignature("matrix", "matrices_operations", 0, true, ast.SignList), + "rotateLeft": makeSignature("matrix", "matrices_operations", 0, true, ast.SignList), + "rotateRight": makeSignature("matrix", "matrices_operations", 0, true, ast.SignList), } func TestSignature(methodName string, argsCount int) (string, *CallSignature) { diff --git a/lang/code/ast/method/matrix.go b/lang/code/ast/method/matrix.go index 65b8890a..ca7488c7 100644 --- a/lang/code/ast/method/matrix.go +++ b/lang/code/ast/method/matrix.go @@ -10,11 +10,34 @@ func (c *Call) matrixMethods(signature *CallSignature) ast.Block { return c.matrixGetColumn() case "matrices_get_dims": return c.matrixGetDimensions() + case "matrices_operations": + return c.matrixOperations() default: panic("Unknown matrix method: " + signature.BlocklyName) } } +func (c *Call) matrixOperations() ast.Block { + var blocklyOp string + switch c.Name { + case "inverse": + blocklyOp = "INVERSE" + case "transpose": + blocklyOp = "TRANSPOSE" + case "rotateLeft": + blocklyOp = "ROTATE_LEFT" + case "rotateRight": + blocklyOp = "ROTATE_RIGHT" + default: + panic("Unknown matrix operation: " + c.Name) + } + return ast.Block{ + Type: "matrices_operations", + Fields: []ast.Field{{Name: "OP", Value: blocklyOp}}, + Values: []ast.Value{{Name: "MATRIX", Block: c.On.Blockly()}}, + } +} + func (c *Call) matrixGetDimensions() ast.Block { return ast.Block{ Type: "matrices_get_dims", diff --git a/lang/code/parsers/blocklytomist/parser.go b/lang/code/parsers/blocklytomist/parser.go index 7f5abdbc..59b4e6ff 100644 --- a/lang/code/parsers/blocklytomist/parser.go +++ b/lang/code/parsers/blocklytomist/parser.go @@ -232,6 +232,8 @@ func (p *Parser) parseBlock(block ast.Block) ast.Expr { return p.matricesGetDimension(block) // we are done case "matrices_is_matrix": return p.makeQuestion(lex.OpenSquare, block, "matrix") + case "matrices_operations": + return p.matricesOperations(block) // we are done case "lists_create_with": return &fundamentals.List{Elements: p.fromMinVals(block.Values, 0)} @@ -1196,6 +1198,29 @@ func (p *Parser) makeColor(block ast.Block) ast.Expr { return &fundamentals.Color{Where: lex.MakeFakeToken(lex.ColorCode), Hex: block.SingleField()} } +func (p *Parser) matricesOperations(block ast.Block) ast.Expr { + var matrixMethod string + switch block.SingleField() { + case "INVERSE": + matrixMethod = "inverse" + case "TRANSPOSE": + matrixMethod = "transpose" + case "ROTATE_LEFT": + matrixMethod = "rotateLeft" + case "ROTATE_RIGHT": + matrixMethod = "rotateRight" + default: + panic("Unknown matrix operation type: " + block.SingleField()) + } + pVals := p.makeValueMap(block.Values) + return &method.Call{ + Where: lex.MakeFakeToken(lex.OpenSquare), + On: pVals.get("MATRIX"), + Name: matrixMethod, + Args: []ast.Expr{}, + } +} + func (p *Parser) makeQuestion(t lex.Type, on ast.Block, name string) ast.Expr { return &common.Question{Where: lex.MakeFakeToken(t), On: p.singleExpr(on), Question: name} } diff --git a/testing/hi.mist b/testing/hi.mist index 69bda836..8f81487e 100644 --- a/testing/hi.mist +++ b/testing/hi.mist @@ -1,14 +1 @@ -@Button { Button1 } -@Label { Label1 } - -func main() { - println("Hello, World!") - println("Counter is currently: " _ this.counter) -} - -global counter = 0 - -when Button1.Click { - this.counter = this.counter + 1 - Label1.Text = counter -} +[[1, 2], [3, 4]].rotateLeft() \ No newline at end of file From fd907c676bb0dc0abe200e89c44998e6f6ca507e Mon Sep 17 00:00:00 2001 From: kumaraswamy Date: Mon, 16 Feb 2026 03:42:31 +0530 Subject: [PATCH 8/8] feat: converge matrices arithmetic operations to normal math operations --- lang/code/parsers/blocklytomist/parser.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lang/code/parsers/blocklytomist/parser.go b/lang/code/parsers/blocklytomist/parser.go index 59b4e6ff..072a438c 100644 --- a/lang/code/parsers/blocklytomist/parser.go +++ b/lang/code/parsers/blocklytomist/parser.go @@ -232,6 +232,15 @@ func (p *Parser) parseBlock(block ast.Block) ast.Expr { return p.matricesGetDimension(block) // we are done case "matrices_is_matrix": return p.makeQuestion(lex.OpenSquare, block, "matrix") + case "matrices_add": + return p.makeBinary("+", p.fromMinVals(block.Values, 2)) + case "matrices_subtract": + return p.makeBinary("-", p.fromMinVals(block.Values, 2)) + case "matrices_multiply": + return p.makeBinary("*", p.fromMinVals(block.Values, 2)) + case "matrices_power": + return p.makeBinary("^", p.fromMinVals(block.Values, 2)) + case "matrices_operations": return p.matricesOperations(block) // we are done