#ifndef INPUT_INCLUDED #define INPUT_INCLUDED //Macros for constant values //which are used in a number of data structures below #define SYM 0 #define VAL 1 #define OP 2 #define STRING 0 #define EXP 1 #define LBL 0 #define MNM 1 #define DIR 2 typedef enum { ADD, ADDCC, ADDX, ADDXCC, SUB, SUBCC, SUBX, SUBXCC, MULSCC, AND, ANDCC, ANDN, ANDNCC, OR, ORCC, ORN, ORNCC, XOR, XORCC, XNOR, XNORCC, SLL, SRL, SRA, LDUB, LDSB, LDUH, LDSH, LD, LDD, STB, STH, ST, STD, SWAP, BA, BN, BE, BNE, BL, BLE, BGE, BG, BLU, BLEU, BGEU, BGU, BPOS, BNEG, BCS, BCC, BVS, BVC, TA, CALL, JMPL, RETT, SETHI, SAVE, RESTORE, CMP, TST, RET, NOT, NEG, INC, INCCC, DEC, DECCC, MOV, NOP } Mnemonic_Type; typedef enum {R, G, O, L, I, SP, FP} Register_Type; struct register_info { Register_Type reg_type; int reg_number; }; typedef enum { BIT_OR, BIT_XOR, BIT_AND, LSHIFT, RSHIFT, PLUS, MINUS, MUL, DIV, MODULO, UMINUS, COMPLEMENT, HI, LO } Operation_Type; struct operation { Operation_Type op_type; struct expression *left; //left is NULL for unary operation struct expression *right; }; struct expression { int exp_type; //SYM, VAL, OP union { char *sym; int val; struct operation *op; } u; }; struct mnemonic { Mnemonic_Type mnm_type; int format; union { struct register_info *reg; struct expression *exp; } u[3]; }; typedef enum { ASCII, ASCIZ, SECTION, SKIP, ALIGN, BYTE, HALF, WORD, GLOBAL } Directive_Type; struct argument { int arg_type; //STRING or EXP union { char *string; struct expression *exp; } u; struct argument *next; }; struct directive { Directive_Type dir_type; struct argument *arg_list; }; struct instruction { int instr_type; //LBL, MNM, or DIR union { char *lbl; struct mnemonic *mnm; struct directive *dir; } u; struct instruction *next; }; extern struct instruction *first; extern int input (void); #endif