Beispiel #1
0
        public IEnumerable <InstructionMeta> Expand(InstructionMeta instructionMeta)
        {
            var decls = new List <InstructionMeta>();

            Expand(decls, instructionMeta);

            return(decls);
        }
        public InstructionMeta(InstructionInfo info)
        {
            Info          = info;
            _parameters   = InstructionParameter.Parse(info.Mnemonic);
            MachineCycles = CreateMachineCycles(info);

            if (info.Parent != null)
            {
                Parent = new InstructionMeta(info.Parent);
            }

            Variables = new List <InstructionVariable>();
            InstructionVariable.Create(this);
        }
Beispiel #3
0
        public static void Create(InstructionMeta instructionMeta)
        {
            var root = instructionMeta.Parent ?? instructionMeta;

            foreach (var p in root.Parameters)
            {
                if (IsVariable(p))
                {
                    var type = _varTables[p];
                    instructionMeta.Variables.Add(new InstructionVariable {
                        Name = p, Type = type
                    });
                }
            }
        }
Beispiel #4
0
        public void Expand(List <InstructionMeta> decls, InstructionMeta instructionMeta)
        {
            var tableIterators = _tables
                                 .Where(t => instructionMeta.Parameters.Contains(t.Key))
                                 .Select(t => new TableIterator(t))
                                 .ToList();

            if (tableIterators.Any())
            {
                AddInstructionDecls(decls, instructionMeta.Info, tableIterators, 0);
            }
            else
            {
                decls.Add(instructionMeta);
            }
        }
 private InstructionBuilder(InstructionInfo instructionInfo)
 {
     _instructionInfo = instructionInfo;
     _instructionMeta = new InstructionMeta(instructionInfo);
 }