1use super::{LitType, Opcode, VarType};
20
21#[derive(Clone, Debug)]
22pub struct Constant {
23 pub name: String,
24 pub typ: VarType,
25 pub line: usize,
26 pub column: usize,
27}
28
29#[derive(Clone, Debug)]
30pub struct Witness {
31 pub name: String,
32 pub typ: VarType,
33 pub line: usize,
34 pub column: usize,
35}
36
37#[derive(Clone, Debug)]
38pub struct Variable {
39 pub name: String,
40 pub typ: VarType,
41 pub line: usize,
42 pub column: usize,
43}
44
45#[derive(Clone, Debug)]
46pub struct Literal {
47 pub name: String,
48 pub typ: LitType,
49 pub line: usize,
50 pub column: usize,
51}
52
53#[derive(Debug)]
54pub enum Var {
55 Constant(Constant),
56 Witness(Witness),
57 Variable(Variable),
58}
59
60#[derive(Clone, Debug)]
61pub enum Arg {
62 Var(Variable),
63 Lit(Literal),
64 Func(Statement),
65}
66
67#[derive(Copy, Clone, PartialEq, Eq, Debug)]
68#[repr(u8)]
69pub enum StatementType {
70 Noop = 0x00,
71 Assign = 0x01,
72 Call = 0x02,
73}
74
75#[derive(Clone, Debug)]
76pub struct Statement {
77 pub typ: StatementType,
78 pub opcode: Opcode,
79 pub lhs: Option<Variable>,
80 pub rhs: Vec<Arg>,
81 pub line: usize,
82}
83
84impl Default for Statement {
85 fn default() -> Self {
86 Self { typ: StatementType::Noop, opcode: Opcode::Noop, lhs: None, rhs: vec![], line: 0 }
87 }
88}