aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Changelog.md24
-rw-r--r--README.md2
-rw-r--r--src/inpla.y41
-rw-r--r--src/lex.l2
4 files changed, 60 insertions, 9 deletions
diff --git a/Changelog.md b/Changelog.md
index 880470e..4ea452f 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,6 +1,30 @@
# Change log
+### v0.11.1 (released on 14 Feb 2024)
+
+#### Bug Fix
+
+- **Negative numbers as immutable constants**: Negative numbers were not defined as immutable constants. This is now fixed.
+
+ ```
+ >>> const N=-8;
+ >>> r~N;
+ (0 interactions, 0.00 sec)
+ >>> ifce;
+ r
+
+ Connections:
+ r ->-8
+
+ >>>
+ ```
+
+
+
+
+
### v0.11.0 (released on 13 May 2023)
+
#### Polished
- **The expansion size of the Flexibly expandable ring buffer for agents and names**: Nodes in Inpla are managed by the ring buffer. A set of nodes is inserted to the ring buffer when all nodes are used up. The size of the new nodes was based on the size of the set where we found all the nodes had run out, but this was turned out to be inefficient, especially for the reuse optimisation. So, it is now based on the size of the buffer where the last node was placed. It improves the reuse optimisation. The annotations for the optimisation were selected heuristically. Now they are placed systematically based on an algorithm. The execution times are shown in the table below. We can get more or less almost the same ones (the bold ones mean faster or the same). This will be the basis for the automatic placement of the annotations.
diff --git a/README.md b/README.md
index 4bdc811..98068ea 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
Inpla is a multi-threaded parallel interpreter of interaction nets. Once you write programs for sequential execution, it works also in multi-threaded parallel execution. Each thread is managed on each CPU-core with POSIX-thread library.
-* The current version is 0.11.0, released on **13 May 2023**. (See [Changelog.md](Changelog.md) for details.)
+* The current version is 0.11.1, released on **14 Feb 2024**. (See [Changelog.md](Changelog.md) for details.)
* The below graph shows speed-up ratio to threads numbers for programs in the following benchmark table.
![speedup-ratio](pic/benchmark_reuse_v0.11.0.png)
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 <chval> NAME AGENT
-%token <longval> INT_LITERAL
+%token <longval> NUMERAL_LITERAL
%token <chval> STRING_LITERAL
%token LP RP LC RC LB RB COMMA CROSS DELIMITER ABR
%token COLON
@@ -354,7 +354,7 @@ command:
}
-| DEF AGENT LD INT_LITERAL DELIMITER {
+| DEF AGENT LD NUMERAL_LITERAL DELIMITER {
int entry=ast_recordConst($2,$4);
if (!entry) {
@@ -363,6 +363,15 @@ command:
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));
+ fflush(stdout);
+ }
+ }
;
@@ -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; i<size; i++) {
+ if (!IS_READYFORUSE(last[i].basic.id)) {
+ count++;
+ }
+ }
+ printf("%lu is occupied in %lu size.\n\n", count, size);
+ }
+ */
+ // printf("%lu is occupied.\n",
+ // Heap_GetNum_Usage_forAgent(hp));
+
+
HoopList *new_hoop_list;
//unsigned int new_size_p2 = hoop_list->size * 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() {
<INITIAL>[A-Z][a-zA-Z0-9_'\.]* { yylval.chval = strdup(yytext);
return (AGENT);}
<INITIAL>[0-9]+ { yylval.longval = atol(yytext);
- return (INT_LITERAL);}
+ return (NUMERAL_LITERAL);}
<INITIAL>"//"[^\n]* ; //comment
<INITIAL>"/*" BEGIN(COM_STATE);