public void Visit(ProgramContext parserRule) { basicTypes = new BasicTypes(parserRule, globalContext); parserRule._classes.Insert(0, basicTypes.Int); parserRule._classes.Insert(0, basicTypes.Bool); parserRule._classes.Insert(0, basicTypes.String); parserRule._classes.Insert(0, basicTypes.IO); parserRule._classes.Insert(0, basicTypes.Void); parserRule._classes.Insert(0, basicTypes.Object); foreach (var _class in parserRule._classes) { if (globalContext.IfDefineType(_class.type.Text)) { errorLogger.LogError($"El programa ya contiene una definicion para { _class.type.Text}, linea {_class.type.Line} y la columna {_class.type.Column}"); } else { globalContext.CreateChildContext(_class.type.Text); if (_class.inherits != null) { _class.father = parserRule._classes.FirstOrDefault(p => p.type.Text == _class.inherits.Text); } else if (_class.type.Text != "Object" && _class.type.Text != "void") { _class.father = basicTypes.Object; } } } if (!globalContext.IfDefineType("Main")) { errorLogger.LogError("El programa no contiene la definicion para Main"); } }
public GenerateToCil(CheckSemanticVisitor visitor, GenerateToCilTypes generateToCilTypes) { GlobalContext = visitor.globalContext; CilAst = generateToCilTypes.CilAst; basicTypes = generateToCilTypes.basicTypes; }
public CheckSemanticVisitor(FeatureBuilderVisitor feature) { basicTypes = feature.basicTypes; globalContext = feature.globalContext; errorLogger = feature.errorLogger; }
public GenerateToCilTypes(CheckSemanticVisitor visitor) { basicTypes = visitor.basicTypes; GlobalContext = visitor.globalContext; CilAst = new CilAst(); }
public FeatureBuilderVisitor(TypeBuilderVisitor typeBuilder) { basicTypes = typeBuilder.basicTypes; globalContext = typeBuilder.globalContext; errorLogger = typeBuilder.errorLogger; }