normalize_surface_syntax/ir/
mod.rs1mod expr;
10mod stmt;
11mod structure_eq;
12
13pub use expr::*;
14pub use stmt::*;
15pub use structure_eq::StructureEq;
16
17use serde::{Deserialize, Serialize};
18
19#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
21pub struct Program {
22 pub body: Vec<Stmt>,
24}
25
26impl Program {
27 pub fn new(body: Vec<Stmt>) -> Self {
28 Self { body }
29 }
30}
31
32#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
34pub struct Function {
35 pub name: String,
37 pub params: Vec<String>,
39 pub body: Vec<Stmt>,
41}
42
43impl Function {
44 pub fn new(name: impl Into<String>, params: Vec<String>, body: Vec<Stmt>) -> Self {
45 Self {
46 name: name.into(),
47 params,
48 body,
49 }
50 }
51
52 pub fn anonymous(params: Vec<String>, body: Vec<Stmt>) -> Self {
53 Self::new("", params, body)
54 }
55}