zypo_lib/parser/
mod.rs

1//! Parser module, containing the AST and type-checking hooked in.
2pub mod ast;
3pub mod scope;
4
5mod lib;
6
7pub use lib::*;
8
9lalrpop_mod!(
10    /// Backend of the parser, automatically generated by the LALRPOP crate from
11    /// grammar files.
12    /// 
13    /// # Examples
14    /// 
15    /// Basic parsing to get an AST:
16    /// 
17    /// ```rust
18    /// use zypo_lib::parser;
19    /// 
20    /// fn main() {
21    ///     let input = "fun hi() {}";
22    ///     let expected_ast = vec![
23    ///         parser::ast::Function {
24    ///             ident: "hi".to_string(),
25    ///             body: vec![],
26    ///             params: vec![],
27    ///             docs: None,
28    ///             return_type: parser::ast::VarType::Void
29    ///         }
30    ///     ];
31    /// 
32    ///     let parsed_input = parser::grammar::GrammarParser::new()
33    ///         .parse(input)
34    ///         .unwrap();
35    /// 
36    ///     assert_eq!(parsed_input, expected_ast);
37    /// }
38    /// ```
39    pub grammar,
40    "/parser/grammar.rs"
41);