-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlexer.h
42 lines (34 loc) · 924 Bytes
/
lexer.h
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
39
40
41
42
/*
=======================================================================================================
PPL ASSIGNMENT 1 2020
GROUP NUMBER 14
RUSHIKESH ZAWAR 2017B1A70977P
SHREY SHAH 2017B2A71038P
ABHIMANYU SETHI 2017B3A70637P
PRANALI SANCHETI 2017B3A70736P
=======================================================================================================
*/
#ifndef LEXER_H
#define LEXER_H
typedef enum {
#include "tokens.txt"
}token_name;
typedef struct TokenStream{
token_name name;
int tag; // 0 -string, 1 - number 2 - Real number
union Data {
char str[21];
int num;
double rnum;
} data;
int line_no;
struct TokenStream* next;
} tokenStream;
typedef struct TokenStreamHead{
int count;
tokenStream* head;
} tokenStreamHead;
token_name give_token_enum(char* s);
void tokeniseSourceCode(FILE *f, tokenStreamHead* streamHead);
void printTokenStream(tokenStream* ts);
#endif