Interpreter prototype alpha
c++ interpreter for make believe language
 
Loading...
Searching...
No Matches
lexer.h
Go to the documentation of this file.
1
8#ifndef LEXER_H
9#define LEXER_H
10#include "../tokens/tokens.h"
11
15class lexer{
16public:
17
24 lexer(const std::string& textfile, const std::string& filepath, const int& linenumber);
25
31 std::vector<token> __RUN__LEXER___();
32
33private:
37 std::string textFile;
38
42 std::string filePath;
43
47 std::vector<token> tokenObjVector;
48
52 int lnNum;
53
57 std::string current_char;
58
63
69 void advance();
70
77
83 void generate_tokens();
84
91
98};
99#endif
int current_index
the current index of the current char in the textfile being read
Definition lexer.h:62
void advance()
advances the lexer to the next character to tokenize in the textfile being read
Definition lexer.cpp:16
std::vector< token > tokenObjVector
stores the tokens of the current line in the program
Definition lexer.h:47
token generate_number()
generates a number data type
Definition lexer.cpp:250
token generate_identifier()
generates an identifier or keyword based on the sequence of characters being read
Definition lexer.cpp:283
std::string textFile
file data in string format
Definition lexer.h:37
token generate_string()
generates a string data type
Definition lexer.cpp:303
int lnNum
current line number in the file
Definition lexer.h:52
std::vector< token > __RUN__LEXER___()
tokenizes the program
Definition lexer.cpp:11
std::string current_char
the current char in the textfile being read
Definition lexer.h:57
std::string filePath
path of the file
Definition lexer.h:42
void generate_tokens()
matches the current character to it's corresponding token type
Definition lexer.cpp:26
tokenizes the entire program line by line
Definition lexer.h:15
creates an object with the mapping of a token that was assigned to it from the 'tokens' class
Definition tokens.h:200