~starkingdoms/starkingdoms

ref: 46218c06a96bcafb08cd18349edc8a5b7e451604 starkingdoms/kabel/src/lib.rs -rw-r--r-- 394 bytes
46218c06 — ghostlyzsh calculator parser kabel 1 year, 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use lexer::{Lexer, Token};
use parser::{Parser, AST};

pub mod lexer;
pub mod parser;
pub mod macros;
pub mod error;

pub fn run_lexer(input: String) -> Lexer {
    let mut lexer = Lexer::new(input);
    while lexer.next_token() {}
    lexer
}

pub fn run_parser(text:String, input: Vec<Token>) -> (AST, Parser) {
    let mut parser = Parser::new(text, input);
    (parser.program(), parser)
}