1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use ast::{Decl, PrintStyle};
use cst::{Decl as CstDecl, Expr};
use eval::Evaluator;
#[derive(Clone, Debug, PartialEq)]
pub enum ReplCommand {
Decl(CstDecl),
Evaluator(fn(Vec<Decl<()>>) -> Box<Evaluator>),
Expr(Expr),
Help,
List,
PrintStyle(PrintStyle),
Quit,
Reset,
Typeof(Expr),
}
impl ReplCommand {
pub fn help() -> &'static str {
r"<expr> Evaluates an expression
:decl <decl> Adds a declaration
:l Lists all declarations
:list Lists all declarations
:t <expr> Prints the type of an expression
:cbn Switches to call-by-name evaluation
:cbv Switches to call-by-value evaluation
:lazy Switches to lazy evaluation
:ast Switches to AST print style
:cst Switches to CST print style
:help Prints this help message
:q Quits the REPL
:quit Quits the REPL
:reset Removes all decls from the REPL"
}
}