pub struct Parser { /* private fields */ }Expand description
Recursive-descent parser for Mini-F# expressions.
Implementations§
Source§impl Parser
impl Parser
Sourcepub fn new(tokens: Vec<TokenWithPos>) -> Self
pub fn new(tokens: Vec<TokenWithPos>) -> Self
Create a new parser from a token stream.
Sourcepub fn parse(&mut self) -> Result<Expr, ParseError>
pub fn parse(&mut self) -> Result<Expr, ParseError>
Parse the token stream into an expression AST.
This is the main entry point for parsing. It delegates to parse_expr for
expression parsing. For backward compatibility with existing code.
Sourcepub fn parse_program(&mut self) -> Result<Program, ParseError>
pub fn parse_program(&mut self) -> Result<Program, ParseError>
Parse a complete program with modules, imports, and main expression.
This is the new entry point for parsing programs with module system support.
Sourcepub fn parse_du_type_def(&mut self) -> Result<DuTypeDef, ParseError>
pub fn parse_du_type_def(&mut self) -> Result<DuTypeDef, ParseError>
Parse DU type definition: type Option = Some of int | None