Explicit automata can now have arbitrary logic formula on their
arcs. ltl2tgba_fm benefits from this and join multiple arcs with the same destination and acceptance conditions. * src/tgba/formula2bdd.cc, src/tgba/formula2bdd.hh: New files. * src/tgba/Makefile.am (tgba_HEADERS, libtgba_la_SOURCES): Add them. * src/tgba/bddprint.cc, src/tgba/bddprint.hh (bdd_pring_formula, bdd_format_formula): New functions. * src/tgba/tgbaexplicit.hh (tgba_explicit::get_condition, tgba_explicit::add_condition, tgba_explicit::add_neg_condition, tgba_explicit::declare_accepting_condition, tgba_explicit::has_accepting_condition, tgba_explicit::get_accepting_condition, tgba_explicit::add_accepting_condition): Take a const formula*. * src/tgba/tgbaexplicit.cc (tgba_explicit::add_condition): Rewrite using formula_to_bdd. * src/tgbaalgos/dotty.cc (dotty_bfs::process_link): Use bdd_print_formula to display conditions. * src/tgbaalgos/save.cc (save_bfs::process_state): Likewise. * src/tgbaalgos/ltl2tgba_fm.cc (translate_dict::bdd_to_formula): New function. (translate_dict::conj_bdd_to_atomic_props): Remove. (ltl_to_tgba_fm): Factor successors on accepting conditions and destinations, not conditions. Use bdd_to_formula to translate the conditions. * src/tgbaparse/tgbaparse.yy: Expect conditions as a formula in a string, call the LTL parser for this. * src/tgbaparse/tgbascan.ll: Process " and \ escapes in strings. * src/tgbatest/emptchke.test, src/tgbatest/explicit.test, src/tgbatest/explpro2.test, src/tgbatest/explpro3.test, src/tgbatest/explprod.test, src/tgbatest/mixprod.test, src/tgbatest/readsave.test, src/tgbatest/tgbaread.test, src/tgbatest/tripprod.test: Adjust to new syntax for explicit automata.
This commit is contained in:
parent
3126e49b28
commit
20289e4e7f
22 changed files with 465 additions and 116 deletions
|
|
@ -40,6 +40,7 @@
|
|||
%{
|
||||
#include "ltlast/constant.hh"
|
||||
#include "ltlvisit/destroy.hh"
|
||||
#include "ltlparse/public.hh"
|
||||
|
||||
/* tgbaparse.hh and parsedecl.hh include each other recursively.
|
||||
We mut ensure that YYSTYPE is declared (by the above %union)
|
||||
|
|
@ -55,9 +56,9 @@ using namespace spot::ltl;
|
|||
typedef std::pair<bool, spot::ltl::formula*> pair;
|
||||
%}
|
||||
|
||||
%token <str> STRING
|
||||
%token <str> STRING UNTERMINATED_STRING
|
||||
%token <str> IDENT
|
||||
%type <str> strident
|
||||
%type <str> strident string
|
||||
%type <listp> cond_list
|
||||
%type <list> acc_list
|
||||
%token ACC_DEF
|
||||
|
|
@ -92,17 +93,37 @@ line: strident ',' strident ',' cond_list ',' acc_list ';'
|
|||
}
|
||||
;
|
||||
|
||||
strident: STRING | IDENT;
|
||||
string: STRING
|
||||
| UNTERMINATED_STRING
|
||||
{
|
||||
error_list.push_back(spot::tgba_parse_error(@1,
|
||||
"unterminated string"));
|
||||
}
|
||||
|
||||
strident: string | IDENT
|
||||
|
||||
cond_list:
|
||||
{
|
||||
$$ = new std::list<pair>;
|
||||
}
|
||||
| cond_list strident
|
||||
| cond_list string§
|
||||
{
|
||||
if (*$2 != "")
|
||||
{
|
||||
$1->push_back(pair(false, parse_environment.require(*$2)));
|
||||
parse_error_list pel;
|
||||
formula* f = spot::ltl::parse(*$2, pel, parse_environment);
|
||||
for (parse_error_list::iterator i = pel.begin();
|
||||
i != pel.end(); ++i)
|
||||
{
|
||||
// Adjust the diagnostic to the current position.
|
||||
Location here = @2;
|
||||
here.begin.line += i->first.begin.line;
|
||||
here.begin.column += i->first.begin.column;
|
||||
here.end.line = here.begin.line + i->first.begin.line;
|
||||
here.end.column = here.begin.column + i->first.begin.column;
|
||||
error_list.push_back(spot::tgba_parse_error(here, i->second));
|
||||
}
|
||||
$1->push_back(pair(false, f));
|
||||
}
|
||||
delete $2;
|
||||
$$ = $1;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
%option noyywrap
|
||||
%option prefix="tgbayy"
|
||||
%option outfile="lex.yy.c"
|
||||
%x STATE_STRING
|
||||
|
||||
%{
|
||||
#include <string>
|
||||
|
|
@ -50,12 +51,6 @@ eol \n|\r|\n\r|\r\n
|
|||
yylloc->step ();
|
||||
%}
|
||||
|
||||
\"[^\"]*\" {
|
||||
yylval->str = new std::string(yytext + 1,
|
||||
yyleng - 2);
|
||||
return STRING;
|
||||
}
|
||||
|
||||
acc[ \t]*= return ACC_DEF;
|
||||
|
||||
[a-zA-Z][a-zA-Z0-9_]* {
|
||||
|
|
@ -67,8 +62,27 @@ acc[ \t]*= return ACC_DEF;
|
|||
{eol} yylloc->lines(yyleng); yylloc->step();
|
||||
[ \t]+ yylloc->step();
|
||||
|
||||
\" {
|
||||
yylval->str = new std::string;
|
||||
BEGIN(STATE_STRING);
|
||||
}
|
||||
|
||||
. return *yytext;
|
||||
|
||||
/* Handle \" and \\ in strings. */
|
||||
<STATE_STRING>{
|
||||
\" {
|
||||
BEGIN(INITIAL);
|
||||
return STRING;
|
||||
}
|
||||
\\["\\] yylval->str->append(1, yytext[1]);
|
||||
[^"\\]+ yylval->str->append (yytext, yyleng);
|
||||
<<EOF>> {
|
||||
BEGIN(INITIAL);
|
||||
return UNTERMINATED_STRING;
|
||||
}
|
||||
}
|
||||
|
||||
%{
|
||||
/* Dummy use of yyunput to shut up a gcc warning. */
|
||||
(void) &yyunput;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue