Skip to main content

parse

Function parse 

Source
pub fn parse(tokens: &[Token]) -> Result<Expr, Error>
Expand description

Parse a full expression from a token slice.

§Errors

Returns parse errors when the token stream does not match the grammar.

§Examples

use lambda_throw_cat::lexer::lex;
use lambda_throw_cat::parser::parse;

let tokens = lex("try throw x catch e. e")?;
let expr = parse(&tokens)?;
assert_eq!(format!("{expr}"), "(try (throw x) catch e. e)");