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
use std::hash::Hash;
use super::SVMCell;
#[cfg_attr(feature = "unstable",
stable(feature = "forktable", since = "0.0.1") )]
pub mod forktable;
#[cfg_attr(feature = "unstable",
stable(feature = "ast", since = "0.0.1") )]
pub mod ast;
pub use self::forktable::ForkTable;
pub use self::ast::ASTNode;
#[cfg_attr(feature = "unstable",
stable(feature = "scope", since = "0.0.1") )]
pub type Index = (u64, u64);
#[cfg_attr(feature = "unstable",
stable(feature = "forktable", since = "0.0.1") )]
pub type SymTable<'a> = forktable::ForkTable<'a, &'a str, Index>;
#[cfg_attr(feature = "unstable",
stable(feature = "compile", since = "0.0.1") )]
pub type CompileResult = Result<Vec<SVMCell>, String>;
#[cfg_attr(feature = "unstable",
stable(feature = "scope", since = "0.0.1") )]
pub trait Scope<K>
where K: Eq + Hash {
#[cfg_attr(feature = "unstable",
stable(feature = "scope", since = "0.0.1") )]
fn bind(&mut self, name: K, lvl: u64) -> Index;
#[cfg_attr(feature = "unstable",
stable(feature = "scope", since = "0.0.1") )]
fn lookup(&self, name: &K) -> Option<Index>;
}