Skip to main content

tidepool_repr/
frame.rs

1use crate::types::{Alt, DataConId, JoinId, Literal, PrimOpKind, VarId};
2
3/// A single node in the Core expression tree.
4/// Parameterized over `A` to support both direct recursion and flat-vector indices.
5#[derive(Debug, Clone, PartialEq, Eq)]
6pub enum CoreFrame<A> {
7    Var(VarId),
8    Lit(Literal),
9    App {
10        fun: A,
11        arg: A,
12    },
13    Lam {
14        binder: VarId,
15        body: A,
16    },
17    LetNonRec {
18        binder: VarId,
19        rhs: A,
20        body: A,
21    },
22    LetRec {
23        bindings: Vec<(VarId, A)>,
24        body: A,
25    },
26    Case {
27        scrutinee: A,
28        binder: VarId,
29        alts: Vec<Alt<A>>,
30    },
31    Con {
32        tag: DataConId,
33        fields: Vec<A>,
34    },
35    Join {
36        label: JoinId,
37        params: Vec<VarId>,
38        rhs: A,
39        body: A,
40    },
41    Jump {
42        label: JoinId,
43        args: Vec<A>,
44    },
45    PrimOp {
46        op: PrimOpKind,
47        args: Vec<A>,
48    },
49}