Make Progressive as option
This commit is contained in:
11
rs.cc
11
rs.cc
@@ -9,6 +9,7 @@ RctSys::RctSys(void)
|
|||||||
: current_process_defined(false)
|
: current_process_defined(false)
|
||||||
{
|
{
|
||||||
ctx_aut = nullptr;
|
ctx_aut = nullptr;
|
||||||
|
gen_ctxaut_progressive_closure = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RctSys::hasEntity(std::string name)
|
bool RctSys::hasEntity(std::string name)
|
||||||
@@ -306,6 +307,11 @@ void RctSys::ctxAutEnable(void)
|
|||||||
ctx_aut = new CtxAut(opts, this);
|
ctx_aut = new CtxAut(opts, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RctSys::ctxAutEnableProgressiveClosure(void)
|
||||||
|
{
|
||||||
|
gen_ctxaut_progressive_closure = true;
|
||||||
|
}
|
||||||
|
|
||||||
void RctSys::ctxAutAddState(std::string stateName)
|
void RctSys::ctxAutAddState(std::string stateName)
|
||||||
{
|
{
|
||||||
assert(ctx_aut != nullptr);
|
assert(ctx_aut != nullptr);
|
||||||
@@ -355,4 +361,9 @@ void RctSys::ctxAutSaveCurrentContextSet(std::string processName)
|
|||||||
ctx_aut->saveCurrentContextSet(processID);
|
ctx_aut->saveCurrentContextSet(processID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RctSys::ctxAutFinalise(void)
|
||||||
|
{
|
||||||
|
ctx_aut->makeProgressive();
|
||||||
|
}
|
||||||
|
|
||||||
/** EOF **/
|
/** EOF **/
|
||||||
|
|||||||
4
rs.hh
4
rs.hh
@@ -85,12 +85,14 @@ class RctSys
|
|||||||
void printSystem(void);
|
void printSystem(void);
|
||||||
|
|
||||||
void ctxAutEnable(void);
|
void ctxAutEnable(void);
|
||||||
|
void ctxAutEnableProgressiveClosure(void);
|
||||||
void ctxAutAddState(std::string stateName);
|
void ctxAutAddState(std::string stateName);
|
||||||
void ctxAutSetInitState(std::string stateName);
|
void ctxAutSetInitState(std::string stateName);
|
||||||
void ctxAutAddTransition(std::string srcStateName, std::string dstStateName);
|
void ctxAutAddTransition(std::string srcStateName, std::string dstStateName);
|
||||||
void ctxAutAddTransition(std::string srcStateName, std::string dstStateName, StateConstr *stateConstr);
|
void ctxAutAddTransition(std::string srcStateName, std::string dstStateName, StateConstr *stateConstr);
|
||||||
void ctxAutPushNamedContextEntity(std::string entity_name);
|
void ctxAutPushNamedContextEntity(std::string entity_name);
|
||||||
void ctxAutSaveCurrentContextSet(std::string processName);
|
void ctxAutSaveCurrentContextSet(std::string processName);
|
||||||
|
void ctxAutFinalise(void);
|
||||||
|
|
||||||
bool initStatesDefined(void)
|
bool initStatesDefined(void)
|
||||||
{
|
{
|
||||||
@@ -116,6 +118,8 @@ class RctSys
|
|||||||
|
|
||||||
CtxAut *ctx_aut;
|
CtxAut *ctx_aut;
|
||||||
|
|
||||||
|
bool gen_ctxaut_progressive_closure;
|
||||||
|
|
||||||
EntitiesById entities_ids;
|
EntitiesById entities_ids;
|
||||||
EntitiesByName entities_names;
|
EntitiesByName entities_names;
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ void rsin_driver::initialise(void)
|
|||||||
opts = nullptr;
|
opts = nullptr;
|
||||||
use_ctx_aut = false;
|
use_ctx_aut = false;
|
||||||
use_concentrations = false;
|
use_concentrations = false;
|
||||||
|
use_progressive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
rsin_driver::~rsin_driver ()
|
rsin_driver::~rsin_driver ()
|
||||||
@@ -106,3 +107,17 @@ void rsin_driver::useContextAutomaton(void)
|
|||||||
getReactionSystem()->ctxAutEnable();
|
getReactionSystem()->ctxAutEnable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rsin_driver::makeProgressive(void)
|
||||||
|
{
|
||||||
|
use_progressive = true;
|
||||||
|
if (use_ctx_aut)
|
||||||
|
{
|
||||||
|
getReactionSystem()->ctxAutEnableProgressiveClosure();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FERROR("Context automaton not enabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// EOF
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class rsin_driver
|
|||||||
// options in configuration file:
|
// options in configuration file:
|
||||||
bool use_ctx_aut;
|
bool use_ctx_aut;
|
||||||
bool use_concentrations;
|
bool use_concentrations;
|
||||||
|
bool use_progressive;
|
||||||
|
|
||||||
// Handling the scanner
|
// Handling the scanner
|
||||||
void scan_begin();
|
void scan_begin();
|
||||||
@@ -60,7 +61,7 @@ class rsin_driver
|
|||||||
ensureOptionsAllowed();
|
ensureOptionsAllowed();
|
||||||
use_concentrations = true;
|
use_concentrations = true;
|
||||||
};
|
};
|
||||||
|
void makeProgressive(void);
|
||||||
void ensureReactionSystemReady(void);
|
void ensureReactionSystemReady(void);
|
||||||
void setupReactionSystem(void);
|
void setupReactionSystem(void);
|
||||||
|
|
||||||
@@ -78,4 +79,3 @@ class rsin_driver
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ blank [ \t]
|
|||||||
"options" return token::OPTIONS;
|
"options" return token::OPTIONS;
|
||||||
"use-context-automaton" return token::USE_CTX_AUT;
|
"use-context-automaton" return token::USE_CTX_AUT;
|
||||||
"use-concentrations" return token::USE_CONCENTRATIONS;
|
"use-concentrations" return token::USE_CONCENTRATIONS;
|
||||||
|
"make-progressive" return token::MAKE_PROGRESSIVE;
|
||||||
"reactions" return token::REACTIONS;
|
"reactions" return token::REACTIONS;
|
||||||
"initial-contexts" return token::INITIALCONTEXTS;
|
"initial-contexts" return token::INITIALCONTEXTS;
|
||||||
"context-entities" return token::CONTEXTENTITIES;
|
"context-entities" return token::CONTEXTENTITIES;
|
||||||
@@ -128,4 +129,3 @@ rsin_driver::scan_end()
|
|||||||
{
|
{
|
||||||
fclose(yyin);
|
fclose(yyin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class rsin_driver;
|
|||||||
#include "rsin_driver.hh"
|
#include "rsin_driver.hh"
|
||||||
}
|
}
|
||||||
|
|
||||||
%token OPTIONS USE_CTX_AUT USE_CONCENTRATIONS
|
%token OPTIONS USE_CTX_AUT USE_CONCENTRATIONS MAKE_PROGRESSIVE
|
||||||
%token REACTIONS INITIALCONTEXTS CONTEXTENTITIES RSCTLKFORM
|
%token REACTIONS INITIALCONTEXTS CONTEXTENTITIES RSCTLKFORM
|
||||||
%token CONTEXTAUTOMATON STATES INITSTATE TRANSITIONS
|
%token CONTEXTAUTOMATON STATES INITSTATE TRANSITIONS
|
||||||
%token EQ LCB RCB LRB RRB LSB RSB LAB RAB COL SEMICOL DOT COMMA RARR
|
%token EQ LCB RCB LRB RRB LSB RSB LAB RAB COL SEMICOL DOT COMMA RARR
|
||||||
@@ -77,34 +77,40 @@ class rsin_driver;
|
|||||||
|
|
||||||
%start system;
|
%start system;
|
||||||
|
|
||||||
system:
|
system:
|
||||||
| OPTIONS LCB options RCB system
|
| OPTIONS LCB options RCB system
|
||||||
| REACTIONS LCB reactionsets RCB system
|
| REACTIONS LCB reactionsets RCB system
|
||||||
| INITIALCONTEXTS LCB initstates RCB system
|
| INITIALCONTEXTS LCB initstates RCB system
|
||||||
| CONTEXTENTITIES LCB actionentities RCB system
|
| CONTEXTENTITIES LCB actionentities RCB system
|
||||||
| CONTEXTAUTOMATON LCB ctxaut RCB system
|
| CONTEXTAUTOMATON LCB ctxaut RCB system
|
||||||
| RSCTLKFORM LCB IDENTIFIER COL rsctlk_form RCB system {
|
{
|
||||||
driver.addFormRSCTLK(*$3, $5);
|
driver.getReactionSystem()->ctxAutFinalise();
|
||||||
free($3);
|
}
|
||||||
}
|
| RSCTLKFORM LCB IDENTIFIER COL rsctlk_form RCB system {
|
||||||
;
|
driver.addFormRSCTLK(*$3, $5);
|
||||||
|
free($3);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
options:
|
options:
|
||||||
| options option SEMICOL
|
| options option SEMICOL
|
||||||
;
|
;
|
||||||
|
|
||||||
option:
|
option:
|
||||||
| USE_CTX_AUT {
|
| USE_CTX_AUT {
|
||||||
driver.useContextAutomaton();
|
driver.useContextAutomaton();
|
||||||
}
|
}
|
||||||
| USE_CONCENTRATIONS {
|
| USE_CONCENTRATIONS {
|
||||||
driver.useConcentrations();
|
driver.useConcentrations();
|
||||||
}
|
}
|
||||||
|
| MAKE_PROGRESSIVE {
|
||||||
|
driver.makeProgressive();
|
||||||
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* -------------------------
|
* -------------------------
|
||||||
* REACTIONS
|
* REACTIONS
|
||||||
* -------------------------
|
* -------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -113,11 +119,11 @@ reactionsets:
|
|||||||
;
|
;
|
||||||
|
|
||||||
process_reactions: processname LCB reactions RCB SEMICOL
|
process_reactions: processname LCB reactions RCB SEMICOL
|
||||||
|
|
||||||
processname: IDENTIFIER {
|
processname: IDENTIFIER {
|
||||||
driver.getReactionSystem()->setCurrentProcess(*$1);
|
driver.getReactionSystem()->setCurrentProcess(*$1);
|
||||||
free($1);
|
free($1);
|
||||||
}
|
}
|
||||||
|
|
||||||
reactions:
|
reactions:
|
||||||
| reactions reaction SEMICOL
|
| reactions reaction SEMICOL
|
||||||
@@ -146,7 +152,7 @@ reactant: IDENTIFIER {
|
|||||||
|
|
||||||
inhibitors:
|
inhibitors:
|
||||||
inhibitor
|
inhibitor
|
||||||
| inhibitors COMMA inhibitor
|
| inhibitors COMMA inhibitor
|
||||||
;
|
;
|
||||||
|
|
||||||
inhibitor:
|
inhibitor:
|
||||||
@@ -180,7 +186,7 @@ initstates:
|
|||||||
|
|
||||||
initstate:
|
initstate:
|
||||||
| entity
|
| entity
|
||||||
| initstate COMMA entity
|
| initstate COMMA entity
|
||||||
;
|
;
|
||||||
|
|
||||||
entity: IDENTIFIER {
|
entity: IDENTIFIER {
|
||||||
@@ -191,7 +197,7 @@ entity: IDENTIFIER {
|
|||||||
|
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
|
|
||||||
actionentities:
|
actionentities:
|
||||||
| actentity
|
| actentity
|
||||||
| actionentities COMMA actentity
|
| actionentities COMMA actentity
|
||||||
;
|
;
|
||||||
@@ -201,7 +207,7 @@ actentity: IDENTIFIER {
|
|||||||
free($1);
|
free($1);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
|
|
||||||
ctxaut:
|
ctxaut:
|
||||||
@@ -226,11 +232,11 @@ autinitstate: IDENTIFIER {
|
|||||||
free($1);
|
free($1);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
auttransitions:
|
auttransitions:
|
||||||
| auttrans
|
| auttrans
|
||||||
| auttrans SEMICOL auttransitions
|
| auttrans SEMICOL auttransitions
|
||||||
;
|
;
|
||||||
|
|
||||||
auttrans: LCB proc_ctxsets RCB COL IDENTIFIER RARR IDENTIFIER {
|
auttrans: LCB proc_ctxsets RCB COL IDENTIFIER RARR IDENTIFIER {
|
||||||
driver.getReactionSystem()->ctxAutAddTransition(*$5, *$7);
|
driver.getReactionSystem()->ctxAutAddTransition(*$5, *$7);
|
||||||
@@ -243,22 +249,22 @@ auttrans: LCB proc_ctxsets RCB COL IDENTIFIER RARR IDENTIFIER {
|
|||||||
free($7);
|
free($7);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
proc_ctxsets:
|
proc_ctxsets:
|
||||||
| proc_ctxsets single_proc_ctxset
|
| proc_ctxsets single_proc_ctxset
|
||||||
;
|
;
|
||||||
|
|
||||||
single_proc_ctxset: IDENTIFIER EQ LCB contextset RCB {
|
single_proc_ctxset: IDENTIFIER EQ LCB contextset RCB {
|
||||||
driver.getReactionSystem()->ctxAutSaveCurrentContextSet(*$1);
|
driver.getReactionSystem()->ctxAutSaveCurrentContextSet(*$1);
|
||||||
free($1);
|
free($1);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
contextset:
|
contextset:
|
||||||
| ctxentity
|
| ctxentity
|
||||||
| contextset COMMA ctxentity
|
| contextset COMMA ctxentity
|
||||||
;
|
;
|
||||||
|
|
||||||
ctxentity: IDENTIFIER {
|
ctxentity: IDENTIFIER {
|
||||||
driver.getReactionSystem()->ctxAutPushNamedContextEntity(*$1);
|
driver.getReactionSystem()->ctxAutPushNamedContextEntity(*$1);
|
||||||
free($1);
|
free($1);
|
||||||
@@ -266,7 +272,7 @@ ctxentity: IDENTIFIER {
|
|||||||
;
|
;
|
||||||
|
|
||||||
/* formulae */
|
/* formulae */
|
||||||
|
|
||||||
state_constr: IDENTIFIER DOT IDENTIFIER {
|
state_constr: IDENTIFIER DOT IDENTIFIER {
|
||||||
$$ = new StateConstr(*$1, *$3);
|
$$ = new StateConstr(*$1, *$3);
|
||||||
free($1);
|
free($1);
|
||||||
@@ -324,7 +330,7 @@ state_constr: IDENTIFIER DOT IDENTIFIER {
|
|||||||
// }
|
// }
|
||||||
// ;
|
// ;
|
||||||
|
|
||||||
rsctlk_form:
|
rsctlk_form:
|
||||||
IDENTIFIER DOT IDENTIFIER {
|
IDENTIFIER DOT IDENTIFIER {
|
||||||
$$ = new FormRSCTLK(*$1, *$3);
|
$$ = new FormRSCTLK(*$1, *$3);
|
||||||
free($1);
|
free($1);
|
||||||
@@ -371,7 +377,7 @@ rsctlk_form:
|
|||||||
}
|
}
|
||||||
| AG rsctlk_form {
|
| AG rsctlk_form {
|
||||||
$$ = new FormRSCTLK(RSCTLK_AG, $2);
|
$$ = new FormRSCTLK(RSCTLK_AG, $2);
|
||||||
}
|
}
|
||||||
| UK LSB IDENTIFIER RSB LRB rsctlk_form RRB {
|
| UK LSB IDENTIFIER RSB LRB rsctlk_form RRB {
|
||||||
Agents_f agents;
|
Agents_f agents;
|
||||||
agents.insert(*$3);
|
agents.insert(*$3);
|
||||||
@@ -411,7 +417,7 @@ rsctlk_form:
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
/* contexts as boolean formulae */
|
/* contexts as boolean formulae */
|
||||||
| E LAB state_constr RAB X rsctlk_form {
|
| E LAB state_constr RAB X rsctlk_form {
|
||||||
$$ = new FormRSCTLK(RSCTLK_EX_ACT, $3, $6);
|
$$ = new FormRSCTLK(RSCTLK_EX_ACT, $3, $6);
|
||||||
}
|
}
|
||||||
| E LAB state_constr RAB U LRB rsctlk_form COMMA rsctlk_form RRB {
|
| E LAB state_constr RAB U LRB rsctlk_form COMMA rsctlk_form RRB {
|
||||||
@@ -443,4 +449,3 @@ yy::rsin_parser::error(const yy::rsin_parser::location_type &l, const std::strin
|
|||||||
{
|
{
|
||||||
driver.error(l, m);
|
driver.error(l, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
symrs.cc
4
symrs.cc
@@ -34,12 +34,8 @@ SymRS::SymRS(RctSys *rs, Options *opts)
|
|||||||
pv_ca_succ = nullptr;
|
pv_ca_succ = nullptr;
|
||||||
tr_ca = nullptr;
|
tr_ca = nullptr;
|
||||||
|
|
||||||
// TODO: this should be triggered by the parser and it should depend
|
|
||||||
// on an option in the input file
|
|
||||||
rs->ctx_aut->makeProgressive();
|
rs->ctx_aut->makeProgressive();
|
||||||
|
|
||||||
rs->printSystem();
|
|
||||||
|
|
||||||
encode();
|
encode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user