public ProcDeclaration(Identifier identifier, FormalParameterSequence formals, Command command, SourcePosition position) : base(position) { Identifier = identifier; Formals = formals; Command = command; }
/** * Creates a small AST to represent the declaration of a standard procedure. * * @param id * the name of the procedure * @param fps * the formal parameter sequence for the procedure * @return a ProcDeclaration for the given identifier with the given formal * parameters */ static ProcDeclaration DeclareStdProc(string id, FormalParameterSequence fps) { var ident = new Identifier(id); var binding = new ProcDeclaration(ident, fps); return(binding); }
public Void VisitEmptyActualParameterSequence(EmptyActualParameterSequence ast, FormalParameterSequence arg) { CheckAndReportError(arg is EmptyFormalParameterSequence, "too few actual parameters", ast); return(null); }
public FuncDeclaration(Identifier identifier, FormalParameterSequence formals, TypeDenoter type, Expression expression, SourcePosition position) : base(position, type) { Identifier = identifier; Formals = formals; Expression = expression; }
/** * Creates a small AST to represent the declaration of a standard function. * * @param id * the name of the function * @param fps * the formal parameter sequence for the function * @param resultType * the type of the function result * @return a FuncDeclaration for the given identifier with the given formal * parameters and returning the given result type */ static FuncDeclaration DeclareStdFunc(string id, FormalParameterSequence fps, TypeDenoter resultType) { var ident = new Identifier(id); var binding = new FuncDeclaration(ident, fps, resultType); return(binding); }
public Void VisitSingleParameterSequence(SingleParameterSequence ast, FormalParameterSequence arg) { if (arg is SingleFormalParameterSequence formal) { ast.Parameter.Visit(this, formal.Formal); } else { ReportError("incorrect number of actual parameters", ast); } return(null); }
public Void VisitMultipleParameterSequence(MultipleParameterSequence ast, FormalParameterSequence arg) { if (arg is MultipleFormalParameterSequence formals) { ast.Parameter.Visit(this, formals.Formal); ast.Parameters.Visit(this, formals.Formals); } else { ReportError("too many actual parameters", ast); } return(null); }
public Void VisitSingleActualParameterSequence(SingleActualParameterSequence ast, FormalParameterSequence arg) { var formal = arg as SingleFormalParameterSequence; if (formal != null) { ast.Actual.Visit(this, formal.Formal); } else { ReportError("incorrect number of actual parameters", ast); } return(null); }
public Void VisitMultipleActualParameterSequence(MultipleActualParameterSequence ast, FormalParameterSequence arg) { var formals = arg as MultipleFormalParameterSequence; if (formals != null) { ast.Actual.Visit(this, formals.Formal); ast.Actuals.Visit(this, formals.Formals); } else { ReportError("too many actual parameters", ast); } return(null); }
public FuncDeclaration(Identifier identifier, FormalParameterSequence formals, TypeDenoter type) : this(identifier, formals, type, new EmptyExpression(), SourcePosition.Empty) { }
public ProcDeclaration(Identifier identifier, FormalParameterSequence formals) : this(identifier, formals, new SkipCommand(), SourcePosition.Empty) { }
static FuncDeclaration DeclareStdFunc(string id, FormalParameterSequence fps, TypeDenoter resultType) => new FuncDeclaration(new Identifier(id), fps, resultType);
static ProcDeclaration DeclareStdProc(string id, FormalParameterSequence fps) => new ProcDeclaration(new Identifier(id), fps);
private static ProcDeclaration DeclareStdProc(string id, FormalParameterSequence fps) { return(new ProcDeclaration(new Identifier(id), fps)); }