From add49f1df854ed333252b494d1899c8c899991dd Mon Sep 17 00:00:00 2001 From: Shinya Sato Date: Thu, 10 Mar 2022 21:10:34 +0900 Subject: v0.8.1-1 --- src/inpla.y | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) (limited to 'src/inpla.y') diff --git a/src/inpla.y b/src/inpla.y index ea533f0..cb06e67 100644 --- a/src/inpla.y +++ b/src/inpla.y @@ -33,8 +33,8 @@ //#define COUNT_MKAGENT // count of execution fo mkagent -#define VERSION "0.8.1" -#define BUILT_DATE "3 Mar. 2022" +#define VERSION "0.8.1-1" +#define BUILT_DATE "10 Mar. 2022" // ------------------------------------------------------------------ @@ -468,9 +468,13 @@ ap // | astparams ABR AGENT LP astparams RP { $$ = ast_unfoldABR($1, $3, $5); } +| ABR AGENT LP astparams RP +{ $$ = ast_unfoldABR(NULL, $2, $4); } // | astparams ABR NAME LP astparams RP { $$ = ast_unfoldABR($1, $3, $5); } +| ABR NAME LP astparams RP +{ $$ = ast_unfoldABR(NULL, $2, $4); } ; @@ -6687,6 +6691,8 @@ int Compile_rule_mainbody_on_ast(Ast *mainbody) { // ------------------------------------------------------------ // TABLE for RULES // ------------------------------------------------------------ +#ifndef RULETABLE_SIMPLE + typedef struct RuleList { int sym; int available; @@ -6864,6 +6870,54 @@ void RuleTable_get_code_for_Int(VALUE heap_syml, void ***code) { return; } +#else +// ------------------------------------------ +// RuleTable: simple realisation with arrays +// ------------------------------------------ +// +// codes for alpha>basic.id; + int symrID = AGENT(heap_symr)->basic.id; + + void *code = RuleTable[symrID][symlID]; + if (code == NULL) { + *result = 0; + } else { + *result = 1; + } + + return code; +} + +static inline +void RuleTable_get_code_for_Int(VALUE heap_syml, void ***code) { + int symlID = AGENT(heap_syml)->basic.id; + *code = RuleTable[ID_INT][symlID]; +} + +#endif -- cgit v1.2.3