diff options
| -rw-r--r-- | Changelog.md | 27 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | src/inpla.y | 118 |
3 files changed, 88 insertions, 59 deletions
diff --git a/Changelog.md b/Changelog.md index 3658402..d78be84 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,33 @@ # Change log +### v0.13.0-2 (released on 12 September 2024) + +#### Polished + +- **Fix a compilation error**: It has been reported that in some environments the compilation stops with an error: `a label can only be part of a statement and a declaration is not a statement`. It causes the following case followed by variable declaration at line 5886: + + ``` + case AST_AGENT: + int id = IdTable_getid_builtin_funcAgent(ptr); + ... + ``` + + It is fixed by adding brackets like this: + + ``` + case AST_AGENT: + { + int id = IdTable_getid_builtin_funcAgent(ptr); + ... + } + ``` + + I hope that it will work in many environments. + + + ### v0.13.0-1 (released on 7 September 2024) + #### Polished - **The source code of the compile function is cleaned up more**: Some parts of the compile function were not changed in the previous version. They are now cleaned up. @@ -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.13.0-1, released on **7 September 2024**. (See [Changelog.md](Changelog.md) for details.) +* The current version is 0.13.0-2, released on **12 September 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.  diff --git a/src/inpla.y b/src/inpla.y index 945c016..0bdf4b4 100644 --- a/src/inpla.y +++ b/src/inpla.y @@ -22,8 +22,8 @@ // ---------------------------------------------- -#define VERSION "0.13.0-1" -#define BUILT_DATE "7 September 2024" +#define VERSION "0.13.0-2" +#define BUILT_DATE "12 September 2024" // ------------------------------------------------------------------ @@ -5883,86 +5883,88 @@ int Compile_term_on_ast(Ast *ptr, int target) { case AST_AGENT: - int id = IdTable_getid_builtin_funcAgent(ptr); + { + int id = IdTable_getid_builtin_funcAgent(ptr); - if (id == -1) { - id = NameTable_get_set_id_with_IdTable_forAgent((char *)ptr->left->sym); - } + if (id == -1) { + id = NameTable_get_set_id_with_IdTable_forAgent((char *)ptr->left->sym); + } - // Get the arity - arity=0; - { - Ast *arg = ptr->right; - for (i=0; i<MAX_PORT; i++) { - if (arg == NULL) break; - arity++; - arg = ast_getTail(arg); + // Get the arity + arity=0; + { + Ast *arg = ptr->right; + for (i=0; i<MAX_PORT; i++) { + if (arg == NULL) break; + arity++; + arg = ast_getTail(arg); + } } - } - /* - ptr=ptr->right; - for (i=0; i<MAX_PORT; i++) { - if (ptr == NULL) break; - alloc[i] = Compile_term_on_ast(ptr->left, -1); - arity++; - ptr = ast_getTail(ptr); - } - */ + /* + ptr=ptr->right; + for (i=0; i<MAX_PORT; i++) { + if (ptr == NULL) break; + alloc[i] = Compile_term_on_ast(ptr->left, -1); + arity++; + ptr = ast_getTail(ptr); + } + */ - IdTable_set_arity(id, arity); + IdTable_set_arity(id, arity); - ptr=ptr->right; + ptr=ptr->right; - if (target == -1) { - result = CmEnv_newvar(); + if (target == -1) { + result = CmEnv_newvar(); - IMCode_genCode2(OP_MKAGENT, id, result); + IMCode_genCode2(OP_MKAGENT, id, result); - for (i=0; i<arity; i++) { - alloc = Compile_term_on_ast(ptr->left, -1); - ptr = ast_getTail(ptr); - - IMCode_genCode3(OP_LOADP, alloc, i, result); - } - } else { - - result = target; - - if (target == VM_OFFSET_ANNOTATE_L) { - if (CmEnv.idL != id) { - IMCode_genCode1(OP_CHID_L, id); - } for (i=0; i<arity; i++) { alloc = Compile_term_on_ast(ptr->left, -1); ptr = ast_getTail(ptr); + + IMCode_genCode3(OP_LOADP, alloc, i, result); + } + } else { + + result = target; + + if (target == VM_OFFSET_ANNOTATE_L) { + if (CmEnv.idL != id) { + IMCode_genCode1(OP_CHID_L, id); + } + for (i=0; i<arity; i++) { + alloc = Compile_term_on_ast(ptr->left, -1); + ptr = ast_getTail(ptr); - if (alloc != VM_OFFSET_METAVAR_L(i)) { - IMCode_genCode2(OP_LOADP_L, alloc, i); + if (alloc != VM_OFFSET_METAVAR_L(i)) { + IMCode_genCode2(OP_LOADP_L, alloc, i); + } } - } - } else { + } else { - if (CmEnv.idR != id) { - IMCode_genCode1(OP_CHID_R, id); - } - for (i=0; i<arity; i++) { - alloc = Compile_term_on_ast(ptr->left, -1); - ptr = ast_getTail(ptr); + if (CmEnv.idR != id) { + IMCode_genCode1(OP_CHID_R, id); + } + for (i=0; i<arity; i++) { + alloc = Compile_term_on_ast(ptr->left, -1); + ptr = ast_getTail(ptr); - if (alloc != VM_OFFSET_METAVAR_R(i)) { - IMCode_genCode2(OP_LOADP_R, alloc, i); + if (alloc != VM_OFFSET_METAVAR_R(i)) { + IMCode_genCode2(OP_LOADP_R, alloc, i); + } } } - } - } + } - return result; + return result; + } break; |
