예제 #1
0
        public SymbolTable GenerateSymTable(RootScopeAST rootAST, string fileName)
        {
            _symTable                  = new SymbolTable();
            _symTable.FilePath         = fileName;
            _symTable.FileDependencies = rootAST.FileDependencies;

            _symTable.IdentInfoDictionary =
                new Dictionary <IdentifierLocation, IdentifierInfo>();

            _symTable.TypeInfoDictionary =
                new Dictionary <string, CustomTypeInfo>();

            _symTable.ScopeInfoDictionary = new Dictionary <int, ScopeInfo>();

            GlobalIdentifiers       = new List <string>();
            GlobalTypes             = new List <string>();
            IdentifiersToBeInferred = new List <IdentExpr>();

            rootAST.Accept(this);

            _currentNodePosition = 0;
            _currentScope        = null;
            _scopeIdGen          = 0;

            return(_symTable);
        }
예제 #2
0
        public override void Visit(RootScopeAST rootScope)
        {
            _currentScopeId = _scopeIdGen;

            foreach (var element in rootScope.elements)
            {
                _currentNodePosition++;
                element.Accept(this);
            }
        }
예제 #3
0
        public override void Visit(RootScopeAST rootScope)
        {
            _currentScope = new ScopeInfo
            {
                id     = _scopeIdGen,
                parent = null
            };

            _symTable.ScopeInfoDictionary.Add(_currentScope.id, _currentScope);

            foreach (var element in rootScope.elements)
            {
                _currentNodePosition++;
                element.Accept(this);
            }
        }
예제 #4
0
 public virtual void Visit(RootScopeAST rootScope)
 {
 }