1#ifndef SPUDPLATE_VALIDATOR_H
2#define SPUDPLATE_VALIDATOR_H
6#include <unordered_map>
8#include "spudplate/ast.h"
16using TypeMap = std::unordered_map<std::string, VarType>;
28 : std::runtime_error(message), line_(
line), column_(
column) {}
31 [[nodiscard]]
int line()
const {
return line_; }
33 [[nodiscard]]
int column()
const {
return column_; }
46void validate(
const Program& program);
52ExprPtr clone_expr(
const Expr& expr);
61ExprPtr normalize(
const Expr& expr,
const TypeMap& tm);
69bool exprs_equal(
const Expr& a,
const Expr& b);
Exception thrown when the semantic validator finds a rule violation.
Definition validator.h:24
int column() const
1-based column number of the offending statement or expression.
Definition validator.h:33
SemanticError(const std::string &message, int line, int column)
Construct an error tagged with the offending source position.
Definition validator.h:27
int line() const
1-based line number of the offending statement or expression.
Definition validator.h:31