xenon_parser/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use lexer::LexerIter;
use node::Program;
use parser::Parser;

mod lexer;
mod parser;
mod node;

fn parse(code: &str) -> Program {
    let tokens: LexerIter = lexer::lex_tokens(code);  // Lex tokens from the source code

    let tokvec: Vec<_> = tokens.collect(); // Collect tokens into a Vec
    let mut parser = Parser::new(&tokvec); // Pass the slice of tokens to the parser
    
    let program = parser.parse();  // Parse the tokens (assuming `parse` is implemented)
    return program
}