first documentation run

This commit is contained in:
Sebastian Hugentobler 2025-05-26 12:24:35 +02:00
parent e065108f58
commit f59e6a5fd5
Signed by: shu
SSH key fingerprint: SHA256:ppcx6MlixdNZd5EUM1nkHOKoyQYoJwzuQKXM6J/t66M
21 changed files with 64 additions and 23 deletions

View file

@ -71,7 +71,7 @@ pub enum ParserError {
SuperclassMethodNameExpected(usize),
}
/// Parse the Lox language.
/// Parse the Lox language tokens into an abstract syntax tree.
#[derive(Debug, Clone)]
struct Parser {
current: usize,
@ -655,7 +655,8 @@ impl Parser {
}
}
/// Try to parse the provided tokens into an AST.
/// Try to parse the provided tokens into an Abstract Syntax Tree (AST).
/// Return a list of statements that can be executed by the interpreter.
pub fn ast(tokens: Vec<Token>) -> Result<Vec<Statement>, ParserError> {
let mut parser = Parser::new(tokens)?;
parser.run()