コード例 #1
0
ファイル: SymbolTableGenerator.cs プロジェクト: Ryuuke/Ryu
        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
ファイル: CodeGenVisitor.cs プロジェクト: Ryuuke/Ryu
        public override void Visit(RootScopeAST rootScope)
        {
            _currentScopeId = _scopeIdGen;

            foreach (var element in rootScope.elements)
            {
                _currentNodePosition++;
                element.Accept(this);
            }
        }
コード例 #3
0
ファイル: SymbolTableGenerator.cs プロジェクト: Ryuuke/Ryu
        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)
 {
 }