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}"); }
public void ExitScope() { if (_currentScope == null) { Debug.PrintDbg("No scope to leave"); return; } _currentScope = _currentScope?.GetPrevious(); Debug.PrintDbg($"Now pointed to {_currentScope?.Id}"); }
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(); }
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); }
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); }
private InstDeclController() { _root = new SymbolAddrTable("#ROOT", null, _blocksize); _currentScope = _symTable = _root; Meta = new MetaTable(); }
public SymbolAddrTable FindFirstOf(string sym) { _currentScope = _symTable; _symTable.SearchRecord(sym); return(null); }
internal void SetScope(SymbolAddrTable scope) { _scope = scope; }
public IndInstTable(SymbolAddrTable symbolAddrTable) { Inst = new List <InstEntry>(); SymbolTable = symbolAddrTable; }