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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! The concrete syntax tree.
//!
//! Note that `Decl` and `Expr` both impl `FromStr`; hence they can be parsed
//! with a simple `.parse()` call:
//!
//! ```
//! # use evaltrees::ast::{Literal, Op, Pattern};
//! # use evaltrees::cst::{Decl, Expr};
//! # fn main() {
//! let expr: Expr = "(1 + 2) :: 3 :: []".parse().unwrap();
//! assert_eq!(expr, Expr::Op(Op::Cons,
//! Box::new(Expr::Op(Op::Add,
//! Box::new(Expr::Literal(Literal::Int(1))),
//! Box::new(Expr::Literal(Literal::Int(2))),
//! )),
//! Box::new(Expr::Op(Op::Cons,
//! Box::new(Expr::Literal(Literal::Int(3))),
//! Box::new(Expr::Literal(Literal::Nil)),
//! )),
//! ));
//!
//! let decl: Decl = "id x = x".parse().unwrap();
//! assert_eq!(decl, Decl {
//! name: "id".into(),
//! args: vec![
//! Pattern::Binding("x".into(), ()),
//! ],
//! body: Expr::Variable("x".into()),
//! });
//! # }
//! ```
use Symbol;
use ;
pub use parse_decls;
/// A function or value declaration.
/// An expression.