19#ifndef PS_PARSER_MAX_ERRORS
21 #define PS_PARSER_MAX_ERRORS 5
188struct ps_node_arr*
ps_parse(
struct ps_token_arr* tokens,
Defines safe file I/O functions.
Operator precedence and associativity info.
i32 ps_operator_precedence_t
struct ps_expr * ps_parse_expr_lit(struct ps_tstream *ts)
Parses an expression literal.
struct ps_node * ps_parse_extern(struct ps_tstream *ts)
Parses an eexternal declaration.
struct ps_node * ps_parse_if(struct ps_tstream *ts)
Parses an if-else statement.
struct ps_type_tuple * ps_parse_type_tuple(struct ps_tstream *ts)
Parses a tuple type.
struct ps_node * ps_parse_enum(struct ps_tstream *ts)
Parses an enumeration declaration.
struct ps_node * ps_parse_for(struct ps_tstream *ts)
Parses a for loop.
struct ps_expr * ps_parse_expr_call(struct ps_tstream *ts, struct ps_token *callee)
Parses a call expression, which involves a token (TODO: an expression) followed by a set of parenthes...
struct ps_expr * ps_parse_expr_primary(struct ps_tstream *ts)
A primary expression is a literal or call expression.
struct ps_expr * ps_parse_expr(struct ps_tstream *ts)
Parses a general expression.
struct ps_type * ps_parse_type(struct ps_tstream *ts)
Parses a type such as Rectangle or (Point, Point) from the token stream.
struct ps_expr * ps_parse_interp_str(struct ps_tstream *ts)
struct ps_node * ps_parse_while(struct ps_tstream *ts)
Parses a while loop.
struct ps_node * ps_parse_return(struct ps_tstream *ts)
Parses a return statement.
struct ps_node_block * ps_parse_block(struct ps_tstream *ts)
Parses a block like:
struct ps_node * ps_parse_let(struct ps_tstream *ts)
struct ps_node * ps_parse_import(struct ps_tstream *ts)
Parses an import statement.
struct ps_type * ps_parse_type_primary(struct ps_tstream *ts)
Parses a primary type such as a tuple or unresolved (struct, enum).
struct ps_node * ps_parse_fn(struct ps_tstream *ts)
Parses a function definition.
struct ps_node * ps_parse_node(struct ps_tstream *ts)
Parses and returns the next node in ts.
struct ps_node * ps_parse_struct(struct ps_tstream *ts)
Parses a structure declaration.
struct ps_name * ps_parse_name(struct ps_tstream *ts, struct ps_token *first)
Parses a name such as foo::bar::baz.
struct ps_node_arr * ps_parse(struct ps_token_arr *tokens, const struct ps_file_ctx *file_ctx)
Constructs a series of nodes from the given tokens.
struct ps_expr * ps_parse_expr_helper(struct ps_tstream *ts, struct ps_expr *lhs, ps_operator_precedence_t min_prec)
Handles predence and associativity in parsing expressions.
struct ps_node * ps_parse_expr_stm(struct ps_tstream *ts)
An expression statement consists of an expression followed by a newline.
Expression nodes are represented with tagged unions.
Information captured in a file necessary for effective info/error reporting.
AST nodes are represented with tagged unions.
Processes tokens in a stream.