summaryrefslogtreecommitdiff
path: root/42sh/src/parser/parser.h
blob: c029a63df484ba87b13addf1163afeea6fe5dd69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#ifndef PARSER_H
#define PARSER_H

#include "ast/ast.h"
#include "lexer/lexer.h"
#include "parser/parser_utils.h"

/**
 * @brief The main function to be called in the main loop. It will parse the
 * current expression given by the lexer. Return NULL and set the state variable
 * to `ERROR` if an error occured, else return the AST for this expression.
 * @param lexer The lexer used to create the AST.
 * @param state A pointger used to store the current state of the pointer.
 */
struct ast *parse(struct lexer *lexer, enum parser_state *state);

#endif /* ! PARSER_H */