From e813c7b6903feb2afa106cd0cf9732fc19b363f2 Mon Sep 17 00:00:00 2001 From: Shinya Sato Date: Wed, 14 Feb 2024 21:16:42 +0900 Subject: v0.11.1 --- src/inpla.y | 41 ++++++++++++++++++++++++++++++++++------- src/lex.l | 2 +- 2 files changed, 35 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/inpla.y b/src/inpla.y index 430c5cc..00a3a9a 100644 --- a/src/inpla.y +++ b/src/inpla.y @@ -22,8 +22,8 @@ // ---------------------------------------------- -#define VERSION "0.11.0" -#define BUILT_DATE "13 May 2023" +#define VERSION "0.11.1" +#define BUILT_DATE "14 Feb 2024" // ------------------------------------------------------------------ @@ -158,7 +158,7 @@ static char *Errormsg = NULL; } %token NAME AGENT -%token INT_LITERAL +%token NUMERAL_LITERAL %token STRING_LITERAL %token LP RP LC RC LB RB COMMA CROSS DELIMITER ABR %token COLON @@ -354,9 +354,18 @@ command: } -| DEF AGENT LD INT_LITERAL DELIMITER { +| DEF AGENT LD NUMERAL_LITERAL DELIMITER { int entry=ast_recordConst($2,$4); + if (!entry) { + printf("`%s' has been already bound to a value `%d' as immutable.\n\n", + $2, ast_getRecordedVal(entry)); + fflush(stdout); + } + } +| DEF AGENT LD SUB NUMERAL_LITERAL DELIMITER { + int entry=ast_recordConst($2,$5*(-1)); + if (!entry) { printf("`%s' has been already bound to a value `%d' as immutable.\n\n", $2, ast_getRecordedVal(entry)); @@ -566,7 +575,7 @@ unary_expr primary_expr : nameterm { $$ = $1;} -| INT_LITERAL { $$ = ast_makeInt($1); } +| NUMERAL_LITERAL { $$ = ast_makeInt($1); } | AGENT { $$=ast_makeAST(AST_AGENT, ast_makeSymbol($1), NULL); } | LP expr RP { $$ = $2; } @@ -904,7 +913,7 @@ static inline void myfree(VALUE ptr) { SET_HOOPFLAG_READYFORUSE(BASIC(ptr)->id); - + } static inline @@ -1124,6 +1133,25 @@ VALUE myalloc_Agent(Heap *hp) { #ifdef VERBOSE_HOOP_EXPANSION puts("(Agent hoop is expanded)"); #endif + + //puts("!"); + /* + { + Agent *last = (Agent *)(hp->last_alloc_list->hoop); + unsigned long size = hp->last_alloc_list->size; + unsigned long count = 0; + for (unsigned long i = 0; isize * Hoop_increasing_magnitude; @@ -11104,7 +11132,6 @@ int exec(Ast *at) { printf("(%d mkAgent calls)\n", NumberOfMkAgent); #endif - #ifdef VERBOSE_NODE_USE printf("(%lu agents and %lu names nodes are used.)\n", Heap_GetNum_Usage_forAgent(&VM.agentHeap), diff --git a/src/lex.l b/src/lex.l index 6c90969..1bdb1ce 100644 --- a/src/lex.l +++ b/src/lex.l @@ -142,7 +142,7 @@ char *Parse_closeStringBuffer() { [A-Z][a-zA-Z0-9_'\.]* { yylval.chval = strdup(yytext); return (AGENT);} [0-9]+ { yylval.longval = atol(yytext); - return (INT_LITERAL);} + return (NUMERAL_LITERAL);} "//"[^\n]* ; //comment "/*" BEGIN(COM_STATE); -- cgit v1.2.3