From b5977b972befa8b81cae58deb5a19fc1a5f623fe Mon Sep 17 00:00:00 2001 From: Teddy Date: Wed, 26 Mar 2014 03:46:54 +0800 Subject: ... --- README.rst | 11 +++++++++++ ast.c | 5 +++-- ast.h | 2 ++ cibic.l | 4 ++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 7e7a79d..f3d7714 100644 --- a/README.rst +++ b/README.rst @@ -1,3 +1,14 @@ CBIC -- C Implemented Bare and Ingenuous Compiler ================================================= +Build Requirements +------------------ +- flex >= 2.5.37 +- bison >= 2.4.3 +- gcc >= 4.7.3 + +Features +--------- +- User-friendly AST printing +- More sophisticated error reporting +- Small memory footprint diff --git a/ast.c b/ast.c index 538b386..6bbc176 100644 --- a/ast.c +++ b/ast.c @@ -221,7 +221,8 @@ CNode *cnode_list_wrap(int type, CNode *list) { } char *cnode_debug_type_repr(CNode *ast) { - static char buffer[1024], abuff[1024]; + static char buffer[MAX_DEBUG_PRINT_BUFF], + abuff[MAX_DEBUG_PRINT_BUFF]; char *type, *aptr = abuff; switch (ast->type) { @@ -388,7 +389,7 @@ void cnode_debug_print_plain(CNode *ast) { } void cnode_debug_print_fancy(CNode *ast, int lvl) { - static int show[1024]; + static int show[MAX_DEBUG_PRINT_LVL]; int i; show[lvl] = 1; for (i = 0; i < lvl - 1; i++) diff --git a/ast.h b/ast.h index 77d2c9b..a6c5c4a 100644 --- a/ast.h +++ b/ast.h @@ -23,6 +23,8 @@ #define STMT_RET 1041 #define MAX_CHDN 1024 +#define MAX_DEBUG_PRINT_BUFF 1024 +#define MAX_DEBUG_PRINT_LVL 1024 typedef struct CNode { enum { diff --git a/cibic.l b/cibic.l index 9c88be2..e6e449b 100644 --- a/cibic.l +++ b/cibic.l @@ -1,8 +1,8 @@ %{ #include "cibic.tab.h" - +#define MAX_LINEBUFF 1024 int yycolumn = 1; -char linebuff[1024], *lptr = linebuff; +char linebuff[MAX_LINEBUFF], *lptr = linebuff; #define YY_USER_ACTION \ do { \ -- cgit v1.2.3