pa1.2: fix include and word type

This commit is contained in:
xinyangli 2024-01-13 11:42:35 +08:00
parent ebece52aec
commit 4aa536e1ef
No known key found for this signature in database
2 changed files with 10 additions and 4 deletions

View file

@ -1,16 +1,21 @@
%{
%code requires {
#include <common.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
extern int yylex(void);
void yyerror(uint32_t *result, const char *err) {
}
%{
#include <common.h>
#include <stdio.h>
#include <stdlib.h>
void yyerror(word_t *result, const char *err) {
fprintf(stderr, "Error: %s\n", err);
}
%}
%token NUMBER HEX_NUMBER
%start input
%define api.value.type { uint32_t }
%define api.value.type { word_t }
%parse-param { uint32_t *result }
%left '-' '+'
%left '*' '/'

View file

@ -1,4 +1,5 @@
TEST_SRCS += tests/expr_test.c
YACC = bison
$(OBJ_DIR)/%: %.c $(TEST_OBJS) app
@mkdir -p $(dir $@)