Exemplo n.º 1
0
        protected void Start()
        {
            if (seed == null)
            {
                seed = new LSSeed(seedInput);
            }

            if (rules == null)
            {
                int numRules = rulesInput.Length;
                rules = new LSRule[numRules];

                for (int i = 0; i < numRules; i++)
                {
                    rules[i] = LSRule.FromString(rulesInput[i]);
                }
            }

            if (constants == null)
            {
                int numConstants = constantsInput.Length;
                constants = new LSSymbol[numConstants];

                for (int i = 0; i < numConstants; i++)
                {
                    constants[i] = new LSSymbol(constantsInput[i]);
                }
            }
        }
Exemplo n.º 2
0
        public static LSRule FromString(string input, string output)
        {
            LSSymbol inputSb = new LSSymbol(input);

            int numOutput = output.Length;

            LSSymbol[] outputSbs = new LSSymbol[numOutput];

            for (int i = 0; i < numOutput; i++)
            {
                outputSbs[i] = new LSSymbol(output[i]);
            }

            LSRule rule = new LSRule(inputSb, outputSbs);

            return(rule);
        }
Exemplo n.º 3
0
 public LSRule(LSSymbol input, LSSymbol[] output)
 {
     this.input  = input;
     this.output = output;
 }