|
libpulsar
A modular compiler for the pulsar programming language
|
#include <stddef.h>#include <math.h>#include "parser.h"#include "tstream_short.h"#include "error/error.h"#include "util/arena.h"#include "util/abort.h"#include "frontend/analyzer/type.h"#include "frontend/lexer/operator.h"Go to the source code of this file.
Macros | |
| #define | try_get_float(from, bind_to, do_) |
| #define | PS_GROUP_MISMATCH_REFER(tkn) |
| #define | PS_END_STM(ctx) |
| #define | _PS_IS_FN_QUAL() |
Functions | |
| struct ps_type_tuple * | ps_parse_type_tuple (struct ps_tstream *ts) |
| Parses a tuple type. | |
| 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_type * | ps_parse_type (struct ps_tstream *ts) |
Parses a type such as Rectangle or (Point, Point) from the token stream. | |
| 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_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_fn (struct ps_tstream *ts) |
| Parses a function definition. | |
| struct ps_node * | ps_parse_import (struct ps_tstream *ts) |
| Parses an import statement. | |
| struct ps_node * | ps_parse_extern (struct ps_tstream *ts) |
| Parses an eexternal declaration. | |
| struct ps_node * | ps_parse_struct (struct ps_tstream *ts) |
| Parses a structure declaration. | |
| 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_node * | ps_parse_while (struct ps_tstream *ts) |
| Parses a while loop. | |
| struct ps_node * | ps_parse_if (struct ps_tstream *ts) |
| Parses an if-else statement. | |
| struct ps_node * | ps_parse_return (struct ps_tstream *ts) |
| Parses a return statement. | |
| struct ps_node * | ps_parse_expr_stm (struct ps_tstream *ts) |
| An expression statement consists of an expression followed by a newline. | |
| struct ps_expr * | ps_parse_interp_str (struct ps_tstream *ts) |
| struct ps_expr * | ps_parse_expr_lit (struct ps_tstream *ts) |
| Parses an expression literal. | |
| 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 parentheses enclosing arguments. | |
| 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_helper (struct ps_tstream *ts, struct ps_expr *lhs, ps_operator_precedence_t min_prec) |
| Handles predence and associativity in parsing expressions. | |
| struct ps_expr * | ps_parse_expr (struct ps_tstream *ts) |
| Parses a general expression. | |
| struct ps_node * | ps_parse_node (struct ps_tstream *ts) |
Parses and returns the next node in ts. | |
| 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. | |
| #define _PS_IS_FN_QUAL | ( | ) |
| #define PS_END_STM | ( | ctx | ) |
| #define PS_GROUP_MISMATCH_REFER | ( | tkn | ) |
| #define try_get_float | ( | from, | |
| bind_to, | |||
| do_ | |||
| ) |
| struct ps_node_arr * ps_parse | ( | struct ps_token_arr * | tokens, |
| const struct ps_file_ctx * | file_ctx | ||
| ) |
| struct ps_node_block * ps_parse_block | ( | struct ps_tstream * | ts | ) |
| struct ps_node * ps_parse_enum | ( | struct ps_tstream * | ts | ) |
| struct ps_expr * ps_parse_expr | ( | struct ps_tstream * | ts | ) |
| struct ps_expr * ps_parse_expr_call | ( | struct ps_tstream * | ts, |
| struct ps_token * | callee | ||
| ) |
| struct ps_expr * ps_parse_expr_helper | ( | struct ps_tstream * | ts, |
| struct ps_expr * | lhs, | ||
| ps_operator_precedence_t | min_prec | ||
| ) |
| struct ps_expr * ps_parse_expr_lit | ( | struct ps_tstream * | ts | ) |
| struct ps_expr * ps_parse_expr_primary | ( | struct ps_tstream * | ts | ) |
A primary expression is a literal or call expression.
These are used as base cases invoked from ps_parse_expr() and ps_parse_expr_helper() to handle more complicated nesting.
| struct ps_node * ps_parse_expr_stm | ( | struct ps_tstream * | ts | ) |
| struct ps_node * ps_parse_extern | ( | struct ps_tstream * | ts | ) |
| struct ps_node * ps_parse_fn | ( | struct ps_tstream * | ts | ) |
| struct ps_node * ps_parse_for | ( | struct ps_tstream * | ts | ) |
| struct ps_node * ps_parse_if | ( | struct ps_tstream * | ts | ) |
| struct ps_node * ps_parse_import | ( | struct ps_tstream * | ts | ) |
| struct ps_expr * ps_parse_interp_str | ( | struct ps_tstream * | ts | ) |
| struct ps_node * ps_parse_let | ( | struct ps_tstream * | ts | ) |
| struct ps_name * ps_parse_name | ( | struct ps_tstream * | ts, |
| struct ps_token * | first | ||
| ) |
| struct ps_node * ps_parse_node | ( | struct ps_tstream * | ts | ) |
| struct ps_node * ps_parse_return | ( | struct ps_tstream * | ts | ) |
| struct ps_node * ps_parse_struct | ( | struct ps_tstream * | ts | ) |
| struct ps_type * ps_parse_type | ( | struct ps_tstream * | ts | ) |
| struct ps_type * ps_parse_type_primary | ( | struct ps_tstream * | ts | ) |
| struct ps_type_tuple * ps_parse_type_tuple | ( | struct ps_tstream * | ts | ) |
| struct ps_node * ps_parse_while | ( | struct ps_tstream * | ts | ) |