forked from coolsidd/Compiler-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtokenizer_structs.h
More file actions
35 lines (28 loc) · 775 Bytes
/
tokenizer_structs.h
File metadata and controls
35 lines (28 loc) · 775 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
/*
Group 36
2017B4A70495P Manan Soni
2017B4A70549P Siddharth Singh
2017B4A70636P Nayan Khanna
2017B4A70740P Aditya Tulsyan
*/
#ifndef __TOKENIZER_STRUCT_H_
#define __TOKENIZER_STRUCT_H_
#include "grammar_structs.h"
typedef struct token{
int line_no;
char *token_name;
Symbol lexeme;
struct token *next;
} Token;
typedef struct tokenStream{
Token *head;
Token *tail;
int length;
} TokenStream;
TokenStream* insertIntoStream(TokenStream *s, int line_num, char *token_str);
TokenStream* newTokenStream();
void freeTokenStream(TokenStream* s);
int tokenizeSourceCode(char *filename, TokenStream *s);
char *replace_char(char *str, char find, char replace);
int tokenizeSourceCode(char *filename, TokenStream *s);
#endif // __TOKENIZER_STRUCT_H_