3#ifndef LALA_CORE_INTERPRETATION_HPP
4#define LALA_CORE_INTERPRETATION_HPP
19template <
class L, IKind kind,
bool diagnose = false,
class F>
22 if constexpr(kind ==
IKind::ASK || L::preserve_top) {
26 const char* name = L::name;
34template <IKind kind,
bool diagnose = false,
class A,
class F,
class Env,
class I>
36 const char* name = A::name;
40 else if(f.is_false()) {
41 if constexpr(kind ==
IKind::TELL || A::preserve_bot) {
42 return a.template interpret<kind, diagnose>(f, env, intermediate, diagnostics);
48 else if(f.is(F::Seq) && f.sig() ==
AND) {
49 if constexpr(kind ==
IKind::ASK || A::preserve_meet) {
50 for(
int i = 0; i < f.seq().size(); ++i) {
62 return a.template interpret<kind, diagnose>(f, env, intermediate, diagnostics);
67template <IKind kind,
bool diagnose = false,
class F,
class Env,
class U>
69 const char* name = U::name;
73 else if(f.is_false()) {
74 if constexpr(kind ==
IKind::TELL || U::preserve_bot) {
82 else if(f.is(F::Seq)) {
84 if constexpr(kind ==
IKind::ASK || U::preserve_meet) {
85 for(
int i = 0; i < f.seq().size(); ++i) {
96 else if(f.sig() ==
OR) {
97 if constexpr(kind ==
IKind::TELL || U::preserve_join) {
98 using U2 =
typename U::local_type;
99 U2 join_value = U2::bot();
100 for(
int i = 0; i < f.seq().size(); ++i) {
107 value.meet(join_value);
116 return U::template interpret<kind, diagnose>(f, env, value, diagnostics);
120template <IKind kind,
bool diagnose = false,
class A,
class F,
class Env,
class I>
122 auto snap = env.snapshot();
123 I copy = intermediate;
129 intermediate = std::move(copy);
134template <
class A,
class Alloc = battery::standard_allocator,
class Env>
136 if constexpr(A::is_abstract_universe) {
140 return A::top(env, alloc);
144template <
bool diagnose = false,
class TellAlloc = battery::standard_allocator,
class F,
class Env,
class L>
146 if constexpr(L::is_abstract_universe) {
150 typename L::template tell_type<TellAlloc> tell(tell_alloc);
161template <
class A,
bool diagnose = false,
class F,
class Env,
class TellAlloc =
typename A::allocator_type>
164 typename A::allocator_type alloc =
typename A::allocator_type{},
165 TellAlloc tell_alloc = TellAlloc{})
167 auto snap = env.snapshot();
170 return {std::move(a)};
Definition diagnostics.hpp:19
#define RETURN_INTERPRETATION_ERROR(MSG)
Definition diagnostics.hpp:155
Definition abstract_deps.hpp:14
CUDA A make_top(Env &env, Alloc alloc=Alloc{})
Definition interpretation.hpp:135
@ OR
Unary arithmetic function symbols.
Definition ast.hpp:114
@ AND
Unary arithmetic function symbols.
Definition ast.hpp:114
CUDA bool top_level_ginterpret_in(const A &a, const F &f, Env &env, I &intermediate, IDiagnostics &diagnostics)
Definition interpretation.hpp:121
CUDA bool ginterpret_true(const F &f, IDiagnostics &diagnostics)
Definition interpretation.hpp:20
CUDA std::optional< A > create_and_interpret_and_tell(const F &f, Env &env, IDiagnostics &diagnostics, typename A::allocator_type alloc=typename A::allocator_type{}, TellAlloc tell_alloc=TellAlloc{})
Definition interpretation.hpp:162
CUDA bool interpret_and_tell(const F &f, Env &env, L &value, IDiagnostics &diagnostics, TellAlloc tell_alloc=TellAlloc{})
Definition interpretation.hpp:145
CUDA bool ginterpret_in(const A &a, const F &f, Env &env, I &intermediate, IDiagnostics &diagnostics)
Definition interpretation.hpp:35