milly/include/parser.h

26 lines
541 B
C

#include "lexer.h"
struct decl;
struct expr;
struct parser {
/* Lexical analyzer */
struct lexer lex;
/* Lookahead token */
struct token cur;
/* Location of the lookahead token */
struct location loc;
};
/* Initialize parser */
void init_parser(struct parser *p, FILE *in);
/* Parse a single declaration */
struct decl *parse_decl(struct parser *p);
/* Parse a single expression */
struct expr *parse_expr(struct parser *p);
/* Parse a list of declarations */
struct decl_list *parse_program(struct parser *p);