22 lines
576 B
C
22 lines
576 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"
|
|
|
|
expr_t *parse(token_t *tks);
|
|
void free_expr(expr_t *expr);
|
|
|
|
#endif
|