Example #1
0
        public void Compile(Script script)
        {
            script.Functions.RemoveAll(f => INTRINSICS.Contains(f.Name));

            AssignedRegisters.Clear();
            AssignRegisters(script);

            foreach (var function in script.Functions)
            {
                CompileBlock(function.Block);
            }
        }
Example #2
0
        private void CompileBlock(Block block)
        {
            for (int i = 0; i < block.Elements.Count; i++)
            {
                if (block.Elements[i] is CallStatement call)
                {
                    Log.Debug("call: " + call.Function.Name);

                    if (INTRINSICS.Contains(call.Function.Name))
                    {
                        var rules = CompileIntrinsic(call);

                        block.Elements.RemoveAt(i);
                        block.Elements.InsertRange(i, rules);

                        i += rules.Count - 1;
                    }
                }
            }
        }