T.I.M | Toolchain Documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
asm_lex.h
Go to the documentation of this file.
1 
10 #ifndef ASM_LEX_H
11 #define ASM_LEX_H
12 
13 #define lex_tok_LOAD "LOAD"
14 #define lex_tok_STORE "STORE"
15 #define lex_tok_PUSH "PUSH"
16 #define lex_tok_POP "POP"
17 #define lex_tok_MOV "MOV"
18 #define lex_tok_JUMP "JUMP"
19 #define lex_tok_CALL "CALL"
20 #define lex_tok_RETURN "RETURN"
21 #define lex_tok_TEST "TEST"
22 #define lex_tok_HALT "HALT"
23 #define lex_tok_AND "AND"
24 #define lex_tok_NAND "NAND"
25 #define lex_tok_OR "OR"
26 #define lex_tok_NOR "NOR"
27 #define lex_tok_XOR "XOR"
28 #define lex_tok_LSL "LSL"
29 #define lex_tok_LSR "LSR"
30 #define lex_tok_NOT "NOT"
31 #define lex_tok_IADD "IADD"
32 #define lex_tok_ISUB "ISUB"
33 #define lex_tok_IMUL "IMUL"
34 #define lex_tok_IDIV "IDIV"
35 #define lex_tok_IASR "IASR"
36 #define lex_tok_FADD "FADD"
37 #define lex_tok_FSUB "FSUB"
38 #define lex_tok_FMUL "FMUL"
39 #define lex_tok_FDIV "FDIV"
40 #define lex_tok_FASR "FASR"
41 #define lex_tok_NOP "NOP"
42 #define lex_tok_SLEEP "SLEEP"
43 #define lex_tok_DATA "DATA"
44 
45 
46 typedef enum asm_lex_opcode_e{
47  LEX_LOAD = 1,
48  LEX_STORE = 2 ,
49  LEX_PUSH = 3 ,
50  LEX_POP = 4 ,
51  LEX_MOV = 5 ,
52  LEX_JUMP = 6 ,
53  LEX_CALL = 7 ,
54  LEX_RETURN = 8 ,
55  LEX_TEST = 9 ,
56  LEX_HALT = 10,
57  LEX_AND = 11,
58  LEX_NAND = 12,
59  LEX_OR = 13,
60  LEX_NOR = 14,
61  LEX_XOR = 15,
62  LEX_LSL = 16,
63  LEX_LSR = 17,
64  LEX_NOT = 18,
65  LEX_IADD = 19,
66  LEX_ISUB = 20,
67  LEX_IMUL = 21,
68  LEX_IDIV = 22,
69  LEX_IASR = 23,
70  LEX_FADD = 24,
71  LEX_FSUB = 25,
72  LEX_FMUL = 26,
73  LEX_FDIV = 27,
74  LEX_FASR = 28,
75  LEX_NOP = 29,
76  LEX_SLEEP = 30,
77  LEX_DATA = 31,
78  LEX_ERROR = 32
80 
82 typedef char asm_lex_label;
83 
85 typedef union asm_lex_token_value_e{
92 
94 typedef enum asm_lex_token_type_e{
101 
102 
104 typedef struct asm_lex_token_t asm_lex_token;
108  asm_lex_token * next;
109  unsigned int line_number;
110 };
111 
118 asm_lex_token * asm_lex_input_file(FILE * input, int * errors);
119 
120 #endif
Definition: asm_lex.h:67
asm_lex_opcode
Definition: asm_lex.h:46
Definition: asm_lex.h:55
Definition: asm_lex.h:77
asm_lex_token * asm_lex_input_file(FILE *input, int *errors)
Parses an entire input file into a single lexical token stream.
Definition: asm_lex.c:185
Definition: asm_lex.h:95
Definition: asm_lex.h:66
Definition: asm_lex.h:48
Typedef for the asm lexer token structure.
Definition: asm_lex.h:105
int tim_immediate
typedef for tim immediate values as operands to instructions.
Definition: common.h:76
tim_condition
A condition code for conditional execution.
Definition: common.h:187
Definition: asm_lex.h:59
tim_immediate immediate
Definition: asm_lex.h:87
Definition: asm_lex.h:54
Definition: asm_lex.h:99
Definition: asm_lex.h:70
asm_lex_label * label
Definition: asm_lex.h:90
asm_lex_token_type type
Definition: asm_lex.h:106
Definition: asm_lex.h:52
Definition: asm_lex.h:65
Definition: asm_lex.h:78
Union to hold the correct value of an instruction.
Definition: asm_lex.h:85
Definition: asm_lex.h:73
Definition: asm_lex.h:97
tim_register
Encodes the address of the registers.
Definition: common.h:79
Definition: asm_lex.h:49
Definition: asm_lex.h:53
Definition: asm_lex.h:61
Definition: asm_lex.h:68
tim_condition condition
Definition: asm_lex.h:88
Definition: asm_lex.h:63
Definition: asm_lex.h:56
Definition: asm_lex.h:50
Definition: asm_lex.h:62
Definition: asm_lex.h:47
Definition: asm_lex.h:51
tim_register reg
Definition: asm_lex.h:86
asm_lex_token_value value
Definition: asm_lex.h:107
Definition: asm_lex.h:76
char asm_lex_label
Type mask for a character array.
Definition: asm_lex.h:82
asm_lex_token * next
Definition: asm_lex.h:108
Definition: asm_lex.h:74
Definition: asm_lex.h:72
Definition: asm_lex.h:98
asm_lex_opcode opcode
Definition: asm_lex.h:89
Definition: asm_lex.h:75
Definition: asm_lex.h:57
Definition: asm_lex.h:64
unsigned int line_number
Definition: asm_lex.h:109
asm_lex_token_type
The type of token that a lexer token can be.
Definition: asm_lex.h:94
Definition: asm_lex.h:60
Definition: asm_lex.h:69
Definition: asm_lex.h:58
Definition: asm_lex.h:96
Definition: asm_lex.h:71