llmaker 0.0.1

Make LL(1) token parser code for Rust.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use super::error;
use super::types;

pub mod lexer;
pub mod parse;

pub fn get_ast(input: &str) -> Result<types::Term, error::Error> {
  let tokens = match lexer::lex(input) {
    Ok(t) => Ok(t),
    Err(e) => Err(error::Error::LexerError(e)),
  }?;
  let ast = match parse::parse(tokens) {
    Ok(t) => Ok(t),
    Err(e) => Err(error::Error::ParserError(e)),
  }?;
  Ok(ast)
}