1mod display;
2pub mod evaluate;
3#[cfg(test)]
4mod tests;
5
6#[derive(Debug, Clone)]
7pub struct FlatPint {
8 pub decls: Vec<Decl>,
9 pub solve: Solve,
10}
11
12#[derive(Debug, Clone)]
13pub enum Decl {
14 Var(Var),
15 Constraint(Constraint),
16}
17
18#[derive(Debug, Clone)]
19pub struct Var {
20 pub name: String,
21 pub ty: Type,
22}
23
24#[derive(Debug, Clone)]
25pub struct Constraint(pub Expr);
26
27#[derive(Debug, Clone)]
28pub enum Solve {
29 Satisfy,
30 Minimize(String),
31 Maximize(String),
32}
33
34#[derive(Debug, Clone)]
35pub enum Expr {
36 Immediate(Immediate),
37 Path(String),
38 UnaryOp {
39 op: UnaryOp,
40 expr: Box<Self>,
41 },
42 BinaryOp {
43 op: BinaryOp,
44 lhs: Box<Self>,
45 rhs: Box<Self>,
46 },
47}
48
49#[derive(Debug, Clone)]
50pub enum Immediate {
51 Bool(bool),
52 Int(i64),
53 Real(f64),
54}
55
56#[derive(Clone, Copy, Debug, Eq, PartialEq)]
57pub enum UnaryOp {
58 Neg,
59 Not,
60}
61
62#[derive(Clone, Copy, Debug, Eq, PartialEq)]
63pub enum BinaryOp {
64 Add,
66 Sub,
67 Mul,
68 Div,
69 Mod,
70
71 Equal,
73 NotEqual,
74 LessThanOrEqual,
75 LessThan,
76 GreaterThanOrEqual,
77 GreaterThan,
78
79 LogicalAnd,
81 LogicalOr,
82}
83
84#[derive(Debug, Clone, PartialEq, Eq)]
85pub enum Type {
86 Bool,
87 Int,
88 Real,
89}