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
/*!

  Core library to parse, analyze, and compile the SMPL language.

  * This crate does **NOT** come with the means to execute SMPL code. 
    * Use a crate like [smpli](https://crates.io/crates/smpli) for a runtime/std instead

  # Using the Crate

  1. Find your SMPL module code and create an `UnparsedModule`
  2. Convert your collection of `UnparsedModule` into a `Program` by:
     * Preparse using `parser::parse_module()` and calling `Program::from_parsed()`
     * Call `Program::from_unparsed()` directly
  3. Pass off the `Program` to a code generator (such as in `smpl::byte_gen`)
     * Code generators will have full access to type information, control flow, metadata, etc.
*/

#[macro_use]
extern crate irmatch;
extern crate failure;
extern crate itertools;
extern crate petgraph;
#[macro_use]
extern crate failure_derive;
#[macro_use]
extern crate display_derive;

pub mod module;

mod feature;
#[macro_use]
mod ast_macros;
mod ast;
#[macro_use]
mod analysis;
mod code_gen;
pub mod program;
mod span;

pub mod parser;
pub mod error;

pub use crate::analysis::{FnId, ModuleId, TypeId};

pub use crate::analysis::metadata;

pub use crate::code_gen::byte_gen;

pub mod prelude {
    pub use crate::module::{ParsedModule, UnparsedModule};
    pub use crate::parser::parse_module;
    pub use crate::program::{CompilableFn, Program};
    pub use crate::analysis::{FnId, ModuleId, TypeId};
}