Switch from "promises" to "accepting set". Fix the definitions
of these accepting set so that they are really usable. Provide a all_accepting_conditions() method for use in the emptyness check, and a neg_accepting_conditions() for products. Predeclare TGBA accepting conditions is the i/o. * src/tgba/bddprint.cc (want_prom): Rename as ... (want_prom): ... this. (print_handler): Adjust to display Acc[]. (print_acc_handler, bdd_print_acc): New functions. * src/tgba/bddprint.hh (print_acc_handler, bdd_print_acc): New functions. * src/tgba/succiter.hh (current_promise): Rename as ... (current_accepting_conditions): ... this. * src/tgba/succiterconcrete.cc (current_state): Rename next to now. (current_promise): Rename as ... (current_accepting_conditions): ... this, and compute the accepting conditions. * src/tgba/dictunion.cc, src/tgba/ltl2tgba.cc, src/tgba/succiterconcrete.hh, src/tgba/tgbabddconcretefactory.cc, src/tgba/tgbabddcoredata.cc, src/tgba/tgbabddcoredata.hh, src/tgba/tgbabdddict.hh, src/tgba/tgbabdddict.cc, src/tgba/tgbabddtranslatefactory.cc, src/tgbaalgos/dotty.cc: Adjust to new names. * src/tgba/tgba.hh (all_accepting_conditions, neg_accepting_conditions): New functions. * src/tgba/tgbabddconcretefactory.cc: Adjust to new names, and record accepting conditions instead of promises. * src/tgba/tgbabddcoredata.hh (accepting_conditions, all_accepting_conditions, negacc_set): New variables. (notnow_set, notprom_set, declare_promise): Rename as ... (notnext_set, notacc_set, declare_accepting_condition): ... these. * src/tgba/tgbaexplicit.hh (tgba_explicit_succ_iterator::current_promise): Rename as ... (tgba_explicit_succ_iterator::current_accepting_conditions): ... this. (tgba_explicit::add_promise): Rename as ... (tgba_explicit::add_accepting_condition): ... this. (tgba_explicit::declare_accepting_condition, tgba_explicit::has_accepting_condition): New variables. (tgba_explicit::get_promise): Rename as ... (tgba_explicit::get_accepting_condition): ... this. (tgba_explicit::all_accepting_conditions, tgba_explicit::neg_accepting_conditions): Implement them. (all_accepting_conditions, neg_accepting_conditions, all_accepting_conditions): New variables. (tgba_explicit_succ_iterator): Embed all_accepting_conditions_. * src/tgba/tgbaexplicit.cc: Likewise. * src/tgba/tgbaproduct.hh (tgba_product_succ_uterator): Embed left_neg_ and right_neg_. (tgba_product::all_accepting_conditions, tgba_product::neg_accepting_conditions): Implement them. * src/tgba/tgbatranslateproxy.hh: (tgba_translate_proxy::all_accepting_conditions, tgba_translate_proxy::neg_accepting_conditions): Implement them. * src/tgba/tgbatranslateproxy.cc: Likewise. * src/tgbaalgos/save.cc (save_rec): Call bdd_print (tgba_save_reachable): Output the `acc =' line. * src/tgbaparse/tgbaparse.yy: Support the for accepting conditions definitions using an "acc =" line at the start. Later, use has_accepting_condition while parsing accepting conditions to ensure they were declared. Disallow !cond in accepting conditions. * src/tgbaparse/tgbascan.ll (ACC_DEF): New token. * src/tgbatest/explicit.cc (main): Declare accepting conditions. * src/tgbatest/ltl2tgba.cc (main): Add support for the -a, -A, and -R new options. * src/tgbatest/tgbaread.cc (main): Really exit on parse error. * src/tgbatest/explicit.test, src/tgbatest/explprod.test, src/tgbatest/mixprod.test, src/tgbatest/readsave.test, src/tgbatest/tgbaread.test, src/tgbatest/tripprod.test: Reflect recent changes.
This commit is contained in:
parent
fbbfda43f2
commit
25e6cca4b4
37 changed files with 662 additions and 220 deletions
|
|
@ -12,10 +12,14 @@
|
|||
{
|
||||
int token;
|
||||
std::string* str;
|
||||
std::list<std::pair<bool, spot::ltl::formula*> >* list;
|
||||
std::list<std::pair<bool, spot::ltl::formula*> >* listp;
|
||||
std::list<spot::ltl::formula*>* list;
|
||||
}
|
||||
|
||||
%{
|
||||
#include "ltlast/constant.hh"
|
||||
#include "ltlvisit/destroy.hh"
|
||||
|
||||
/* tgbaparse.hh and parsedecl.hh include each other recursively.
|
||||
We mut ensure that YYSTYPE is declared (by the above %union)
|
||||
before parsedecl.hh uses it. */
|
||||
|
|
@ -33,15 +37,20 @@ typedef std::pair<bool, spot::ltl::formula*> pair;
|
|||
%token <str> STRING
|
||||
%token <str> IDENT
|
||||
%type <str> strident
|
||||
%type <list> prop_list
|
||||
|
||||
%type <listp> cond_list
|
||||
%type <list> acc_list
|
||||
%token ACC_DEF
|
||||
|
||||
%%
|
||||
tgba: accepting_decl lines | lines;
|
||||
|
||||
accepting_decl: ACC_DEF acc_decl ';'
|
||||
|
||||
lines:
|
||||
| lines line
|
||||
;
|
||||
|
||||
line: strident ',' strident ',' prop_list ',' prop_list ';'
|
||||
line: strident ',' strident ',' cond_list ',' acc_list ';'
|
||||
{
|
||||
spot::tgba_explicit::transition* t
|
||||
= result->create_transition(*$1, *$3);
|
||||
|
|
@ -51,11 +60,9 @@ line: strident ',' strident ',' prop_list ',' prop_list ';'
|
|||
result->add_neg_condition(t, i->second);
|
||||
else
|
||||
result->add_condition(t, i->second);
|
||||
for (i = $7->begin(); i != $7->end(); ++i)
|
||||
if (i->first)
|
||||
result->add_neg_promise(t, i->second);
|
||||
else
|
||||
result->add_promise(t, i->second);
|
||||
std::list<formula*>::iterator i2;
|
||||
for (i2 = $7->begin(); i2 != $7->end(); ++i2)
|
||||
result->add_accepting_condition(t, *i2);
|
||||
delete $1;
|
||||
delete $3;
|
||||
delete $5;
|
||||
|
|
@ -65,27 +72,67 @@ line: strident ',' strident ',' prop_list ',' prop_list ';'
|
|||
|
||||
strident: STRING | IDENT;
|
||||
|
||||
prop_list:
|
||||
cond_list:
|
||||
{
|
||||
$$ = new std::list<pair>;
|
||||
}
|
||||
| prop_list strident
|
||||
| cond_list strident
|
||||
{
|
||||
if (*$2 != "")
|
||||
$1->push_back(pair(false, parse_environment.require(*$2)));
|
||||
{
|
||||
$1->push_back(pair(false, parse_environment.require(*$2)));
|
||||
}
|
||||
delete $2;
|
||||
$$ = $1;
|
||||
}
|
||||
| prop_list '!' strident
|
||||
| cond_list '!' strident
|
||||
{
|
||||
if (*$3 != "")
|
||||
$1->push_back(pair(true, parse_environment.require(*$3)));
|
||||
{
|
||||
$1->push_back(pair(true, parse_environment.require(*$3)));
|
||||
}
|
||||
delete $3;
|
||||
$$ = $1;
|
||||
}
|
||||
;
|
||||
|
||||
;
|
||||
acc_list:
|
||||
{
|
||||
$$ = new std::list<formula*>;
|
||||
}
|
||||
| acc_list strident
|
||||
{
|
||||
if (*$2 == "true")
|
||||
{
|
||||
$1->push_back(constant::true_instance());
|
||||
}
|
||||
else if (*$2 != "" && *$2 != "false")
|
||||
{
|
||||
formula* f = parse_environment.require(*$2);
|
||||
if (! result->has_accepting_condition(f))
|
||||
{
|
||||
error_list.push_back(spot::tgba_parse_error(@2,
|
||||
"undeclared accepting condition"));
|
||||
destroy(f);
|
||||
delete $2;
|
||||
YYERROR;
|
||||
}
|
||||
$1->push_back(f);
|
||||
}
|
||||
delete $2;
|
||||
$$ = $1;
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
acc_decl:
|
||||
| acc_decl strident
|
||||
{
|
||||
formula* f = parse_environment.require(*$2);
|
||||
result->declare_accepting_condition(f);
|
||||
delete $2;
|
||||
}
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ eol \n|\r|\n\r|\r\n
|
|||
return STRING;
|
||||
}
|
||||
|
||||
acc[ \t]*= return ACC_DEF;
|
||||
|
||||
[a-zA-Z][a-zA-Z0-9_]* {
|
||||
yylval->str = new std::string(yytext);
|
||||
return IDENT;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue