infix parsing and prebind fixes

This commit is contained in:
Ellen Arvidsson 2025-06-27 02:48:48 +02:00
parent 65066c493e
commit 33f38c03d6
14 changed files with 1555 additions and 1089 deletions

View file

@ -37,6 +37,8 @@ struct msph_decor {
#define MSPH_TREE_BOX 0x004a
#define MSPH_TREE_FORALL 0x004b
#define MSPH_TREE_PAREN 0x004c
#define MSPH_TREE_SUBT 0x004d
#define MSPH_TREE_IDENT 0x0100
#define MSPH_TREE_NAMEDECL 0x0101
@ -162,8 +164,7 @@ struct msph_tree_membdecl {
struct msph_tree_assert {
struct msph_tree_dir hd_dir;
struct msph_tree_tpexpr *ltp;
struct msph_tree_tpexpr *rtp;
struct msph_tree_tpexpr *tp;
};
struct msph_tree_namedecl {
@ -209,6 +210,7 @@ struct msph_tree_trait {
struct msph_tree_body *body;
};
/* XXX should probably merge all binary type ops into one */
struct msph_tree_conj {
struct msph_tree_tpexpr hd_tpe;
@ -230,6 +232,13 @@ struct msph_tree_impl {
struct msph_tree_tpexpr *rtp;
};
struct msph_tree_subt {
struct msph_tree_tpexpr hd_tpe;
struct msph_tree_tpexpr *ltp;
struct msph_tree_tpexpr *rtp;
};
struct msph_tree_arrow {
struct msph_tree_tpexpr hd_tpe;
@ -259,7 +268,11 @@ struct msph_tree_paren {
struct msph_tree_root *msph_tree_makeroot(struct msph_ctx *);
int msph_tree_parse(struct msph_token_stream *, struct msph_tree_root *);
#define MSPH_PARSE_PREFIX 1
#define MSPH_PARSE_INFIX 2
int msph_tree_parse(struct msph_token_stream *, struct msph_tree_root *,
int);
ssize_t msph_tree_fprint(FILE *, struct msph_tree *);