From 9c3cae740664a5043bacfa0b82eace8ed8239bee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=8B=9C=EC=9B=90?= Date: Sun, 16 Aug 2026 21:16:14 +0900 Subject: [PATCH] add M7 semantic foundation --- fec/src/m7.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 fec/src/m7.h diff --git a/fec/src/m7.h b/fec/src/m7.h new file mode 100644 index 0000000..ad0f968 --- /dev/null +++ b/fec/src/m7.h @@ -0,0 +1,31 @@ +#ifndef FE_M7_H +#define FE_M7_H + +#include "types.h" + +typedef enum FeM7ContextKind { + FE_M7_CONTEXT_NONE = 0, + FE_M7_CONTEXT_SUCCESS, + FE_M7_CONTEXT_FAILURE +} FeM7ContextKind; + +typedef enum FeM7LazyKind { + FE_M7_LAZY_NONE = 0, + FE_M7_LAZY_ORELSE, + FE_M7_LAZY_CATCH +} FeM7LazyKind; + +FeType *fe_m7_optional_type(FeTypeCtx *ctx, FeType *payload); +int fe_m7_optional_uses_niche(const FeType *payload); +int fe_m7_can_contextual_null(const FeType *expected); + +FeType *fe_m7_error_union_type(FeTypeCtx *ctx, FeType *error_type, + FeType *value_type); +FeType *fe_m7_error_type(FeTypeCtx *ctx, const FeType *error_union); +FeM7ContextKind fe_m7_error_context(FeTypeCtx *ctx, const FeType *expected, + const FeType *actual); + +FeM7LazyKind fe_m7_lazy_kind(const FeNode *node); +int fe_m7_is_try(const FeNode *node); + +#endif