lean2/src/library/elaborator.h
Leonardo de Moura ece6e6ca6a Add interrupt to parser. Add elaborator to parser. Add placeholder support in the scanner.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-25 11:02:34 -07:00

43 lines
1.3 KiB
C++

/*
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
#include "metavar_env.h"
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 {
environment const & m_env;
metavar_env m_metaenv;
expr lookup(context const & c, unsigned i);
void unify(expr const & e1, expr const & e2, context const & ctx);
expr check_pi(expr const & e, context const & ctx);
level check_universe(expr const & e, context const & ctx);
expr process(expr const & e, context const & ctx);
public:
elaborator(environment const & env);
metavar_env & menv() { return m_metaenv; }
expr operator()(expr const & e);
void clear() { m_metaenv.clear(); }
void set_interrupt(bool flag) { m_metaenv.set_interrupt(flag); }
void interrupt() { set_interrupt(true); }
void reset_interrupt() { set_interrupt(false); }
};
/** \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();
}