-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparser.h
More file actions
37 lines (32 loc) · 784 Bytes
/
parser.h
File metadata and controls
37 lines (32 loc) · 784 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
#ifndef PARSER_H
#define PARSER_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "list.h"
char* getCleanLine(char* in);
void getDest(char* in, char* out);
void getComp(char* in, char* out);
void getJump(char* in, char* out);
void getSymbolValue(char* in, char* out);
enum CommandType getCommandType(char* in);
struct ParsedCommand* getParsedCommand(char* in);
void freeParsedCommand(struct ParsedCommand* p);
void findOrCreateSymbol(char* in, char* out);
void processLabel(char* cleanLine, int lineCount);
void setupParserSymbolTable();
void cleanupParserSymbolTable();
enum CommandType {
C_TYPE,
A_TYPE,
L_TYPE
};
struct ParsedCommand {
enum CommandType ct;
char memLocation[6];
char dest[4];
char comp[4];
char jump[4];
};
#endif