radish/include/parser.h

24 lines
619 B
C
Raw Normal View History

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