radish/include/parser.h
2025-01-06 03:53:15 +00:00

23 lines
619 B
C

#ifndef PARSER_H
#define PARSER_H
/*
expression → equality ;
equality → comparison ( ( "!=" | "==" ) comparison )* ;
comparison → term ( ( ">" | ">=" | "<" | "<=" ) term )* ;
term → factor ( ( "-" | "+" ) factor )* ;
factor → unary ( ( "/" | "*" ) unary )* ;
unary → ( "!" | "-" ) unary | primary ;
primary → NUMBER | STRING | "true" | "false" | "nil" | "(" expression ")" ;
*/
#include "ast.h"
#include "lexer.h"
#include "stmt.h"
stmt_array_t *parse(token_t *tks);
expr_t *parse_expr(token_t *tks);
void free_expr(expr_t *expr);
void free_statements(stmt_array_t *array);
#endif