Beispiel #1
0
        public DataType(ushort width, ref uint typeId, string symbolId, SymbolAddrTable scope = null, List <DataType> body = null)
        {
            Width    = width;
            TypeId   = typeId++;
            SymbolId = symbolId;
            Body     = body;
            Scope    = scope;

            Debug.PrintDbg($"RegVar {width} {typeId} {symbolId} {body?.Count}");
        }
Beispiel #2
0
 public void ExitScope()
 {
     if (_currentScope == null)
     {
         Debug.PrintDbg("No scope to leave");
         return;
     }
     _currentScope = _currentScope?.GetPrevious();
     Debug.PrintDbg($"Now pointed to {_currentScope?.Id}");
 }
Beispiel #3
0
        public SymbolAddrTable(string id, SymbolAddrTable previous, ushort blockSize)
        {
            Id = id;

            _header      = previous;
            Instructions = new IndInstTable(this);
            _offset      = 0;
            _blockSize   = blockSize;

            _entries   = new Dictionary <string, SymbolEntry>();
            _typeTable = DataTypeTable.GetInstance();
        }
Beispiel #4
0
        public bool CreateScope(string id, string type, BodyType t)
        {
            var table = (SymbolAddrTable)_currentScope.AddTable(id, type);

            table.SetType(t);

            if (table == null)
            {
                return(false);
            }

            _currentScope = table;
            Debug.PrintDbg($"Now pointed to {id}");

            return(true);
        }
Beispiel #5
0
        public IDatumTable <SymbolEntry> AddTable(string id, string type)
        {
            var dt = _typeTable.GetPrimitive(type);

            if (dt == null)
            {
                ErrorReporter.GetInstance().Add($"Type {type} not found", ErrorCode.SymbolUndefined);
                return(null);
            }

            var e = new SymbolEntry(id, 0, dt);
            var s = new SymbolAddrTable(id, this, _blockSize);

            e.Target = s;
            AddRecord(e);

            return(s);
        }
Beispiel #6
0
 private InstDeclController()
 {
     _root         = new SymbolAddrTable("#ROOT", null, _blocksize);
     _currentScope = _symTable = _root;
     Meta          = new MetaTable();
 }
Beispiel #7
0
 public SymbolAddrTable FindFirstOf(string sym)
 {
     _currentScope = _symTable;
     _symTable.SearchRecord(sym);
     return(null);
 }
Beispiel #8
0
 internal void SetScope(SymbolAddrTable scope)
 {
     _scope = scope;
 }
Beispiel #9
0
 public IndInstTable(SymbolAddrTable symbolAddrTable)
 {
     Inst        = new List <InstEntry>();
     SymbolTable = symbolAddrTable;
 }