Ejemplo n.º 1
0
        private string GenerateMatrixString(MatrixNode node)
        {
            string matrixString = "{";

            for (int i = 0; i < node.values.Count; i++)
            {
                SyntaxNode n = node.values[i];
                switch (n.type)
                {
                case SyntaxType.MATRIX:
                    matrixString += GenerateMatrixString((MatrixNode)n);
                    break;

                default:
                    GenerateReturn(n, ref matrixString);
                    break;
                }
                if (i < node.values.Count - 1)
                {
                    matrixString += ",";
                }
            }
            matrixString += "}";
            return(matrixString);
        }
Ejemplo n.º 2
0
        private string GenerateMatrix(MatrixNode matrix, List <Instruction> instructions)
        {
            //TODO Rework
            string r            = GetRegister();
            string matrixString = GenerateMatrixString(matrix);

            instructions.Add(new MatrixInstruction(matrixString, r));
            return(matrixString);
        }
Ejemplo n.º 3
0
        private SyntaxNode BindMatrix(MatrixNode node, Dictionary <string, string> environment)
        {
            List <SyntaxNode> boundValues = new List <SyntaxNode>();

            foreach (SyntaxNode val in node.values)
            {
                boundValues.Add(BindExpression(val, environment));
            }
            return(new MatrixNode(boundValues));
        }