forked from f20180301/PPL_Assignment_2020
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtokeniseSourceCode.h
92 lines (84 loc) · 1.83 KB
/
tokeniseSourceCode.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/**
SHUBHAM AGARWAL -- 2018A7PS0301P
YASH RAJ SINGH -- 2018A7PS0214P
SAHIL KATTNA -- 2018A7PS0154P
AGRAWAL RAJAT RAMESH -- 2018A7PS0182P
**/
#ifndef _TOKENISESOURCECODE_
#define _TOKENISESOURCECODE_
/*************************TOKEN STRUCT IMPORTS******************************/
typedef struct token
{ //TOKEN STRUCTURE
char lexeme[200];
char token[200];
int lineno;
struct token *next;
} token;
token *head = NULL;
token *tail = NULL; //Head, Tail of LinkedList for TokenStream
char *ha[13][2] = {"program", //FOR KEYWORD
"PROGRAM",
"declare",
"DECLARE",
"list",
"LIST",
"of",
"OF",
"variables",
"VARIABLES",
"size",
"SIZE",
"values",
"VALUES",
"integer",
"INTEGER",
"real",
"REAL",
"boolean",
"BOOLEAN",
"array",
"ARRAY",
"jagged",
"JAGGED",
"R1",
"R1"};
char *op[16][2] = { //FOR KEYWORD
"+",
"PLUS",
"-",
"MINUS",
"*",
"MUL",
"/",
"DIVIDE",
"(",
"BROP",
")",
"BRCL",
"{",
"CURLYOP",
"}",
"CURLYCL",
"[",
"SQOP",
"]",
"SQCL",
"&&&",
"AND",
"|||",
"OR",
":",
"COLON",
";",
"SEMICOLON",
"..",
"DD",
"=",
"EQUALS"};
//**********************FUNCTION DECLARATIONS***************************//
char *getToken(char *);
void printLinkedList();
token *createNode(char *, int);
token *insertNode(token *);
void tokeniseSourcecode(char *, token *);
#endif