Module parser

Source
Expand description

A simple parser, AST and prettyprinter for a textual representation of rain programs

Modules§

ast
An abstract syntax tree for rain programs
builder
AST-to-rain-IR conversion and related utilities
symbol_table
A simple symbol table struct, used to build a rain AST into a rain IR graph

Functions§

defeq
Parse an equality separator, optionally preceded by whitespace
parse_atom
Parse an atomic rain expression Does not accept whitespace before the expression, and does not consume whitespace after it.
parse_binary_logical_op
Parse a binary logical operation
parse_bool
Parse a boolean
parse_bool_type
Parse the Boolean type
parse_comment
Parse a rain comment. TODO: distinguish documentation comments, and don’t ignore those
parse_expr
Parse a rain expression, which is either an atom or an application of them Accepts whitespace before the expression
parse_gamma
Parse a gamma node, consuming all whitespace before it
parse_ident
Parse a rain identifier, which is composed of any non-special character. Does not accept whitespace before the identifier, and does not consume whitespace after it.
parse_lambda
Parse a lambda function, consuming all whitespace before it
parse_logical_op
Parse a logical operation
parse_multi_comment
Parse a multi line rain comment
parse_natural
Parse a natural number
parse_opt_ident
Parse an optional ident
parse_parametrized
Parse a parametrized expression
parse_path
Parse a rain path. Does not accept whitespace before the path and does not consume whitespace after it.
parse_pattern
Parse a pattern for assignment Accepts whitespace before the pattern
parse_pattern_match
Parse a pattern match
parse_pattern_matches
Parse a set of pattern matches
parse_phi
Parse a phi node, consuming all whitespace beforeit
parse_pi
Parse a pi type, consuming all whitespace before it
parse_scope
Parse a scope, consuming all whitespace before it
parse_simple_assignment
Parse a simple assignment. Accepts whitespace before it
parse_single_comment
Parse a single line rain comment
parse_statement
Parse a let-statement
parse_type_arrow
Parse a function type arrow
parse_type_bound
Parse a type bound
parse_typed_args
Parse a list of typed arguments
parse_typed_idents
Parse a list of typed identifiers
parse_unary_logical_op
Parse a unary logical operation
path_separator
Parse a path separator
terminator
Parse a terminator, optionally preceded by whitespace
whitespace
Parse whitespace, including ignored comments. Returns the count of comments.