// Call this method to begin the semantic checking process public void CheckSemantics(AbstractNode node) { if (node == null) { return; } TopDclVisitor tdv = new TopDclVisitor(); // Do Top-Declaration pass node.Accept(tdv); ///More here }
public void VisitNode(PrimitiveType node) { // Get this symbol from the symbol table AbstractAttr proposedType = TopDclVisitor.currentSymbolTable.lookup(Utilities.FilterOutKeywords(node.Name)); if (proposedType == null) { TopDclVisitor.Error(String.Format("Warning! Type {0} does not exist in symbol table!", node.Name)); proposedType = new Attributes("Error"); proposedType.typeInfo = new ErrorTypeDescriptor(); } node.attrRef = proposedType; }
internal static void DclVisitAllChildren(AbstractNode node, TopDclVisitor d) { AbstractNode an; an = node.Child; while (an != null) { an.Accept(d); if (an.Sib != an) { an = an.Sib; } } }