2013-08-25 01:02:38 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) 2013 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Author: Leonardo de Moura
|
|
|
|
*/
|
|
|
|
#pragma once
|
2013-08-30 03:12:43 +00:00
|
|
|
#include <memory>
|
|
|
|
#include "environment.h"
|
2013-08-31 23:46:41 +00:00
|
|
|
#include "formatter.h"
|
2013-08-25 01:02:38 +00:00
|
|
|
|
|
|
|
namespace lean {
|
|
|
|
/**
|
|
|
|
\brief Expression elaborator, it is responsible for "filling" holes
|
|
|
|
in terms left by the user. This is the main module resposible for computing
|
|
|
|
the value of implicit arguments.
|
|
|
|
*/
|
|
|
|
class elaborator {
|
2013-08-30 03:12:43 +00:00
|
|
|
class imp;
|
|
|
|
std::shared_ptr<imp> m_ptr;
|
2013-08-31 00:18:39 +00:00
|
|
|
static void print(imp * ptr);
|
2013-08-25 01:02:38 +00:00
|
|
|
public:
|
2013-08-30 03:12:43 +00:00
|
|
|
explicit elaborator(environment const & env);
|
|
|
|
~elaborator();
|
2013-08-25 17:34:19 +00:00
|
|
|
|
2013-08-30 03:12:43 +00:00
|
|
|
expr mk_metavar();
|
2013-08-25 18:42:36 +00:00
|
|
|
|
2013-08-30 03:12:43 +00:00
|
|
|
expr operator()(expr const & e);
|
2013-08-25 17:34:19 +00:00
|
|
|
|
2013-08-31 23:46:41 +00:00
|
|
|
/**
|
|
|
|
\brief If \c e is an expression instantiated by the elaborator, then it
|
|
|
|
returns the expression (the one with "holes") used to generate \c e.
|
|
|
|
Otherwise, it just returns \c e.
|
|
|
|
*/
|
|
|
|
expr const & get_original(expr const & e) const;
|
|
|
|
|
2013-08-30 03:12:43 +00:00
|
|
|
void set_interrupt(bool flag);
|
2013-08-25 17:34:19 +00:00
|
|
|
void interrupt() { set_interrupt(true); }
|
|
|
|
void reset_interrupt() { set_interrupt(false); }
|
2013-08-25 18:18:19 +00:00
|
|
|
|
2013-08-30 03:12:43 +00:00
|
|
|
void clear();
|
|
|
|
|
|
|
|
environment const & get_environment() const;
|
2013-08-25 17:34:19 +00:00
|
|
|
|
2013-08-30 03:12:43 +00:00
|
|
|
void display(std::ostream & out) const;
|
2013-08-31 23:46:41 +00:00
|
|
|
format pp(formatter & f, options const & o) const;
|
2013-08-30 03:12:43 +00:00
|
|
|
};
|
2013-08-25 17:34:19 +00:00
|
|
|
/** \brief Return true iff \c e is a special constant used to mark application of overloads. */
|
|
|
|
bool is_overload_marker(expr const & e);
|
|
|
|
/** \brief Return the overload marker */
|
|
|
|
expr mk_overload_marker();
|
2013-08-25 01:02:38 +00:00
|
|
|
}
|