Skip to main content

litex/execute/
exec_stmt.rs

1use crate::prelude::*;
2
3impl Runtime {
4    pub fn exec_stmt(&mut self, stmt: &Stmt) -> Result<StmtResult, RuntimeError> {
5        match stmt {
6            Stmt::DefLetStmt(d) => self.exec_let_stmt(d),
7            Stmt::DefPropStmt(d) => self.exec_def_prop_stmt(d),
8            Stmt::DefAbstractPropStmt(d) => self.exec_def_abstract_prop_stmt(d),
9            Stmt::HaveObjInNonemptySetStmt(d) => {
10                self.exec_have_obj_in_nonempty_set_or_param_type_stmt(d)
11            }
12            Stmt::HaveObjEqualStmt(d) => self.exec_have_obj_equal_stmt(d),
13            Stmt::HaveByExistStmt(d) => self.exec_have_exist_obj_stmt(d),
14            Stmt::HaveFnEqualStmt(d) => self.exec_have_fn_equal_stmt(d),
15            Stmt::HaveFnEqualCaseByCaseStmt(d) => self.exec_have_fn_equal_case_by_case_stmt(d),
16            Stmt::HaveFnByInducStmt(d) => self.exec_have_fn_by_induc_stmt(d),
17            Stmt::HaveFnByForallExistUniqueStmt(d) => {
18                self.exec_have_fn_by_forall_exist_unique_stmt(d)
19            }
20            Stmt::DefFamilyStmt(d) => self.exec_def_family_stmt(d),
21            Stmt::DefAlgoStmt(d) => self.exec_def_algo_stmt(d),
22            Stmt::KnowStmt(know_stmt) => self.exec_know_stmt(know_stmt),
23            Stmt::Fact(fact) => self.exec_fact(fact),
24            Stmt::ClaimStmt(s) => self.exec_claim_stmt(s),
25            Stmt::ProveStmt(s) => self.exec_prove_stmt(s),
26            Stmt::ImportStmt(s) => self.exec_import_stmt(s),
27            Stmt::DoNothingStmt(s) => self.exec_do_nothing_stmt(s),
28            Stmt::ClearStmt(s) => self.exec_clear_stmt(s),
29            Stmt::RunFileStmt(s) => self.exec_run_file_stmt(s),
30            Stmt::EvalStmt(s) => self.exec_eval_stmt(s),
31            Stmt::WitnessExistFact(s) => self.exec_witness_exist_fact(s),
32            Stmt::WitnessNonemptySet(s) => self.exec_witness_nonempty_set(s),
33            Stmt::ByCasesStmt(s) => self.exec_by_cases_stmt(s),
34            Stmt::ByContraStmt(s) => self.exec_by_contra_stmt(s),
35            Stmt::ByEnumerateFiniteSetStmt(s) => self.exec_by_enumerate_finite_set_stmt(s),
36            Stmt::ByInducStmt(s) => self.exec_by_induc_stmt(s),
37            Stmt::ByForStmt(s) => self.exec_by_for_stmt(s),
38            Stmt::ByExtensionStmt(s) => self.exec_by_extension_stmt(s),
39            Stmt::ByFnStmt(s) => self.exec_by_fn_stmt(s),
40            Stmt::ByFamilyStmt(s) => self.exec_by_family_stmt(s),
41            Stmt::ByTuple(s) => self.exec_by_tuple_stmt(s),
42            Stmt::ByFnSetStmt(s) => self.exec_by_fn_set_stmt(s),
43            Stmt::ByEnumerateClosedRangeStmt(s) => self.exec_by_enumerate_closed_range_stmt(s),
44        }
45    }
46
47    pub fn stmt_unsupported(stmt: Stmt) -> Result<StmtResult, RuntimeError> {
48        Err(short_exec_error(
49            stmt,
50            "unimplemented".to_string(),
51            None,
52            vec![],
53        ))
54    }
55}