public override IPStmt VisitPrintStmt(PParser.PrintStmtContext context) { string message = context.StringLiteral().GetText(); message = message.Substring(1, message.Length - 2); // strip beginning / end double quote int numNecessaryArgs = TypeCheckingUtils.PrintStmtNumArgs(message); if (numNecessaryArgs == -1) { throw handler.InvalidPrintFormat(context, context.StringLiteral().Symbol); } List <IPExpr> args = TypeCheckingUtils.VisitRvalueList(context.rvalueList(), exprVisitor).ToList(); foreach (IPExpr arg in args) { if (arg is LinearAccessRefExpr) { throw handler.PrintStmtLinearArgument(arg.SourceLocation); } } if (args.Count != numNecessaryArgs) { throw handler.IncorrectArgumentCount(context, args.Count, numNecessaryArgs); } return(new PrintStmt(context, message, args)); }