eltl2tgba: remove this unused code.
* src/eltlparse/.gitignore, src/eltlparse/Makefile.am, src/eltlparse/eltlparse.yy, src/eltlparse/eltlscan.ll, src/eltlparse/fmterror.cc, src/eltlparse/parsedecl.hh, src/eltlparse/public.hh, src/eltltest/.gitignore, src/eltltest/Makefile.am, src/eltltest/acc.cc, src/eltltest/acc.test, src/eltltest/defs.in, src/eltltest/nfa.cc, src/eltltest/nfa.test, src/tgbaalgos/eltl2tgba_lacim.cc, src/tgbaalgos/eltl2tgba_lacim.hh, src/tgbatest/eltl2tgba.test: Delete these files. * src/Makefile.am, src/tgbaalgos/Makefile.am, src/tgbatest/Makefile.am, src/tgbatest/ltl2tgba.cc, src/tgbatest/ltlcross.test, src/tgbatest/spotlbtt.test, README, configure.ac: Adjust.
This commit is contained in:
parent
06b3a80af3
commit
af8ce5dfa1
25 changed files with 13 additions and 2059 deletions
2
README
2
README
|
|
@ -146,8 +146,6 @@ src/ Sources for libspot.
|
||||||
bin/ User tools built using the Spot library.
|
bin/ User tools built using the Spot library.
|
||||||
man/ Man pages for the above tools.
|
man/ Man pages for the above tools.
|
||||||
dstarparse/ Parser for the output of ltl2dstar.
|
dstarparse/ Parser for the output of ltl2dstar.
|
||||||
eltlparse/ Parser for ELTL formulae.
|
|
||||||
eltltest/ Tests for ELTL nodes in ltlast/ and eltlparse/.
|
|
||||||
graph/ Graph representations.
|
graph/ Graph representations.
|
||||||
graphtest/ Graph representations.
|
graphtest/ Graph representations.
|
||||||
kripke/ Kripke Structure interface.
|
kripke/ Kripke Structure interface.
|
||||||
|
|
|
||||||
|
|
@ -177,9 +177,6 @@ AC_CONFIG_FILES([
|
||||||
src/bin/Makefile
|
src/bin/Makefile
|
||||||
src/bin/man/Makefile
|
src/bin/man/Makefile
|
||||||
src/dstarparse/Makefile
|
src/dstarparse/Makefile
|
||||||
src/eltlparse/Makefile
|
|
||||||
src/eltltest/defs
|
|
||||||
src/eltltest/Makefile
|
|
||||||
src/kripke/Makefile
|
src/kripke/Makefile
|
||||||
src/graph/Makefile
|
src/graph/Makefile
|
||||||
src/graphtest/Makefile
|
src/graphtest/Makefile
|
||||||
|
|
|
||||||
|
|
@ -25,17 +25,16 @@ AUTOMAKE_OPTIONS = subdir-objects
|
||||||
# List directories in the order they must be built. Keep tests at the
|
# List directories in the order they must be built. Keep tests at the
|
||||||
# end, after building '.' (since the current directory contains
|
# end, after building '.' (since the current directory contains
|
||||||
# libspot.la needed by the tests)
|
# libspot.la needed by the tests)
|
||||||
SUBDIRS = misc priv ltlenv ltlast ltlvisit ltlparse eltlparse graph \
|
SUBDIRS = misc priv ltlenv ltlast ltlvisit ltlparse graph tgba \
|
||||||
tgba tgbaalgos tgbaparse ta taalgos kripke saba sabaalgos \
|
tgbaalgos tgbaparse ta taalgos kripke saba sabaalgos \
|
||||||
neverparse kripkeparse dstarparse . bin ltltest eltltest \
|
neverparse kripkeparse dstarparse . bin ltltest graphtest \
|
||||||
graphtest tgbatest sabatest kripketest sanity
|
tgbatest sabatest kripketest sanity
|
||||||
|
|
||||||
lib_LTLIBRARIES = libspot.la
|
lib_LTLIBRARIES = libspot.la
|
||||||
libspot_la_SOURCES =
|
libspot_la_SOURCES =
|
||||||
libspot_la_LDFLAGS = $(BUDDY_LDFLAGS) -no-undefined
|
libspot_la_LDFLAGS = $(BUDDY_LDFLAGS) -no-undefined
|
||||||
libspot_la_LIBADD = \
|
libspot_la_LIBADD = \
|
||||||
dstarparse/libdstarparse.la \
|
dstarparse/libdstarparse.la \
|
||||||
eltlparse/libeltlparse.la \
|
|
||||||
kripke/libkripke.la \
|
kripke/libkripke.la \
|
||||||
kripkeparse/libkripkeparse.la \
|
kripkeparse/libkripkeparse.la \
|
||||||
ltlast/libltlast.la \
|
ltlast/libltlast.la \
|
||||||
|
|
|
||||||
7
src/eltlparse/.gitignore
vendored
7
src/eltlparse/.gitignore
vendored
|
|
@ -1,7 +0,0 @@
|
||||||
eltlparse.cc
|
|
||||||
eltlparse.hh
|
|
||||||
*.output
|
|
||||||
eltlscan.cc
|
|
||||||
location.hh
|
|
||||||
position.hh
|
|
||||||
stack.hh
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
## -*- coding: utf-8 -*-
|
|
||||||
## Copyright (C) 2008, 2011, 2013 Laboratoire de Recherche et
|
|
||||||
## Développement de l'Epita (LRDE).
|
|
||||||
##
|
|
||||||
## This file is part of Spot, a model checking library.
|
|
||||||
##
|
|
||||||
## Spot is free software; you can redistribute it and/or modify it
|
|
||||||
## under the terms of the GNU General Public License as published by
|
|
||||||
## the Free Software Foundation; either version 3 of the License, or
|
|
||||||
## (at your option) any later version.
|
|
||||||
##
|
|
||||||
## Spot is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
||||||
## License for more details.
|
|
||||||
##
|
|
||||||
## You should have received a copy of the GNU General Public License
|
|
||||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
AM_CPPFLAGS = -I$(srcdir)/.. -I.. -DYY_NO_INPUT
|
|
||||||
# Disable -Werror because too many versions of flex yield warnings.
|
|
||||||
AM_CXXFLAGS = $(WARNING_CXXFLAGS:-Werror=)
|
|
||||||
|
|
||||||
eltlparsedir = $(pkgincludedir)/eltlparse
|
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libeltlparse.la
|
|
||||||
|
|
||||||
ELTLPARSE_YY = eltlparse.yy
|
|
||||||
FROM_ELTLPARSE_YY_MAIN = eltlparse.cc
|
|
||||||
FROM_ELTLPARSE_YY_OTHERS = \
|
|
||||||
stack.hh \
|
|
||||||
eltlparse.hh
|
|
||||||
FROM_ELTLPARSE_YY = $(FROM_ELTLPARSE_YY_MAIN) $(FROM_ELTLPARSE_YY_OTHERS)
|
|
||||||
|
|
||||||
BUILT_SOURCES = $(FROM_ELTLPARSE_YY)
|
|
||||||
MAINTAINERCLEANFILES = $(FROM_ELTLPARSE_YY)
|
|
||||||
|
|
||||||
$(FROM_ELTLPARSE_YY_MAIN): $(srcdir)/$(ELTLPARSE_YY)
|
|
||||||
## We must cd into $(srcdir) first because if we tell bison to read
|
|
||||||
## $(srcdir)/$(ELTLPARSE_YY), it will also use the value of $(srcdir)/
|
|
||||||
## in the generated include statements.
|
|
||||||
cd $(srcdir) && \
|
|
||||||
$(BISON) -Wall -Werror --report=all $(BISON_EXTRA_FLAGS) \
|
|
||||||
$(ELTLPARSE_YY) -o $(FROM_ELTLPARSE_YY_MAIN)
|
|
||||||
$(FROM_ELTLPARSE_YY_OTHERS): $(ELTLPARSE_YY)
|
|
||||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $(FROM_ELTLPARSE_YY_MAIN)
|
|
||||||
|
|
||||||
EXTRA_DIST = $(ELTLPARSE_YY)
|
|
||||||
|
|
||||||
libeltlparse_la_SOURCES = \
|
|
||||||
fmterror.cc \
|
|
||||||
$(FROM_ELTLPARSE_YY) \
|
|
||||||
eltlscan.ll \
|
|
||||||
parsedecl.hh
|
|
||||||
|
|
||||||
eltlparse_HEADERS = public.hh
|
|
||||||
|
|
||||||
|
|
@ -1,568 +0,0 @@
|
||||||
/* -*- coding: utf-8 -*-
|
|
||||||
** Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Laboratoire
|
|
||||||
** de Recherche et Développement de l'Epita (LRDE).
|
|
||||||
**
|
|
||||||
** This file is part of Spot, a model checking library.
|
|
||||||
**
|
|
||||||
** Spot is free software; you can redistribute it and/or modify it
|
|
||||||
** under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation; either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Spot is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
||||||
** License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
%language "C++"
|
|
||||||
%locations
|
|
||||||
%defines
|
|
||||||
%name-prefix "eltlyy"
|
|
||||||
%debug
|
|
||||||
%error-verbose
|
|
||||||
%define api.location.type "spot::location"
|
|
||||||
|
|
||||||
%code requires
|
|
||||||
{
|
|
||||||
#include <string>
|
|
||||||
#include <sstream>
|
|
||||||
#include <limits>
|
|
||||||
#include <cerrno>
|
|
||||||
#include <algorithm>
|
|
||||||
#include "public.hh"
|
|
||||||
#include "ltlast/allnodes.hh"
|
|
||||||
#include "ltlast/formula_tree.hh"
|
|
||||||
|
|
||||||
namespace spot
|
|
||||||
{
|
|
||||||
namespace eltl
|
|
||||||
{
|
|
||||||
typedef std::map<std::string, nfa::ptr> nfamap;
|
|
||||||
|
|
||||||
/// The following parser allows one to define aliases of automaton
|
|
||||||
/// operators such as: F=U(true,$0). Internally it's handled by
|
|
||||||
/// creating a small AST associated with each alias in order to
|
|
||||||
/// instanciate the right automatop after: U(constant(1), AP(f))
|
|
||||||
/// for the formula F(f).
|
|
||||||
typedef std::map<std::string, formula_tree::node_ptr> aliasmap;
|
|
||||||
|
|
||||||
/// Implementation details for error handling.
|
|
||||||
struct parse_error_list_t
|
|
||||||
{
|
|
||||||
parse_error_list list_;
|
|
||||||
std::string file_;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
%parse-param {spot::eltl::nfamap& nmap}
|
|
||||||
%parse-param {spot::eltl::aliasmap& amap}
|
|
||||||
%parse-param {spot::eltl::parse_error_list_t &pe}
|
|
||||||
%parse-param {spot::ltl::environment &parse_environment}
|
|
||||||
%parse-param {const spot::ltl::formula* &result}
|
|
||||||
%lex-param {spot::eltl::parse_error_list_t &pe}
|
|
||||||
%expect 0
|
|
||||||
|
|
||||||
%union
|
|
||||||
{
|
|
||||||
int ival;
|
|
||||||
std::string* sval;
|
|
||||||
spot::ltl::nfa* nval;
|
|
||||||
spot::ltl::automatop::vec* aval;
|
|
||||||
const spot::ltl::formula* fval;
|
|
||||||
|
|
||||||
/// To handle aliases.
|
|
||||||
spot::ltl::formula_tree::node* pval;
|
|
||||||
spot::ltl::formula_tree::node_nfa* bval;
|
|
||||||
}
|
|
||||||
|
|
||||||
%code {
|
|
||||||
/* ltlparse.hh and parsedecl.hh include each other recursively.
|
|
||||||
We mut ensure that YYSTYPE is declared (by the above %union)
|
|
||||||
before parsedecl.hh uses it. */
|
|
||||||
#include "parsedecl.hh"
|
|
||||||
using namespace spot::eltl;
|
|
||||||
using namespace spot::ltl;
|
|
||||||
|
|
||||||
namespace spot
|
|
||||||
{
|
|
||||||
namespace eltl
|
|
||||||
{
|
|
||||||
using namespace spot::ltl::formula_tree;
|
|
||||||
|
|
||||||
/// Alias an existing alias, as in Strong=G(F($0))->G(F($1)),
|
|
||||||
/// where F is an alias.
|
|
||||||
///
|
|
||||||
/// \param ap The original alias.
|
|
||||||
/// \param v The arguments of the new alias.
|
|
||||||
static node_ptr
|
|
||||||
realias(const node_ptr ap, std::vector<node_ptr> v)
|
|
||||||
{
|
|
||||||
if (node_atomic* a = dynamic_cast<node_atomic*>(ap.get())) // Do it.
|
|
||||||
return a->i < 0 ? ap : v.at(a->i);
|
|
||||||
|
|
||||||
// Traverse the tree.
|
|
||||||
if (node_unop* a = dynamic_cast<node_unop*>(ap.get()))
|
|
||||||
{
|
|
||||||
node_unop* res = new node_unop;
|
|
||||||
res->op = a->op;
|
|
||||||
res->child = realias(a->child, v);
|
|
||||||
return node_ptr(res);
|
|
||||||
}
|
|
||||||
if (node_nfa* a = dynamic_cast<node_nfa*>(ap.get()))
|
|
||||||
{
|
|
||||||
node_nfa* res = new node_nfa;
|
|
||||||
std::vector<node_ptr>::const_iterator i = a->children.begin();
|
|
||||||
while (i != a->children.end())
|
|
||||||
res->children.push_back(realias(*i++, v));
|
|
||||||
res->nfa = a->nfa;
|
|
||||||
return node_ptr(res);
|
|
||||||
}
|
|
||||||
if (node_binop* a = dynamic_cast<node_binop*>(ap.get()))
|
|
||||||
{
|
|
||||||
node_binop* res = new node_binop;
|
|
||||||
res->op = a->op;
|
|
||||||
res->lhs = realias(a->lhs, v);
|
|
||||||
res->rhs = realias(a->rhs, v);
|
|
||||||
return node_ptr(res);
|
|
||||||
}
|
|
||||||
if (node_multop* a = dynamic_cast<node_multop*>(ap.get()))
|
|
||||||
{
|
|
||||||
node_multop* res = new node_multop;
|
|
||||||
res->op = a->op;
|
|
||||||
res->lhs = realias(a->lhs, v);
|
|
||||||
res->rhs = realias(a->rhs, v);
|
|
||||||
return node_ptr(res);
|
|
||||||
}
|
|
||||||
SPOT_UNREACHABLE();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define PARSE_ERROR(Loc, Msg) \
|
|
||||||
pe.list_.push_back \
|
|
||||||
(parse_error(Loc, spair(pe.file_, Msg)))
|
|
||||||
|
|
||||||
#define CHECK_EXISTING_NMAP(Loc, Ident) \
|
|
||||||
{ \
|
|
||||||
nfamap::const_iterator i = nmap.find(*Ident); \
|
|
||||||
if (i == nmap.end()) \
|
|
||||||
{ \
|
|
||||||
std::string s = "unknown automaton operator `"; \
|
|
||||||
s += *Ident; \
|
|
||||||
s += "'"; \
|
|
||||||
PARSE_ERROR(Loc, s); \
|
|
||||||
delete Ident; \
|
|
||||||
YYERROR; \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define CHECK_ARITY(Loc, Ident, A1, A2) \
|
|
||||||
{ \
|
|
||||||
if (A1 != A2) \
|
|
||||||
{ \
|
|
||||||
std::ostringstream oss1; \
|
|
||||||
oss1 << A1; \
|
|
||||||
std::ostringstream oss2; \
|
|
||||||
oss2 << A2; \
|
|
||||||
\
|
|
||||||
std::string s(*Ident); \
|
|
||||||
s += " is used with "; \
|
|
||||||
s += oss1.str(); \
|
|
||||||
s += " arguments, but has an arity of "; \
|
|
||||||
s += oss2.str(); \
|
|
||||||
PARSE_ERROR(Loc, s); \
|
|
||||||
delete Ident; \
|
|
||||||
YYERROR; \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define INSTANCIATE_OP(Name, TypeNode, TypeOp, L, R) \
|
|
||||||
{ \
|
|
||||||
TypeNode* res = new TypeNode; \
|
|
||||||
res->op = TypeOp; \
|
|
||||||
res->lhs = formula_tree::node_ptr(L); \
|
|
||||||
res->rhs = formula_tree::node_ptr(R); \
|
|
||||||
Name = res; \
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* All tokens. */
|
|
||||||
|
|
||||||
%token <sval> ATOMIC_PROP "atomic proposition"
|
|
||||||
IDENT "identifier"
|
|
||||||
|
|
||||||
%token <ival> ARG "argument"
|
|
||||||
STATE "state"
|
|
||||||
OP_OR "or operator"
|
|
||||||
OP_XOR "xor operator"
|
|
||||||
OP_AND "and operator"
|
|
||||||
OP_IMPLIES "implication operator"
|
|
||||||
OP_EQUIV "equivalent operator"
|
|
||||||
OP_NOT "not operator"
|
|
||||||
|
|
||||||
%token ACC "accept"
|
|
||||||
EQ "="
|
|
||||||
FIN "finish"
|
|
||||||
LPAREN "("
|
|
||||||
RPAREN ")"
|
|
||||||
COMMA ","
|
|
||||||
END_OF_FILE "end of file"
|
|
||||||
CONST_TRUE "constant true"
|
|
||||||
CONST_FALSE "constant false"
|
|
||||||
|
|
||||||
/* Priorities. */
|
|
||||||
|
|
||||||
%left OP_OR
|
|
||||||
%left OP_XOR
|
|
||||||
%left OP_AND
|
|
||||||
%left OP_IMPLIES OP_EQUIV
|
|
||||||
|
|
||||||
%left ATOMIC_PROP
|
|
||||||
|
|
||||||
%nonassoc OP_NOT
|
|
||||||
|
|
||||||
%type <nval> nfa_def
|
|
||||||
%type <fval> subformula
|
|
||||||
%type <aval> arg_list
|
|
||||||
%type <pval> nfa_arg
|
|
||||||
%type <bval> nfa_arg_list
|
|
||||||
|
|
||||||
%destructor { delete $$; } <sval>
|
|
||||||
%destructor { $$->destroy(); } <fval>
|
|
||||||
|
|
||||||
%printer { debug_stream() << *$$; } <sval>
|
|
||||||
|
|
||||||
%%
|
|
||||||
|
|
||||||
result: nfa_list subformula
|
|
||||||
{
|
|
||||||
result = $2;
|
|
||||||
YYACCEPT;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
/* NFA definitions. */
|
|
||||||
|
|
||||||
nfa_list: /* empty */
|
|
||||||
| nfa_list nfa
|
|
||||||
;
|
|
||||||
|
|
||||||
nfa: IDENT "=" "(" nfa_def ")"
|
|
||||||
{
|
|
||||||
$4->set_name(*$1);
|
|
||||||
nmap[*$1] = nfa::ptr($4);
|
|
||||||
delete $1;
|
|
||||||
}
|
|
||||||
| IDENT "=" nfa_arg
|
|
||||||
{
|
|
||||||
/// Recursivity issues of aliases are handled by a parse error.
|
|
||||||
aliasmap::iterator i = amap.find(*$1);
|
|
||||||
if (i != amap.end())
|
|
||||||
{
|
|
||||||
std::string s = "`";
|
|
||||||
s += *$1;
|
|
||||||
s += "' is already aliased";
|
|
||||||
PARSE_ERROR(@1, s);
|
|
||||||
delete $1;
|
|
||||||
YYERROR;
|
|
||||||
}
|
|
||||||
amap.insert(make_pair(*$1, formula_tree::node_ptr($3)));
|
|
||||||
delete $1;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
nfa_def: /* empty */
|
|
||||||
{
|
|
||||||
$$ = new nfa;
|
|
||||||
}
|
|
||||||
| nfa_def STATE STATE nfa_arg
|
|
||||||
{
|
|
||||||
$1->add_transition($2, $3, formula_tree::node_ptr($4));
|
|
||||||
$$ = $1;
|
|
||||||
}
|
|
||||||
| nfa_def ACC STATE
|
|
||||||
{
|
|
||||||
$1->set_final($3);
|
|
||||||
$$ = $1;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
nfa_arg_list: nfa_arg
|
|
||||||
{
|
|
||||||
$$ = new formula_tree::node_nfa;
|
|
||||||
$$->children.push_back(formula_tree::node_ptr($1));
|
|
||||||
}
|
|
||||||
| nfa_arg_list "," nfa_arg
|
|
||||||
{
|
|
||||||
$1->children.push_back(formula_tree::node_ptr($3));
|
|
||||||
$$ = $1;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
nfa_arg: ARG
|
|
||||||
{
|
|
||||||
if ($1 == -1)
|
|
||||||
{
|
|
||||||
std::string s = "out of range integer";
|
|
||||||
PARSE_ERROR(@1, s);
|
|
||||||
YYERROR;
|
|
||||||
}
|
|
||||||
formula_tree::node_atomic* res = new formula_tree::node_atomic;
|
|
||||||
res->i = $1;
|
|
||||||
$$ = res;
|
|
||||||
}
|
|
||||||
| CONST_TRUE
|
|
||||||
{
|
|
||||||
formula_tree::node_atomic* res = new formula_tree::node_atomic;
|
|
||||||
res->i = formula_tree::True;
|
|
||||||
$$ = res;
|
|
||||||
}
|
|
||||||
| CONST_FALSE
|
|
||||||
{
|
|
||||||
formula_tree::node_atomic* res = new formula_tree::node_atomic;
|
|
||||||
res->i = formula_tree::False;
|
|
||||||
$$ = res;
|
|
||||||
}
|
|
||||||
| OP_NOT nfa_arg
|
|
||||||
{
|
|
||||||
formula_tree::node_unop* res = new formula_tree::node_unop;
|
|
||||||
res->op = unop::Not;
|
|
||||||
res->child = formula_tree::node_ptr($2);
|
|
||||||
$$ = res;
|
|
||||||
}
|
|
||||||
| FIN "(" nfa_arg ")"
|
|
||||||
{
|
|
||||||
formula_tree::node_unop* res = new formula_tree::node_unop;
|
|
||||||
res->op = unop::Finish;
|
|
||||||
res->child = formula_tree::node_ptr($3);
|
|
||||||
$$ = res;
|
|
||||||
}
|
|
||||||
| nfa_arg OP_AND nfa_arg
|
|
||||||
{
|
|
||||||
INSTANCIATE_OP($$, formula_tree::node_multop, multop::And, $1, $3);
|
|
||||||
}
|
|
||||||
| nfa_arg OP_OR nfa_arg
|
|
||||||
{
|
|
||||||
INSTANCIATE_OP($$, formula_tree::node_multop, multop::Or, $1, $3);
|
|
||||||
}
|
|
||||||
| nfa_arg OP_XOR nfa_arg
|
|
||||||
{
|
|
||||||
INSTANCIATE_OP($$, formula_tree::node_binop, binop::Xor, $1, $3);
|
|
||||||
}
|
|
||||||
| nfa_arg OP_IMPLIES nfa_arg
|
|
||||||
{
|
|
||||||
INSTANCIATE_OP($$, formula_tree::node_binop, binop::Implies, $1, $3);
|
|
||||||
}
|
|
||||||
| nfa_arg OP_EQUIV nfa_arg
|
|
||||||
{
|
|
||||||
INSTANCIATE_OP($$, formula_tree::node_binop, binop::Equiv, $1, $3);
|
|
||||||
}
|
|
||||||
| IDENT "(" nfa_arg_list ")"
|
|
||||||
{
|
|
||||||
aliasmap::const_iterator i = amap.find(*$1);
|
|
||||||
if (i != amap.end())
|
|
||||||
{
|
|
||||||
unsigned arity = formula_tree::arity(i->second);
|
|
||||||
CHECK_ARITY(@1, $1, $3->children.size(), arity);
|
|
||||||
|
|
||||||
// Hack to return the right type without screwing with the
|
|
||||||
// std::shared_ptr memory handling by using get for
|
|
||||||
// example. FIXME: modify the %union to handle
|
|
||||||
// formula_tree::node_ptr.
|
|
||||||
formula_tree::node_unop* tmp1 = new formula_tree::node_unop;
|
|
||||||
tmp1->op = unop::Not;
|
|
||||||
tmp1->child = realias(i->second, $3->children);
|
|
||||||
formula_tree::node_unop* tmp2 = new formula_tree::node_unop;
|
|
||||||
tmp2->op = unop::Not;
|
|
||||||
tmp2->child = formula_tree::node_ptr(tmp1);
|
|
||||||
$$ = tmp2;
|
|
||||||
delete $3;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CHECK_EXISTING_NMAP(@1, $1);
|
|
||||||
nfa::ptr np = nmap[*$1];
|
|
||||||
|
|
||||||
CHECK_ARITY(@1, $1, $3->children.size(), np->arity());
|
|
||||||
$3->nfa = np;
|
|
||||||
$$ = $3;
|
|
||||||
}
|
|
||||||
delete $1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Formulae. */
|
|
||||||
|
|
||||||
subformula: ATOMIC_PROP
|
|
||||||
{
|
|
||||||
$$ = parse_environment.require(*$1);
|
|
||||||
if (!$$)
|
|
||||||
{
|
|
||||||
std::string s = "unknown atomic proposition `";
|
|
||||||
s += *$1;
|
|
||||||
s += "' in environment `";
|
|
||||||
s += parse_environment.name();
|
|
||||||
s += "'";
|
|
||||||
PARSE_ERROR(@1, s);
|
|
||||||
delete $1;
|
|
||||||
YYERROR;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
delete $1;
|
|
||||||
}
|
|
||||||
| subformula ATOMIC_PROP subformula
|
|
||||||
{
|
|
||||||
aliasmap::iterator i = amap.find(*$2);
|
|
||||||
if (i != amap.end())
|
|
||||||
{
|
|
||||||
CHECK_ARITY(@1, $2, 2, formula_tree::arity(i->second));
|
|
||||||
automatop::vec v;
|
|
||||||
v.push_back($1);
|
|
||||||
v.push_back($3);
|
|
||||||
$$ = instanciate(i->second, v);
|
|
||||||
$1->destroy();
|
|
||||||
$3->destroy();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CHECK_EXISTING_NMAP(@1, $2);
|
|
||||||
nfa::ptr np = nmap[*$2];
|
|
||||||
CHECK_ARITY(@1, $2, 2, np->arity());
|
|
||||||
automatop::vec* v = new automatop::vec;
|
|
||||||
v->push_back($1);
|
|
||||||
v->push_back($3);
|
|
||||||
$$ = automatop::instance(np, v, false);
|
|
||||||
}
|
|
||||||
delete $2;
|
|
||||||
}
|
|
||||||
| ATOMIC_PROP "(" arg_list ")"
|
|
||||||
{
|
|
||||||
aliasmap::iterator i = amap.find(*$1);
|
|
||||||
if (i != amap.end())
|
|
||||||
{
|
|
||||||
CHECK_ARITY(@1, $1, $3->size(), formula_tree::arity(i->second));
|
|
||||||
$$ = instanciate(i->second, *$3);
|
|
||||||
automatop::vec::iterator it = $3->begin();
|
|
||||||
while (it != $3->end())
|
|
||||||
(*it++)->destroy();
|
|
||||||
delete $3;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CHECK_EXISTING_NMAP(@1, $1);
|
|
||||||
nfa::ptr np = nmap[*$1];
|
|
||||||
|
|
||||||
/// Easily handle deletion of $3 when CHECK_ARITY fails.
|
|
||||||
unsigned i = $3->size();
|
|
||||||
if ($3->size() != np->arity())
|
|
||||||
{
|
|
||||||
automatop::vec::iterator it = $3->begin();
|
|
||||||
while (it != $3->end())
|
|
||||||
(*it++)->destroy();
|
|
||||||
delete $3;
|
|
||||||
}
|
|
||||||
|
|
||||||
CHECK_ARITY(@1, $1, i, np->arity());
|
|
||||||
$$ = automatop::instance(np, $3, false);
|
|
||||||
}
|
|
||||||
delete $1;
|
|
||||||
}
|
|
||||||
| CONST_TRUE
|
|
||||||
{ $$ = constant::true_instance(); }
|
|
||||||
| CONST_FALSE
|
|
||||||
{ $$ = constant::false_instance(); }
|
|
||||||
| "(" subformula ")"
|
|
||||||
{ $$ = $2; }
|
|
||||||
| subformula OP_AND subformula
|
|
||||||
{ $$ = multop::instance(multop::And, $1, $3); }
|
|
||||||
| subformula OP_OR subformula
|
|
||||||
{ $$ = multop::instance(multop::Or, $1, $3); }
|
|
||||||
| subformula OP_XOR subformula
|
|
||||||
{ $$ = binop::instance(binop::Xor, $1, $3); }
|
|
||||||
| subformula OP_IMPLIES subformula
|
|
||||||
{ $$ = binop::instance(binop::Implies, $1, $3); }
|
|
||||||
| subformula OP_EQUIV subformula
|
|
||||||
{ $$ = binop::instance(binop::Equiv, $1, $3); }
|
|
||||||
| OP_NOT subformula
|
|
||||||
{ $$ = unop::instance(unop::Not, $2); }
|
|
||||||
;
|
|
||||||
|
|
||||||
arg_list: subformula
|
|
||||||
{
|
|
||||||
$$ = new automatop::vec;
|
|
||||||
$$->push_back($1);
|
|
||||||
}
|
|
||||||
| arg_list "," subformula
|
|
||||||
{
|
|
||||||
$1->push_back($3);
|
|
||||||
$$ = $1;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
%%
|
|
||||||
|
|
||||||
void
|
|
||||||
eltlyy::parser::error(const location_type& loc, const std::string& s)
|
|
||||||
{
|
|
||||||
PARSE_ERROR(loc, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace spot
|
|
||||||
{
|
|
||||||
namespace eltl
|
|
||||||
{
|
|
||||||
const formula*
|
|
||||||
parse_file(const std::string& name,
|
|
||||||
parse_error_list& error_list,
|
|
||||||
environment& env,
|
|
||||||
bool debug)
|
|
||||||
{
|
|
||||||
if (flex_open(name))
|
|
||||||
{
|
|
||||||
error_list.push_back
|
|
||||||
(parse_error(spot::location(),
|
|
||||||
spair("-", std::string("Cannot open file ") + name)));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
const formula* result = 0;
|
|
||||||
nfamap nmap;
|
|
||||||
aliasmap amap;
|
|
||||||
parse_error_list_t pe;
|
|
||||||
pe.file_ = name;
|
|
||||||
eltlyy::parser parser(nmap, amap, pe, env, result);
|
|
||||||
parser.set_debug_level(debug);
|
|
||||||
parser.parse();
|
|
||||||
error_list = pe.list_;
|
|
||||||
flex_close();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
const formula*
|
|
||||||
parse_string(const std::string& eltl_string,
|
|
||||||
parse_error_list& error_list,
|
|
||||||
environment& env,
|
|
||||||
bool debug)
|
|
||||||
{
|
|
||||||
flex_set_buffer(eltl_string);
|
|
||||||
const formula* result = 0;
|
|
||||||
nfamap nmap;
|
|
||||||
aliasmap amap;
|
|
||||||
parse_error_list_t pe;
|
|
||||||
eltlyy::parser parser(nmap, amap, pe, env, result);
|
|
||||||
parser.set_debug_level(debug);
|
|
||||||
parser.parse();
|
|
||||||
error_list = pe.list_;
|
|
||||||
flex_unset_buffer();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Local Variables:
|
|
||||||
// mode: c++
|
|
||||||
// End:
|
|
||||||
|
|
@ -1,221 +0,0 @@
|
||||||
/* -*- coding: utf-8 -*-
|
|
||||||
** Copyright (C) 2008, 2014 Laboratoire de Recherche et Développement
|
|
||||||
** de l'Epita (LRDE).
|
|
||||||
**
|
|
||||||
** This file is part of Spot, a model checking library.
|
|
||||||
**
|
|
||||||
** Spot is free software; you can redistribute it and/or modify it
|
|
||||||
** under the terms of the GNU General Public License as published by
|
|
||||||
** the Free Software Foundation; either version 3 of the License, or
|
|
||||||
** (at your option) any later version.
|
|
||||||
**
|
|
||||||
** Spot is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
||||||
** License for more details.
|
|
||||||
**
|
|
||||||
** You should have received a copy of the GNU General Public License
|
|
||||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
%option noyywrap
|
|
||||||
%option prefix="eltlyy"
|
|
||||||
%option outfile="lex.yy.c"
|
|
||||||
%option stack
|
|
||||||
|
|
||||||
%{
|
|
||||||
#include <string>
|
|
||||||
#include <stack>
|
|
||||||
#include "eltlparse/parsedecl.hh"
|
|
||||||
|
|
||||||
static int _atoi (char* yytext, int base);
|
|
||||||
|
|
||||||
#define YY_USER_ACTION \
|
|
||||||
yylloc->columns(yyleng);
|
|
||||||
|
|
||||||
// Flex uses `0' for end of file. 0 is not a token_type.
|
|
||||||
#define yyterminate() return token::END_OF_FILE
|
|
||||||
|
|
||||||
// Stack for handling include files.
|
|
||||||
typedef std::pair<YY_BUFFER_STATE, std::string> state;
|
|
||||||
std::stack<state> include;
|
|
||||||
|
|
||||||
#define ERROR(Msg) \
|
|
||||||
pe.list_.push_back \
|
|
||||||
(spot::eltl::parse_error(*yylloc, spot::eltl::spair(pe.file_, Msg)))
|
|
||||||
|
|
||||||
typedef eltlyy::parser::token token;
|
|
||||||
|
|
||||||
%}
|
|
||||||
|
|
||||||
eol \n|\r|\n\r|\r\n
|
|
||||||
%s formula
|
|
||||||
%x incl
|
|
||||||
|
|
||||||
%%
|
|
||||||
|
|
||||||
%{
|
|
||||||
yylloc->step();
|
|
||||||
%}
|
|
||||||
|
|
||||||
/* Rules for the include part. */
|
|
||||||
|
|
||||||
<incl>[ \t]*
|
|
||||||
<incl>[^ \t\n]+ {
|
|
||||||
FILE* tmp = fopen(yytext, "r");
|
|
||||||
if (!tmp)
|
|
||||||
ERROR(std::string("cannot open file ") + yytext);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
include.push(make_pair(YY_CURRENT_BUFFER, pe.file_));
|
|
||||||
pe.file_ = std::string(yytext);
|
|
||||||
yy_switch_to_buffer(yy_create_buffer(tmp, YY_BUF_SIZE));
|
|
||||||
}
|
|
||||||
BEGIN(INITIAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Global rules (1). */
|
|
||||||
|
|
||||||
"(" return token::LPAREN;
|
|
||||||
"," return token::COMMA;
|
|
||||||
")" return token::RPAREN;
|
|
||||||
"!" return token::OP_NOT;
|
|
||||||
|
|
||||||
/* & and | come from Spin. && and || from LTL2BA.
|
|
||||||
/\, \/, and xor are from LBTT.
|
|
||||||
*/
|
|
||||||
"||"|"|"|"+"|"\\/" {
|
|
||||||
return token::OP_OR;
|
|
||||||
}
|
|
||||||
"&&"|"&"|"."|"*"|"/\\" {
|
|
||||||
return token::OP_AND;
|
|
||||||
}
|
|
||||||
"^"|"xor" return token::OP_XOR;
|
|
||||||
"=>"|"->" return token::OP_IMPLIES;
|
|
||||||
"<=>"|"<->" return token::OP_EQUIV;
|
|
||||||
|
|
||||||
/* Rules for the automaton definitions part. */
|
|
||||||
|
|
||||||
<INITIAL>"include" BEGIN(incl);
|
|
||||||
<INITIAL>"%" BEGIN(formula);
|
|
||||||
|
|
||||||
<INITIAL>"=" return token::EQ;
|
|
||||||
<INITIAL>"accept" return token::ACC;
|
|
||||||
<INITIAL>"finish" return token::FIN;
|
|
||||||
|
|
||||||
<INITIAL>[tT][rR][uU][eE] {
|
|
||||||
return token::CONST_TRUE;
|
|
||||||
}
|
|
||||||
<INITIAL>[fF][aA][lL][sS][eE] {
|
|
||||||
return token::CONST_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
<INITIAL>[a-zA-Z][a-zA-Z0-9_]* {
|
|
||||||
yylval->sval = new std::string(yytext, yyleng);
|
|
||||||
return token::IDENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
<INITIAL>[0-9]+ {
|
|
||||||
// Out of range is checked in the parser.
|
|
||||||
yylval->ival = _atoi(yytext, 10);
|
|
||||||
return token::STATE;
|
|
||||||
}
|
|
||||||
|
|
||||||
<INITIAL>$[0-9]+ {
|
|
||||||
// Out of range is checked in the parser.
|
|
||||||
yylval->ival = _atoi(++yytext, 10);
|
|
||||||
return token::ARG;
|
|
||||||
}
|
|
||||||
|
|
||||||
<INITIAL><<EOF>> {
|
|
||||||
if (include.empty())
|
|
||||||
yyterminate();
|
|
||||||
|
|
||||||
state s = include.top();
|
|
||||||
include.pop();
|
|
||||||
pe.file_ = s.second;
|
|
||||||
yy_delete_buffer(YY_CURRENT_BUFFER);
|
|
||||||
yy_switch_to_buffer(s.first);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Rules for the formula part. */
|
|
||||||
|
|
||||||
<formula>"1"|[tT][rR][uU][eE] {
|
|
||||||
return token::CONST_TRUE;
|
|
||||||
}
|
|
||||||
<formula>"0"|[fF][aA][lL][sS][eE] {
|
|
||||||
return token::CONST_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
<formula>[a-zA-Z][a-zA-Z0-9_]* {
|
|
||||||
yylval->sval = new std::string(yytext, yyleng);
|
|
||||||
return token::ATOMIC_PROP;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Global rules (2). */
|
|
||||||
|
|
||||||
/* discard whitespace */
|
|
||||||
{eol} yylloc->lines(yyleng); yylloc->step();
|
|
||||||
[ \t]+ yylloc->step();
|
|
||||||
|
|
||||||
. return *yytext;
|
|
||||||
|
|
||||||
|
|
||||||
%{
|
|
||||||
/* Dummy use of yyunput to shut up a gcc warning. */
|
|
||||||
(void) &yyunput;
|
|
||||||
%}
|
|
||||||
|
|
||||||
%%
|
|
||||||
|
|
||||||
namespace spot
|
|
||||||
{
|
|
||||||
namespace eltl
|
|
||||||
{
|
|
||||||
int
|
|
||||||
flex_open(const std::string &name)
|
|
||||||
{
|
|
||||||
if (name == "-")
|
|
||||||
yyin = stdin;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
yyin = fopen(name.c_str(), "r");
|
|
||||||
if (!yyin)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
flex_close()
|
|
||||||
{
|
|
||||||
fclose(yyin);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
flex_set_buffer(const std::string& buf)
|
|
||||||
{
|
|
||||||
yypush_buffer_state(YY_CURRENT_BUFFER);
|
|
||||||
(void) yy_scan_bytes(buf.c_str(), buf.size());
|
|
||||||
yy_push_state(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
flex_unset_buffer()
|
|
||||||
{
|
|
||||||
(void)&yy_top_state; // shut up a g++ warning.
|
|
||||||
yy_pop_state();
|
|
||||||
yypop_buffer_state();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_atoi(char* yytext, int base)
|
|
||||||
{
|
|
||||||
errno = 0;
|
|
||||||
long i = strtol(yytext, 0, base);
|
|
||||||
if (i > std::numeric_limits<int>::max() ||
|
|
||||||
i < std::numeric_limits<int>::min() || errno == ERANGE)
|
|
||||||
return -1;
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
// Copyright (C) 2008 Laboratoire de Recherche et Développement
|
|
||||||
// de l'Epita (LRDE).
|
|
||||||
//
|
|
||||||
// This file is part of Spot, a model checking library.
|
|
||||||
//
|
|
||||||
// Spot is free software; you can redistribute it and/or modify it
|
|
||||||
// under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
||||||
// License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#include <ostream>
|
|
||||||
#include "public.hh"
|
|
||||||
|
|
||||||
namespace spot
|
|
||||||
{
|
|
||||||
namespace eltl
|
|
||||||
{
|
|
||||||
bool
|
|
||||||
format_parse_errors(std::ostream& os,
|
|
||||||
parse_error_list& error_list)
|
|
||||||
{
|
|
||||||
bool printed = false;
|
|
||||||
spot::eltl::parse_error_list::iterator it;
|
|
||||||
for (it = error_list.begin(); it != error_list.end(); ++it)
|
|
||||||
{
|
|
||||||
if (it->second.first != "-")
|
|
||||||
{
|
|
||||||
os << it->second.first << ": ";
|
|
||||||
os << it->first << ": ";
|
|
||||||
}
|
|
||||||
os << it->second.second << std::endl;
|
|
||||||
printed = true;
|
|
||||||
}
|
|
||||||
return printed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
// -*- coding: utf-8 -*-
|
|
||||||
// Copyright (C) 2008, 2013, 2014 Laboratoire de Recherche et
|
|
||||||
// Développement de l'Epita (LRDE).
|
|
||||||
//
|
|
||||||
// This file is part of Spot, a model checking library.
|
|
||||||
//
|
|
||||||
// Spot is free software; you can redistribute it and/or modify it
|
|
||||||
// under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
||||||
// License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#ifndef SPOT_ELTLPARSE_PARSEDECL_HH
|
|
||||||
# define SPOT_ELTLPARSE_PARSEDECL_HH
|
|
||||||
|
|
||||||
#include "eltlparse.hh"
|
|
||||||
#include "misc/location.hh"
|
|
||||||
|
|
||||||
# define YY_DECL \
|
|
||||||
int eltlyylex (eltlyy::parser::semantic_type *yylval, \
|
|
||||||
spot::location *yylloc, \
|
|
||||||
spot::eltl::parse_error_list_t &pe)
|
|
||||||
YY_DECL;
|
|
||||||
|
|
||||||
namespace spot
|
|
||||||
{
|
|
||||||
namespace eltl
|
|
||||||
{
|
|
||||||
int flex_open(const std::string& name);
|
|
||||||
void flex_close();
|
|
||||||
void flex_set_buffer(const std::string& buf);
|
|
||||||
void flex_unset_buffer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // SPOT_ELTLPARSE_PARSEDECL_HH
|
|
||||||
|
|
@ -1,96 +0,0 @@
|
||||||
// -*- coding: utf-8 -*-
|
|
||||||
// Copyright (C) 2008, 2010, 2012, 2013 Laboratoire de Recherche et
|
|
||||||
// Développement de l'Epita (LRDE).
|
|
||||||
//
|
|
||||||
// This file is part of Spot, a model checking library.
|
|
||||||
//
|
|
||||||
// Spot is free software; you can redistribute it and/or modify it
|
|
||||||
// under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
||||||
// License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#ifndef SPOT_ELTLPARSE_PUBLIC_HH
|
|
||||||
# define SPOT_ELTLPARSE_PUBLIC_HH
|
|
||||||
|
|
||||||
# include "ltlast/formula.hh"
|
|
||||||
# include "ltlenv/defaultenv.hh"
|
|
||||||
# include "ltlast/nfa.hh"
|
|
||||||
# include "misc/location.hh"
|
|
||||||
# include <string>
|
|
||||||
# include <list>
|
|
||||||
# include <map>
|
|
||||||
# include <utility>
|
|
||||||
# include <iosfwd>
|
|
||||||
|
|
||||||
namespace spot
|
|
||||||
{
|
|
||||||
using namespace ltl;
|
|
||||||
|
|
||||||
namespace eltl
|
|
||||||
{
|
|
||||||
/// \addtogroup ltl_io
|
|
||||||
/// @{
|
|
||||||
|
|
||||||
typedef std::pair<std::string, std::string> spair;
|
|
||||||
/// \brief A parse diagnostic <location, <file, message>>.
|
|
||||||
typedef std::pair<spot::location, spair> parse_error;
|
|
||||||
/// \brief A list of parser diagnostics, as filled by parse.
|
|
||||||
typedef std::list<parse_error> parse_error_list;
|
|
||||||
|
|
||||||
/// \brief Build a formula from a text file.
|
|
||||||
/// \param filename The name of the file to parse.
|
|
||||||
/// \param error_list A list that will be filled with
|
|
||||||
/// parse errors that occured during parsing.
|
|
||||||
/// \param env The environment into which parsing should take place.
|
|
||||||
/// \param debug When true, causes the parser to trace its execution.
|
|
||||||
/// \return A pointer to the tgba built from \a filename, or
|
|
||||||
/// 0 if the file could not be opened.
|
|
||||||
///
|
|
||||||
/// \warning This function is not reentrant.
|
|
||||||
SPOT_API
|
|
||||||
const formula* parse_file(const std::string& filename,
|
|
||||||
parse_error_list& error_list,
|
|
||||||
environment& env =
|
|
||||||
default_environment::instance(),
|
|
||||||
bool debug = false);
|
|
||||||
|
|
||||||
/// \brief Build a formula from an ELTL string.
|
|
||||||
/// \param eltl_string The string to parse.
|
|
||||||
/// \param error_list A list that will be filled with
|
|
||||||
/// parse errors that occured during parsing.
|
|
||||||
/// \param env The environment into which parsing should take place.
|
|
||||||
/// \param debug When true, causes the parser to trace its execution.
|
|
||||||
/// \return A pointer to the formula built from \a eltl_string, or
|
|
||||||
/// 0 if the input was unparsable.
|
|
||||||
///
|
|
||||||
/// \warning This function is not reentrant.
|
|
||||||
SPOT_API
|
|
||||||
const formula* parse_string(const std::string& eltl_string,
|
|
||||||
parse_error_list& error_list,
|
|
||||||
environment& env =
|
|
||||||
default_environment::instance(),
|
|
||||||
bool debug = false);
|
|
||||||
|
|
||||||
/// \brief Format diagnostics produced by spot::eltl::parse.
|
|
||||||
/// \param os Where diagnostics should be output.
|
|
||||||
/// \param error_list The error list filled by spot::eltl::parse while
|
|
||||||
/// parsing \a eltl_string.
|
|
||||||
/// \return \c true iff any diagnostic was output.
|
|
||||||
SPOT_API
|
|
||||||
bool
|
|
||||||
format_parse_errors(std::ostream& os,
|
|
||||||
parse_error_list& error_list);
|
|
||||||
|
|
||||||
/// @}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // SPOT_ELTLPARSE_PUBLIC_HH
|
|
||||||
5
src/eltltest/.gitignore
vendored
5
src/eltltest/.gitignore
vendored
|
|
@ -1,5 +0,0 @@
|
||||||
defs
|
|
||||||
acc
|
|
||||||
nfa
|
|
||||||
input
|
|
||||||
prelude
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
## Copyright (C) 2009, 2011 Laboratoire de Recherche et Développement
|
|
||||||
## de l'Epita (LRDE).
|
|
||||||
##
|
|
||||||
## This file is part of Spot, a model checking library.
|
|
||||||
##
|
|
||||||
## Spot is free software; you can redistribute it and/or modify it
|
|
||||||
## under the terms of the GNU General Public License as published by
|
|
||||||
## the Free Software Foundation; either version 3 of the License, or
|
|
||||||
## (at your option) any later version.
|
|
||||||
##
|
|
||||||
## Spot is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
||||||
## License for more details.
|
|
||||||
##
|
|
||||||
## You should have received a copy of the GNU General Public License
|
|
||||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
AM_CPPFLAGS = -I$(srcdir)/.. -I.. $(BUDDY_CPPFLAGS)
|
|
||||||
AM_CXXFLAGS = $(WARNING_CXXFLAGS)
|
|
||||||
LDADD = ../libspot.la
|
|
||||||
|
|
||||||
check_SCRIPTS = defs
|
|
||||||
# Keep this sorted alphabetically.
|
|
||||||
check_PROGRAMS = \
|
|
||||||
acc \
|
|
||||||
nfa
|
|
||||||
|
|
||||||
acc_SOURCES = acc.cc
|
|
||||||
nfa_SOURCES = nfa.cc
|
|
||||||
|
|
||||||
EXTRA_DIST = $(TESTS)
|
|
||||||
|
|
||||||
# Ordered by strength of the test. Test basic features first.
|
|
||||||
TESTS = \
|
|
||||||
acc.test \
|
|
||||||
nfa.test
|
|
||||||
|
|
||||||
distclean-local:
|
|
||||||
rm -rf $(TESTS:.test=.dir)
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
// Copyright (C) 2008, 2009 Laboratoire de Recherche et Developpement
|
|
||||||
// de l'Epita (LRDE)
|
|
||||||
//
|
|
||||||
// This file is part of Spot, a model checking library.
|
|
||||||
//
|
|
||||||
// Spot is free software; you can redistribute it and/or modify it
|
|
||||||
// under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
||||||
// License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <cassert>
|
|
||||||
#include "eltlparse/public.hh"
|
|
||||||
#include "ltlvisit/lunabbrev.hh"
|
|
||||||
#include "ltlvisit/nenoform.hh"
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char** argv)
|
|
||||||
{
|
|
||||||
spot::eltl::parse_error_list p;
|
|
||||||
const spot::ltl::formula* f = spot::eltl::parse_file(
|
|
||||||
argv[1], p, spot::ltl::default_environment::instance(), argc > 2);
|
|
||||||
|
|
||||||
if (spot::eltl::format_parse_errors(std::cerr, p))
|
|
||||||
{
|
|
||||||
if (f != 0)
|
|
||||||
{
|
|
||||||
std::cout << f->dump() << std::endl;
|
|
||||||
f->destroy();
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
const spot::ltl::formula* f1 = spot::ltl::unabbreviate_logic(f);
|
|
||||||
const spot::ltl::formula* f2 = spot::ltl::negative_normal_form(f1);
|
|
||||||
f1->destroy();
|
|
||||||
|
|
||||||
assert(f != 0);
|
|
||||||
std::cout << f->dump() << std::endl;
|
|
||||||
f->destroy();
|
|
||||||
|
|
||||||
assert(f2 != 0);
|
|
||||||
std::cout << f2->dump() << std::endl;
|
|
||||||
f2->destroy();
|
|
||||||
}
|
|
||||||
|
|
@ -1,91 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright (C) 2009, 2013 Laboratoire de Recherche et Développement
|
|
||||||
# de l'Epita (LRDE).
|
|
||||||
#
|
|
||||||
# This file is part of Spot, a model checking library.
|
|
||||||
#
|
|
||||||
# Spot is free software; you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Spot is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
||||||
# License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
. ./defs || exit 1
|
|
||||||
|
|
||||||
set -e
|
|
||||||
cat >prelude <<'EOF'
|
|
||||||
X=(
|
|
||||||
0 1 $0
|
|
||||||
accept 1
|
|
||||||
)
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cat >input <<'EOF'
|
|
||||||
include prelude
|
|
||||||
A=(
|
|
||||||
0 1 $2
|
|
||||||
1 2 $0
|
|
||||||
accept 0
|
|
||||||
)
|
|
||||||
%
|
|
||||||
A(1,a,a|b)&X(!f)
|
|
||||||
EOF
|
|
||||||
run 0 ../acc input || exit 1
|
|
||||||
|
|
||||||
cat >input <<'EOF'
|
|
||||||
include prelude
|
|
||||||
A=(
|
|
||||||
0 1 $2
|
|
||||||
1 2 $0
|
|
||||||
accept 0
|
|
||||||
)
|
|
||||||
%
|
|
||||||
A(1,a)
|
|
||||||
EOF
|
|
||||||
run 1 ../acc input || exit 1
|
|
||||||
|
|
||||||
cat >input <<'EOF'
|
|
||||||
X=(
|
|
||||||
0 1 true
|
|
||||||
1 2 $0
|
|
||||||
accept 2
|
|
||||||
)
|
|
||||||
U=(
|
|
||||||
0 0 $0
|
|
||||||
0 1 $1
|
|
||||||
accept 1
|
|
||||||
)
|
|
||||||
F=U(true, $0)
|
|
||||||
R=!U(!$0, !$1)
|
|
||||||
%
|
|
||||||
a U b | a R b | F(true) | U(a,b) -> R(a,b)
|
|
||||||
EOF
|
|
||||||
run 0 ../acc input || exit 1
|
|
||||||
|
|
||||||
cat >input <<'EOF'
|
|
||||||
U=(
|
|
||||||
0 0 $0
|
|
||||||
0 1 $1
|
|
||||||
accept 1
|
|
||||||
)
|
|
||||||
T=U(true,true)
|
|
||||||
%
|
|
||||||
T()|1
|
|
||||||
EOF
|
|
||||||
run 1 ../acc input || exit 1
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
A=(
|
|
||||||
)
|
|
||||||
%
|
|
||||||
1
|
|
||||||
EOF
|
|
||||||
run 0 ../acc input || exit 1
|
|
||||||
|
|
@ -1,75 +0,0 @@
|
||||||
# -*- shell-script -*-
|
|
||||||
# Copyright (C) 2009 Laboratoire de Recherche et Développement
|
|
||||||
# de l'Epita (LRDE).
|
|
||||||
# Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de Paris 6 (LIP6),
|
|
||||||
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
|
||||||
# et Marie Curie.
|
|
||||||
#
|
|
||||||
# This file is part of Spot, a model checking library.
|
|
||||||
#
|
|
||||||
# Spot is free software; you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Spot is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
||||||
# License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# Ensure we are running from the right directory.
|
|
||||||
test -f ./defs || {
|
|
||||||
echo "defs: not found in current directory" 1>&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# If srcdir is not set, then we are not running from `make check'.
|
|
||||||
if test -z "$srcdir"; then
|
|
||||||
# compute $srcdir.
|
|
||||||
srcdir=`echo "$0" | sed -e 's,/[^\\/]*$,,'`
|
|
||||||
test $srcdir = $0 && srcdir=.
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Ensure $srcdir is set correctly.
|
|
||||||
test -f $srcdir/defs.in || {
|
|
||||||
echo "$srcdir/defs.in not found, check \$srcdir" 1>&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "== Running test $0"
|
|
||||||
|
|
||||||
me=`echo "$0" | sed -e 's,.*[\\/],,;s/\.test$//'`
|
|
||||||
|
|
||||||
testSubDir=$me.dir
|
|
||||||
chmod -R a+rwx $testSubDir > /dev/null 2>&1
|
|
||||||
rm -rf $testSubDir > /dev/null 2>&1
|
|
||||||
mkdir $testSubDir
|
|
||||||
cd $testSubDir
|
|
||||||
|
|
||||||
DOT='@DOT@'
|
|
||||||
VALGRIND='@VALGRIND@'
|
|
||||||
|
|
||||||
run()
|
|
||||||
{
|
|
||||||
expected_exitcode=$1
|
|
||||||
shift
|
|
||||||
exitcode=0
|
|
||||||
if test -n "$VALGRIND"; then
|
|
||||||
exec 6>valgrind.err
|
|
||||||
GLIBCPP_FORCE_NEW=1 \
|
|
||||||
../../../libtool --mode=execute \
|
|
||||||
$VALGRIND --tool=memcheck --leak-check=yes --log-fd=6 -q "$@" ||
|
|
||||||
exitcode=$?
|
|
||||||
cat valgrind.err 1>&2
|
|
||||||
test -z "`sed 1q valgrind.err`" || exit 50
|
|
||||||
rm -f valgrind.err
|
|
||||||
else
|
|
||||||
"$@" || exitcode=$?
|
|
||||||
fi
|
|
||||||
test $exitcode = $expected_exitcode || exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
set -x
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
// Copyright (C) 2008 Laboratoire de Recherche et Développement
|
|
||||||
// de l'Epita (LRDE).
|
|
||||||
//
|
|
||||||
// This file is part of Spot, a model checking library.
|
|
||||||
//
|
|
||||||
// Spot is free software; you can redistribute it and/or modify it
|
|
||||||
// under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
||||||
// License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <set>
|
|
||||||
#include <iostream>
|
|
||||||
#include "ltlast/formula_tree.hh"
|
|
||||||
#include "ltlast/nfa.hh"
|
|
||||||
|
|
||||||
using namespace spot::ltl;
|
|
||||||
|
|
||||||
typedef std::set<const nfa::state*> mset;
|
|
||||||
|
|
||||||
void
|
|
||||||
dfs(nfa& a, const nfa::state* s, mset& m)
|
|
||||||
{
|
|
||||||
if (m.find(s) != m.end())
|
|
||||||
return;
|
|
||||||
m.insert(s);
|
|
||||||
|
|
||||||
for (nfa::iterator i = a.begin(s); i != a.end(s); ++i)
|
|
||||||
{
|
|
||||||
std::cout << (*i)->lbl << std::endl;
|
|
||||||
dfs(a, (*i)->dst, m);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
nfa a;
|
|
||||||
|
|
||||||
formula_tree::node_atomic* n1 = new formula_tree::node_atomic;
|
|
||||||
formula_tree::node_atomic* n2 = new formula_tree::node_atomic;
|
|
||||||
n1->i = 1;
|
|
||||||
n2->i = 2;
|
|
||||||
|
|
||||||
a.add_transition(0, 1, formula_tree::node_ptr(n1));
|
|
||||||
a.add_transition(1, 2, formula_tree::node_ptr(n2));
|
|
||||||
|
|
||||||
std::cout << "init: " << a.format_state(a.get_init_state()) << std::endl;
|
|
||||||
|
|
||||||
mset m;
|
|
||||||
dfs(a, a.get_init_state(), m);
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# Copyright (C) 2009 Laboratoire de Recherche et Développement
|
|
||||||
# de l'Epita (LRDE).
|
|
||||||
#
|
|
||||||
# This file is part of Spot, a model checking library.
|
|
||||||
#
|
|
||||||
# Spot is free software; you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Spot is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
||||||
# License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
. ./defs || exit 1
|
|
||||||
|
|
||||||
set -e
|
|
||||||
run 0 ../nfa || exit 1
|
|
||||||
|
|
@ -40,7 +40,6 @@ tgbaalgos_HEADERS = \
|
||||||
dtbasat.hh \
|
dtbasat.hh \
|
||||||
dtgbasat.hh \
|
dtgbasat.hh \
|
||||||
dupexp.hh \
|
dupexp.hh \
|
||||||
eltl2tgba_lacim.hh \
|
|
||||||
emptiness.hh \
|
emptiness.hh \
|
||||||
emptiness_stats.hh \
|
emptiness_stats.hh \
|
||||||
gv04.hh \
|
gv04.hh \
|
||||||
|
|
@ -90,7 +89,6 @@ libtgbaalgos_la_SOURCES = \
|
||||||
dtbasat.cc \
|
dtbasat.cc \
|
||||||
dtgbasat.cc \
|
dtgbasat.cc \
|
||||||
dupexp.cc \
|
dupexp.cc \
|
||||||
eltl2tgba_lacim.cc \
|
|
||||||
emptiness.cc \
|
emptiness.cc \
|
||||||
gv04.cc \
|
gv04.cc \
|
||||||
isdet.cc \
|
isdet.cc \
|
||||||
|
|
|
||||||
|
|
@ -1,320 +0,0 @@
|
||||||
// -*- coding: utf-8 -*-
|
|
||||||
// Copyright (C) 2008, 2009, 2010, 2012, 2013, 2014 Laboratoire de
|
|
||||||
// Recherche et Développement de l'Epita (LRDE).
|
|
||||||
//
|
|
||||||
// This file is part of Spot, a model checking library.
|
|
||||||
//
|
|
||||||
// Spot is free software; you can redistribute it and/or modify it
|
|
||||||
// under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
||||||
// License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#include "ltlast/visitor.hh"
|
|
||||||
#include "ltlast/allnodes.hh"
|
|
||||||
#include "ltlast/formula_tree.hh"
|
|
||||||
#include "ltlvisit/lunabbrev.hh"
|
|
||||||
#include "ltlvisit/nenoform.hh"
|
|
||||||
#include "tgba/tgbabddconcretefactory.hh"
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#include "eltl2tgba_lacim.hh"
|
|
||||||
|
|
||||||
namespace spot
|
|
||||||
{
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
using namespace ltl;
|
|
||||||
|
|
||||||
/// \brief Recursively translate a formula into a BDD.
|
|
||||||
class eltl_trad_visitor : public visitor
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
eltl_trad_visitor(tgba_bdd_concrete_factory& fact, bool root = false)
|
|
||||||
: fact_(fact), root_(root), finish_()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual
|
|
||||||
~eltl_trad_visitor()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bdd
|
|
||||||
result()
|
|
||||||
{
|
|
||||||
return res_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
visit(const atomic_prop* node)
|
|
||||||
{
|
|
||||||
res_ = bdd_ithvar(fact_.create_atomic_prop(node));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
visit(const constant* node)
|
|
||||||
{
|
|
||||||
switch (node->val())
|
|
||||||
{
|
|
||||||
case constant::True:
|
|
||||||
res_ = bddtrue;
|
|
||||||
return;
|
|
||||||
case constant::False:
|
|
||||||
res_ = bddfalse;
|
|
||||||
return;
|
|
||||||
case constant::EmptyWord:
|
|
||||||
SPOT_UNIMPLEMENTED();
|
|
||||||
}
|
|
||||||
SPOT_UNREACHABLE();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
visit(const unop* node)
|
|
||||||
{
|
|
||||||
switch (node->op())
|
|
||||||
{
|
|
||||||
case unop::Not:
|
|
||||||
{
|
|
||||||
res_ = bdd_not(recurse(node->child()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
case unop::Finish:
|
|
||||||
{
|
|
||||||
// Ensure finish_[node->child()] has been computed if
|
|
||||||
// node->child() is an automaton operator.
|
|
||||||
res_ = recurse(node->child());
|
|
||||||
finish_map_::const_iterator it = finish_.find(node->child());
|
|
||||||
if (it != finish_.end())
|
|
||||||
res_ = finish_[node->child()];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
case unop::X:
|
|
||||||
case unop::F:
|
|
||||||
case unop::G:
|
|
||||||
case unop::Closure:
|
|
||||||
case unop::NegClosure:
|
|
||||||
case unop::NegClosureMarked:
|
|
||||||
SPOT_UNIMPLEMENTED();
|
|
||||||
}
|
|
||||||
SPOT_UNREACHABLE();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
visit(const bunop*)
|
|
||||||
{
|
|
||||||
SPOT_UNIMPLEMENTED();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
visit(const binop* node)
|
|
||||||
{
|
|
||||||
bdd f1 = recurse(node->first());
|
|
||||||
bdd f2 = recurse(node->second());
|
|
||||||
|
|
||||||
switch (node->op())
|
|
||||||
{
|
|
||||||
case binop::Xor:
|
|
||||||
res_ = bdd_apply(f1, f2, bddop_xor);
|
|
||||||
return;
|
|
||||||
case binop::Implies:
|
|
||||||
res_ = bdd_apply(f1, f2, bddop_imp);
|
|
||||||
return;
|
|
||||||
case binop::Equiv:
|
|
||||||
res_ = bdd_apply(f1, f2, bddop_biimp);
|
|
||||||
return;
|
|
||||||
case binop::U:
|
|
||||||
case binop::R:
|
|
||||||
case binop::W:
|
|
||||||
case binop::M:
|
|
||||||
case binop::UConcat:
|
|
||||||
case binop::EConcat:
|
|
||||||
case binop::EConcatMarked:
|
|
||||||
SPOT_UNIMPLEMENTED();
|
|
||||||
}
|
|
||||||
SPOT_UNREACHABLE();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
visit(const multop* node)
|
|
||||||
{
|
|
||||||
int op = -1;
|
|
||||||
bool root = false;
|
|
||||||
switch (node->op())
|
|
||||||
{
|
|
||||||
case multop::And:
|
|
||||||
op = bddop_and;
|
|
||||||
res_ = bddtrue;
|
|
||||||
// When the root formula is a conjunction it's ok to
|
|
||||||
// consider all children as root formulae. This allows the
|
|
||||||
// root-G trick to save many more variable. (See the
|
|
||||||
// translation of G.)
|
|
||||||
root = root_;
|
|
||||||
break;
|
|
||||||
case multop::Or:
|
|
||||||
op = bddop_or;
|
|
||||||
res_ = bddfalse;
|
|
||||||
break;
|
|
||||||
case multop::Concat:
|
|
||||||
case multop::Fusion:
|
|
||||||
case multop::AndNLM:
|
|
||||||
case multop::AndRat:
|
|
||||||
case multop::OrRat:
|
|
||||||
SPOT_UNIMPLEMENTED();
|
|
||||||
}
|
|
||||||
assert(op != -1);
|
|
||||||
unsigned s = node->size();
|
|
||||||
for (unsigned n = 0; n < s; ++n)
|
|
||||||
res_ = bdd_apply(res_, recurse(node->nth(n), root), op);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
visit(const automatop* node)
|
|
||||||
{
|
|
||||||
nmap m;
|
|
||||||
bdd finish = bddfalse;
|
|
||||||
bdd acc = bddtrue;
|
|
||||||
|
|
||||||
std::vector<const formula*> v;
|
|
||||||
for (unsigned i = 0; i < node->size(); ++i)
|
|
||||||
v.push_back(node->nth(i));
|
|
||||||
|
|
||||||
std::pair<int, int> vp =
|
|
||||||
recurse_state(node->get_nfa(),
|
|
||||||
node->get_nfa()->get_init_state(), v, m, acc, finish);
|
|
||||||
|
|
||||||
// Update finish_ with finish(node).
|
|
||||||
// FIXME: when node is loop, it does not make sense; hence the bddtrue.
|
|
||||||
if (!node->get_nfa()->is_loop())
|
|
||||||
finish_[node] = bddtrue;
|
|
||||||
else
|
|
||||||
finish_[node] = finish;
|
|
||||||
|
|
||||||
bdd tmp = bddtrue;
|
|
||||||
for (nmap::iterator it = m.begin(); it != m.end(); ++it)
|
|
||||||
tmp &= bdd_apply(bdd_ithvar(it->second.first + 1),
|
|
||||||
bdd_ithvar(it->second.second + 1), bddop_biimp);
|
|
||||||
fact_.constrain_relation(bdd_apply(acc, tmp, bddop_imp));
|
|
||||||
|
|
||||||
fact_.declare_acceptance_condition(acc, node);
|
|
||||||
res_ = node->is_negated() ?
|
|
||||||
bdd_nithvar(vp.first) : bdd_ithvar(vp.first);
|
|
||||||
}
|
|
||||||
|
|
||||||
bdd
|
|
||||||
recurse(const formula* f, bool root = false)
|
|
||||||
{
|
|
||||||
eltl_trad_visitor v(fact_, root);
|
|
||||||
f->accept(v);
|
|
||||||
return v.result();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
bdd res_;
|
|
||||||
tgba_bdd_concrete_factory& fact_;
|
|
||||||
bool root_;
|
|
||||||
|
|
||||||
/// BDD associated to each automatop A representing finish(A).
|
|
||||||
typedef std::unordered_map<const ltl::formula*, bdd,
|
|
||||||
ltl::formula_ptr_hash> finish_map_;
|
|
||||||
|
|
||||||
finish_map_ finish_;
|
|
||||||
|
|
||||||
// Table containing the two now variables associated with each state.
|
|
||||||
// TODO: a little documentation about that.
|
|
||||||
typedef std::unordered_map<const nfa::state*,
|
|
||||||
std::pair<int, int>,
|
|
||||||
ptr_hash<nfa::state>> nmap;
|
|
||||||
|
|
||||||
std::pair<int, int>&
|
|
||||||
recurse_state(const nfa::ptr& nfa, const nfa::state* s,
|
|
||||||
const std::vector<const formula*>& v,
|
|
||||||
nmap& m, bdd& acc, bdd& finish)
|
|
||||||
{
|
|
||||||
bool is_loop = nfa->is_loop();
|
|
||||||
nmap::iterator it;
|
|
||||||
it = m.find(s);
|
|
||||||
|
|
||||||
int v1 = 0;
|
|
||||||
int v2 = 0;
|
|
||||||
if (it != m.end())
|
|
||||||
return it->second;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
v1 = fact_.create_anonymous_state();
|
|
||||||
v2 = fact_.create_anonymous_state();
|
|
||||||
m[s] = std::make_pair(v1, v2);
|
|
||||||
}
|
|
||||||
|
|
||||||
bdd tmp1 = bddfalse;
|
|
||||||
bdd tmp2 = bddfalse;
|
|
||||||
bdd tmpacc = bddfalse;
|
|
||||||
for (nfa::iterator i = nfa->begin(s); i != nfa->end(s); ++i)
|
|
||||||
{
|
|
||||||
const formula* lbl = formula_tree::instanciate((*i)->lbl, v);
|
|
||||||
bdd f = recurse(lbl);
|
|
||||||
lbl->destroy();
|
|
||||||
if (nfa->is_final((*i)->dst))
|
|
||||||
{
|
|
||||||
tmp1 |= f;
|
|
||||||
tmp2 |= f;
|
|
||||||
tmpacc |= f;
|
|
||||||
finish |= bdd_ithvar(v1) & f;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::pair<int, int> vp =
|
|
||||||
recurse_state(nfa, (*i)->dst, v, m, acc, finish);
|
|
||||||
tmp1 |= (f & bdd_ithvar(vp.first + 1));
|
|
||||||
tmp2 |= (f & bdd_ithvar(vp.second + 1));
|
|
||||||
if (is_loop)
|
|
||||||
tmpacc |= f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fact_.constrain_relation(bdd_apply(bdd_ithvar(v1), tmp1, bddop_biimp));
|
|
||||||
if (is_loop)
|
|
||||||
{
|
|
||||||
acc &= bdd_ithvar(v2) | !tmpacc;
|
|
||||||
fact_.constrain_relation(
|
|
||||||
bdd_apply(bdd_ithvar(v2), tmp2, bddop_invimp));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
acc &= bdd_nithvar(v2) | tmpacc;
|
|
||||||
fact_.constrain_relation(bdd_apply(bdd_ithvar(v2), tmp2, bddop_imp));
|
|
||||||
}
|
|
||||||
|
|
||||||
return m[s];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
} // anonymous
|
|
||||||
|
|
||||||
tgba_bdd_concrete*
|
|
||||||
eltl_to_tgba_lacim(const ltl::formula* f, bdd_dict* dict)
|
|
||||||
{
|
|
||||||
// Normalize the formula. We want all the negations on
|
|
||||||
// the atomic propositions. We also suppress logic
|
|
||||||
// abbreviations such as <=>, =>, or XOR, since they
|
|
||||||
// would involve negations at the BDD level.
|
|
||||||
const ltl::formula* f1 = ltl::unabbreviate_logic(f);
|
|
||||||
const ltl::formula* f2 = ltl::negative_normal_form(f1);
|
|
||||||
f1->destroy();
|
|
||||||
|
|
||||||
// Traverse the formula and draft the automaton in a factory.
|
|
||||||
tgba_bdd_concrete_factory fact(dict);
|
|
||||||
eltl_trad_visitor v(fact, true);
|
|
||||||
f2->accept(v);
|
|
||||||
f2->destroy();
|
|
||||||
fact.finish();
|
|
||||||
|
|
||||||
// Finally setup the resulting automaton.
|
|
||||||
return new tgba_bdd_concrete(fact, v.result());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
// -*- coding: utf-8 -*-
|
|
||||||
// Copyright (C) 2008, 2010, 2013 Laboratoire de Recherche et
|
|
||||||
// Développement de l'Epita (LRDE).
|
|
||||||
//
|
|
||||||
// This file is part of Spot, a model checking library.
|
|
||||||
//
|
|
||||||
// Spot is free software; you can redistribute it and/or modify it
|
|
||||||
// under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
||||||
// License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#ifndef SPOT_TGBAALGOS_ELTL2TGBA_LACIM_HH
|
|
||||||
# define SPOT_TGBAALGOS_ELTL2TGBA_LACIM_HH
|
|
||||||
|
|
||||||
#include "ltlast/formula.hh"
|
|
||||||
#include "tgba/tgbabddconcrete.hh"
|
|
||||||
|
|
||||||
namespace spot
|
|
||||||
{
|
|
||||||
/// \ingroup tgba_ltl
|
|
||||||
/// \brief Build a spot::tgba_bdd_concrete from an ELTL formula.
|
|
||||||
///
|
|
||||||
/// This is based on the following paper.
|
|
||||||
/** \verbatim
|
|
||||||
@InProceedings{ couvreur.00.lacim,
|
|
||||||
author = {Jean-Michel Couvreur},
|
|
||||||
title = {Un point de vue symbolique sur la logique temporelle
|
|
||||||
lin{\'e}aire},
|
|
||||||
booktitle = {Actes du Colloque LaCIM 2000},
|
|
||||||
month = {August},
|
|
||||||
year = {2000},
|
|
||||||
pages = {131--140},
|
|
||||||
volume = {27},
|
|
||||||
series = {Publications du LaCIM},
|
|
||||||
publisher = {Universit{\'e} du Qu{\'e}bec {\`a} Montr{\'e}al},
|
|
||||||
editor = {Pierre Leroux}
|
|
||||||
}
|
|
||||||
\endverbatim */
|
|
||||||
/// \param f The formula to translate into an automaton.
|
|
||||||
/// \param dict The spot::bdd_dict the constructed automata should use.
|
|
||||||
/// \return A spot::tgba_bdd_concrete that recognizes the language of \a f.
|
|
||||||
SPOT_API tgba_bdd_concrete*
|
|
||||||
eltl_to_tgba_lacim(const ltl::formula* f, bdd_dict* dict);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // SPOT_TGBAALGOS_LTL2TGBA_LACIM_HH
|
|
||||||
|
|
@ -79,7 +79,6 @@ tripprod_SOURCES = tripprod.cc
|
||||||
TESTS = \
|
TESTS = \
|
||||||
intvcomp.test \
|
intvcomp.test \
|
||||||
bitvect.test \
|
bitvect.test \
|
||||||
eltl2tgba.test \
|
|
||||||
explicit.test \
|
explicit.test \
|
||||||
explicit2.test \
|
explicit2.test \
|
||||||
ltlcross3.test \
|
ltlcross3.test \
|
||||||
|
|
|
||||||
|
|
@ -1,204 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright (C) 2009, 2010, 2013 Laboratoire de Recherche et
|
|
||||||
# Développement de l'Epita (LRDE).
|
|
||||||
#
|
|
||||||
# This file is part of Spot, a model checking library.
|
|
||||||
#
|
|
||||||
# Spot is free software; you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Spot is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
||||||
# License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
. ./defs || exit -1
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Check if the TGBA was corretly constructed.
|
|
||||||
check_construct()
|
|
||||||
{
|
|
||||||
run 0 ../ltl2tgba -F -le -b "$1" > output
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check if the TGBA behaves correctly by doing an emptiness check on
|
|
||||||
# the product between the constructed TGBA and a given formula
|
|
||||||
# translated using FM.
|
|
||||||
check_true()
|
|
||||||
{
|
|
||||||
run 0 ../ltl2tgba -CR -e -Poutput -f "$1"
|
|
||||||
}
|
|
||||||
check_false()
|
|
||||||
{
|
|
||||||
run 1 ../ltl2tgba -CR -e -Poutput -f "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
for f in 'GFa' 'FGb' 'GFa->GFb'; do
|
|
||||||
run 0 ../ltl2tgba -lo -b "$f" > output
|
|
||||||
check_false "!($f)"
|
|
||||||
done
|
|
||||||
|
|
||||||
# Create the prelude file.
|
|
||||||
cat >input1 <<'EOF'
|
|
||||||
X=(
|
|
||||||
0 1 true
|
|
||||||
1 2 $0
|
|
||||||
accept 2
|
|
||||||
)
|
|
||||||
U=(
|
|
||||||
0 0 $0
|
|
||||||
0 1 $1
|
|
||||||
accept 1
|
|
||||||
)
|
|
||||||
G=(
|
|
||||||
0 0 $0
|
|
||||||
)
|
|
||||||
F=U(true, $0)
|
|
||||||
Strong=G(F($0))->G(F($1))
|
|
||||||
R=!U(!$0, !$1)
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
A=(
|
|
||||||
)
|
|
||||||
%
|
|
||||||
!0|1
|
|
||||||
EOF
|
|
||||||
|
|
||||||
check_construct input
|
|
||||||
check_true 'Ga'
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
include input1
|
|
||||||
%
|
|
||||||
a U b
|
|
||||||
EOF
|
|
||||||
|
|
||||||
check_construct input
|
|
||||||
check_true 'a U b'
|
|
||||||
check_false '!(a U b)'
|
|
||||||
check_false 'G(a&!b)'
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
include input1
|
|
||||||
%
|
|
||||||
!(a U b)
|
|
||||||
EOF
|
|
||||||
|
|
||||||
check_construct input
|
|
||||||
check_true '!(a U b)'
|
|
||||||
check_true 'G(a&!b)'
|
|
||||||
check_false 'a U b'
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
include input1
|
|
||||||
%
|
|
||||||
X(a)
|
|
||||||
EOF
|
|
||||||
|
|
||||||
check_construct input
|
|
||||||
check_true 'Xa'
|
|
||||||
check_true 'G(a)'
|
|
||||||
check_false '!Xa'
|
|
||||||
check_false 'G(!a)'
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
include input1
|
|
||||||
%
|
|
||||||
X(X(a))
|
|
||||||
EOF
|
|
||||||
|
|
||||||
check_construct input
|
|
||||||
check_true 'XXa'
|
|
||||||
check_false '!XXa'
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
include input1
|
|
||||||
%
|
|
||||||
G(a|b&!c)
|
|
||||||
EOF
|
|
||||||
|
|
||||||
check_construct input
|
|
||||||
check_true 'G (a|b&!c)'
|
|
||||||
check_false '!G (a|b&!c)'
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
include input1
|
|
||||||
%
|
|
||||||
F(a)
|
|
||||||
EOF
|
|
||||||
|
|
||||||
check_construct input
|
|
||||||
check_true 'Fa'
|
|
||||||
check_false '!Fa'
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
include input1
|
|
||||||
%
|
|
||||||
Strong(a,b)
|
|
||||||
EOF
|
|
||||||
|
|
||||||
check_construct input
|
|
||||||
check_true 'G(F(a))->G(F(b))'
|
|
||||||
check_false '!(G(F(a))->G(F(b)))'
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
include input1
|
|
||||||
%
|
|
||||||
a R b
|
|
||||||
EOF
|
|
||||||
|
|
||||||
check_construct input
|
|
||||||
check_true 'a R b'
|
|
||||||
check_false '!(a R b)'
|
|
||||||
|
|
||||||
cat >input <<'EOF'
|
|
||||||
T=(
|
|
||||||
0 1 true
|
|
||||||
1 0 $0
|
|
||||||
)
|
|
||||||
%
|
|
||||||
T(f)
|
|
||||||
EOF
|
|
||||||
|
|
||||||
check_construct input
|
|
||||||
|
|
||||||
cat >input <<'EOF'
|
|
||||||
include input1
|
|
||||||
Fusion=
|
|
||||||
(
|
|
||||||
0 1 $0 & !finish($0)
|
|
||||||
1 1 !finish($0)
|
|
||||||
1 2 $1 & finish($0)
|
|
||||||
0 2 $0 & $1 & finish($0)
|
|
||||||
accept 2
|
|
||||||
)
|
|
||||||
%
|
|
||||||
Fusion(F(a),b)
|
|
||||||
EOF
|
|
||||||
|
|
||||||
check_construct input
|
|
||||||
|
|
||||||
cat >input <<'EOF'
|
|
||||||
Concat=
|
|
||||||
(
|
|
||||||
0 1 $0 & !finish($0)
|
|
||||||
1 1 !finish($0)
|
|
||||||
1 2 finish($0)
|
|
||||||
0 2 $0 & finish($0)
|
|
||||||
2 3 $1
|
|
||||||
accept 3
|
|
||||||
)
|
|
||||||
%
|
|
||||||
Concat(a,b)
|
|
||||||
EOF
|
|
||||||
|
|
||||||
check_construct input
|
|
||||||
check_true 'a&X(b)'
|
|
||||||
check_false '!(a&X(b))'
|
|
||||||
|
|
@ -54,9 +54,7 @@
|
||||||
#include "tgbaalgos/rundotdec.hh"
|
#include "tgbaalgos/rundotdec.hh"
|
||||||
#include "tgbaalgos/sccfilter.hh"
|
#include "tgbaalgos/sccfilter.hh"
|
||||||
#include "tgbaalgos/safety.hh"
|
#include "tgbaalgos/safety.hh"
|
||||||
#include "tgbaalgos/eltl2tgba_lacim.hh"
|
|
||||||
#include "tgbaalgos/gtec/gtec.hh"
|
#include "tgbaalgos/gtec/gtec.hh"
|
||||||
#include "eltlparse/public.hh"
|
|
||||||
#include "misc/timer.hh"
|
#include "misc/timer.hh"
|
||||||
#include "tgbaalgos/stats.hh"
|
#include "tgbaalgos/stats.hh"
|
||||||
#include "tgbaalgos/scc.hh"
|
#include "tgbaalgos/scc.hh"
|
||||||
|
|
@ -105,9 +103,9 @@ syntax(char* prog)
|
||||||
if (slash && (strncmp(slash + 1, "lt-", 3) == 0))
|
if (slash && (strncmp(slash + 1, "lt-", 3) == 0))
|
||||||
prog = slash + 4;
|
prog = slash + 4;
|
||||||
|
|
||||||
std::cerr << "Usage: "<< prog << " [-f|-l|-le|-taa] [OPTIONS...] formula"
|
std::cerr << "Usage: "<< prog << " [-f|-l|-taa] [OPTIONS...] formula"
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< " "<< prog << " [-f|-l|-le|-taa] -F [OPTIONS...] file"
|
<< " "<< prog << " [-f|-l|-taa] -F [OPTIONS...] file"
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< " "<< prog << " -X [OPTIONS...] file" << std::endl
|
<< " "<< prog << " -X [OPTIONS...] file" << std::endl
|
||||||
<< std::endl
|
<< std::endl
|
||||||
|
|
@ -146,8 +144,6 @@ syntax(char* prog)
|
||||||
<< " (default)" << std::endl
|
<< " (default)" << std::endl
|
||||||
<< " -l use Couvreur's LaCIM algorithm for LTL "
|
<< " -l use Couvreur's LaCIM algorithm for LTL "
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< " -le use Couvreur's LaCIM algorithm for ELTL"
|
|
||||||
<< std::endl
|
|
||||||
<< " -taa use Tauriainen's TAA-based algorithm for LTL"
|
<< " -taa use Tauriainen's TAA-based algorithm for LTL"
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< " -u use Compositional translation"
|
<< " -u use Compositional translation"
|
||||||
|
|
@ -169,14 +165,12 @@ syntax(char* prog)
|
||||||
<< "(implies -f)" << std::endl
|
<< "(implies -f)" << std::endl
|
||||||
<< std::endl
|
<< std::endl
|
||||||
|
|
||||||
<< "Options for Couvreur's LaCIM algorithm (-l or -le):"
|
<< "Options for Couvreur's LaCIM algorithm (-l):"
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< " -a display the acceptance_conditions BDD, not the "
|
<< " -a display the acceptance_conditions BDD, not the "
|
||||||
<< "reachability graph"
|
<< "reachability graph"
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< " -A same as -a, but as a set" << std::endl
|
<< " -A same as -a, but as a set" << std::endl
|
||||||
<< " -lo pre-define standard LTL operators as automata "
|
|
||||||
<< "(implies -le)" << std::endl
|
|
||||||
<< " -r display the relation BDD, not the reachability graph"
|
<< " -r display the relation BDD, not the reachability graph"
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< " -R same as -r, but as a set" << std::endl
|
<< " -R same as -r, but as a set" << std::endl
|
||||||
|
|
@ -357,9 +351,7 @@ main(int argc, char** argv)
|
||||||
bool utf8_opt = false;
|
bool utf8_opt = false;
|
||||||
enum { NoDegen, DegenTBA, DegenSBA } degeneralize_opt = NoDegen;
|
enum { NoDegen, DegenTBA, DegenSBA } degeneralize_opt = NoDegen;
|
||||||
enum { TransitionLabeled, StateLabeled } labeling_opt = TransitionLabeled;
|
enum { TransitionLabeled, StateLabeled } labeling_opt = TransitionLabeled;
|
||||||
enum { TransFM, TransLaCIM, TransLaCIM_ELTL, TransLaCIM_ELTL_ops, TransTAA,
|
enum { TransFM, TransLaCIM, TransTAA, TransCompo } translation = TransFM;
|
||||||
TransCompo }
|
|
||||||
translation = TransFM;
|
|
||||||
bool fm_red = false;
|
bool fm_red = false;
|
||||||
bool fm_exprop_opt = false;
|
bool fm_exprop_opt = false;
|
||||||
bool fm_symb_merge_opt = true;
|
bool fm_symb_merge_opt = true;
|
||||||
|
|
@ -625,16 +617,6 @@ main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
translation = TransLaCIM;
|
translation = TransLaCIM;
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[formula_index], "-le"))
|
|
||||||
{
|
|
||||||
/* -lo is documented to imply -le, so do not overwrite it. */
|
|
||||||
if (translation != TransLaCIM_ELTL_ops)
|
|
||||||
translation = TransLaCIM_ELTL;
|
|
||||||
}
|
|
||||||
else if (!strcmp(argv[formula_index], "-lo"))
|
|
||||||
{
|
|
||||||
translation = TransLaCIM_ELTL_ops;
|
|
||||||
}
|
|
||||||
else if (!strcmp(argv[formula_index], "-L"))
|
else if (!strcmp(argv[formula_index], "-L"))
|
||||||
{
|
{
|
||||||
fair_loop_approx = true;
|
fair_loop_approx = true;
|
||||||
|
|
@ -1050,34 +1032,6 @@ main(int argc, char** argv)
|
||||||
exit_code = spot::ltl::format_parse_errors(std::cerr, input, pel);
|
exit_code = spot::ltl::format_parse_errors(std::cerr, input, pel);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TransLaCIM_ELTL:
|
|
||||||
{
|
|
||||||
spot::eltl::parse_error_list p;
|
|
||||||
tm.start("parsing formula");
|
|
||||||
f = spot::eltl::parse_string(input, p, env, false);
|
|
||||||
tm.stop("parsing formula");
|
|
||||||
exit_code = spot::eltl::format_parse_errors(std::cerr, p);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TransLaCIM_ELTL_ops:
|
|
||||||
{
|
|
||||||
// Call the LTL parser first to handle operators such as
|
|
||||||
// [] or <> and rewrite the output as a string with G or F.
|
|
||||||
// Then prepend definitions of usual LTL operators, and parse
|
|
||||||
// the result again as an ELTL formula.
|
|
||||||
spot::ltl::parse_error_list pel;
|
|
||||||
tm.start("parsing formula");
|
|
||||||
f = spot::ltl::parse(input, pel, env, debug_opt);
|
|
||||||
input = ltl_defs();
|
|
||||||
input += "%";
|
|
||||||
input += spot::ltl::to_string(f, true);
|
|
||||||
f->destroy();
|
|
||||||
spot::eltl::parse_error_list p;
|
|
||||||
f = spot::eltl::parse_string(input, p, env, debug_opt);
|
|
||||||
tm.stop("parsing formula");
|
|
||||||
exit_code = spot::eltl::format_parse_errors(std::cerr, p);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1261,10 +1215,6 @@ main(int argc, char** argv)
|
||||||
case TransLaCIM:
|
case TransLaCIM:
|
||||||
a = concrete = spot::ltl_to_tgba_lacim(f, dict);
|
a = concrete = spot::ltl_to_tgba_lacim(f, dict);
|
||||||
break;
|
break;
|
||||||
case TransLaCIM_ELTL:
|
|
||||||
case TransLaCIM_ELTL_ops:
|
|
||||||
a = concrete = spot::eltl_to_tgba_lacim(f, dict);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
tm.stop("translating formula");
|
tm.stop("translating formula");
|
||||||
to_free = a;
|
to_free = a;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2012, 2013 Laboratoire de Recherche et
|
# Copyright (C) 2012, 2013, 2014 Laboratoire de Recherche et
|
||||||
# Développement de l'Epita (LRDE).
|
# Développement de l'Epita (LRDE).
|
||||||
#
|
#
|
||||||
# This file is part of Spot, a model checking library.
|
# This file is part of Spot, a model checking library.
|
||||||
|
|
@ -48,6 +48,3 @@ ltl2tgba=../ltl2tgba
|
||||||
"$ltl2tgba -t -taa -r4 -c %f > %T" \
|
"$ltl2tgba -t -taa -r4 -c %f > %T" \
|
||||||
"$ltl2tgba -t -taa -r4 -R3 -RDS %f > %T"
|
"$ltl2tgba -t -taa -r4 -R3 -RDS %f > %T"
|
||||||
|
|
||||||
# Disabled because too slow, and too big automata produced.
|
|
||||||
# "$ltl2tgba -t -lo -r4 %f > %T"
|
|
||||||
# "$ltl2tgba -t -lo -R3b -r4 %f > %T" \
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2009, 2010, 2011, 2012 Laboratoire de Recherche et
|
|
||||||
# Développement de l'Epita (LRDE).
|
# Copyright (C) 2009, 2010, 2011, 2012, 2014 Laboratoire de Recherche
|
||||||
|
# et Développement de l'Epita (LRDE).
|
||||||
|
|
||||||
# Copyright (C) 2003, 2004, 2005, 2006, 2007 Laboratoire
|
# Copyright (C) 2003, 2004, 2005, 2006, 2007 Laboratoire
|
||||||
# d'Informatique de Paris 6 (LIP6), département Systèmes Répartis
|
# d'Informatique de Paris 6 (LIP6), département Systèmes Répartis
|
||||||
# Coopératifs (SRC), Université Pierre et Marie Curie.
|
# Coopératifs (SRC), Université Pierre et Marie Curie.
|
||||||
|
|
@ -62,30 +64,6 @@ Algorithm
|
||||||
Enabled = no
|
Enabled = no
|
||||||
}
|
}
|
||||||
|
|
||||||
Algorithm
|
|
||||||
{
|
|
||||||
Name = "Spot (Couvreur -- LaCIM), eltl"
|
|
||||||
Path = "${LBTT_TRANSLATE}"
|
|
||||||
Parameters = "--spot '../ltl2tgba -F -lo -t'"
|
|
||||||
Enabled = yes
|
|
||||||
}
|
|
||||||
|
|
||||||
Algorithm
|
|
||||||
{
|
|
||||||
Name = "Spot (Couvreur -- LaCIM), eltl + delete_unaccepting_scc"
|
|
||||||
Path = "${LBTT_TRANSLATE}"
|
|
||||||
Parameters = "--spot '../ltl2tgba -F -lo -t -R3b'"
|
|
||||||
Enabled = yes
|
|
||||||
}
|
|
||||||
|
|
||||||
Algorithm
|
|
||||||
{
|
|
||||||
Name = "Spot (Couvreur -- LaCIM), eltl + post reduction with scc"
|
|
||||||
Path = "${LBTT_TRANSLATE}"
|
|
||||||
Parameters = "--spot '../ltl2tgba -F -lo -t -R3'"
|
|
||||||
Enabled = no
|
|
||||||
}
|
|
||||||
|
|
||||||
Algorithm
|
Algorithm
|
||||||
{
|
{
|
||||||
Name = "Spot (Couvreur -- FM)"
|
Name = "Spot (Couvreur -- FM)"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue