-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathparser.h
More file actions
38 lines (33 loc) · 802 Bytes
/
parser.h
File metadata and controls
38 lines (33 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* Modified by Aditya Ranjit Kotwal, 2023
*/
/*
* Copyright (C) Rida Bazzi, 2019
*
* Do not share this file with anyone
*/
#ifndef __PARSER_H__
#define __PARSER_H__
#include <string>
#include <vector>
#include "lexer.h"
#include "reg.h"
#include "mylexicalanalyzer.h"
class Parser
{
public:
void parse_input();
void readAndPrintAllInput();
private:
LexicalAnalyzer lexer;
MyLexicalAnalyzer mylexer;
void syntax_error();
Token expect_expr(TokenType expected_type, std::string token_name);
Token expect(TokenType expected_type);
std::vector<TokenRegex> parse_tokens_section();
void parse_token_list(std::vector<TokenRegex> &token_regex_list);
TokenRegex parse_token();
REG *parse_expr(std::string token);
void syntax_error_in_expression(std::string token);
};
#endif