Пример #1
0
        public TypeChecker(SymbolTableManager symbolTableManager)
        {
            _exprTypeVisitor = new ExprTypeVisitor(symbolTableManager);

            _symTableManager = symbolTableManager;
            _programAST      = symbolTableManager.ProgramAST;
        }
Пример #2
0
        public CodeGenVisitor(SymbolTableManager symTableManager)
        {
            _symTableManager = symTableManager;

            _module     = LLVM.ModuleCreateWithName("Ryu");
            _builder    = LLVM.CreateBuilder();
            _programAST = symTableManager.ProgramAST;

            _true  = new LLVMBool(1);
            _false = new LLVMBool(0);
        }
Пример #3
0
        public TypeInferer(SymbolTableManager symTableManager)
        {
            _symTableManager         = symTableManager;
            _identifiersToBeInferred = symTableManager.IdentifiersToBeInferred;

            Func <IdentifierInfo, TypeAST> GetVariableTypeFunc = (IdentifierInfo identInfo) =>
            {
                var identToBeInfered = _identifiersToBeInferred.Find(x => x.identInfo == identInfo);

                if (identToBeInfered == null)
                {
                    throw new Exception("Undeclared identifier " + identInfo);
                }

                return(_typeVisitor.GetAstNodeType(identToBeInfered.file, identInfo.scopeId, identInfo.position, identToBeInfered.expr, identInfo.isConstant));
            };

            _typeVisitor = new ExprTypeVisitor(symTableManager, GetVariableTypeFunc);
        }
Пример #4
0
 public ExprTypeVisitor(SymbolTableManager symTableManager, Func <IdentifierInfo, TypeAST> getVariableTypeFunc = null)
 {
     _symTableManager     = symTableManager;
     _getVariableTypeFunc = getVariableTypeFunc;
 }