%{ /* * Andrea Di Biagio * Politecnico di Milano, 2007 * * assembler.y * Formal Languages & Compilers Machine, 2007/2008 * */ #include #include #include "asm_struct.h" #include "asm_engine.h" /* Variables declared for error tracking */ int line_num; int num_error; /* other global variables */ t_translation_infos *infos; /* functions declared into assembler.y */ char * AsmErrorToString(int errorcode); %} %expect 3 %union{ char *svalue; int immediate; int opcode; t_asm_address *address; t_asm_data *dataVal; t_asm_instruction *instr; t_asm_label *label; t_asm_register *reg; } %start asm /* definitions */ %token OPCODE3 %token OPCODE2 %token OPCODEI %token CCODE %token HALT %token NOP %token _WORD %token _SPACE %token REG %token LPAR %token RPAR %token COLON %token MINUS %token BEGIN_IMMEDIATE %token BEGIN_COMMENT %token END_COMMENT %token COMMENT %token ETI %token IMM %type data_value %type register %type immediate %type
address %type comment %type