Revert everything related to Damien's work in 2008 (he will commit a new version soon).
Here are the reverted patches:8c0d1003b0,25a3114287,9afbaf6342,dc0005f4e1,543190f2bc.
This commit is contained in:
parent
3d278663cd
commit
b1bfdee870
130 changed files with 912 additions and 5104 deletions
86
ChangeLog
86
ChangeLog
|
|
@ -159,25 +159,6 @@
|
|||
* iface/gspn/ssp.hh, iface/gspn/ssp.cc: Add the
|
||||
reversed_double_inclusion boolean for this.
|
||||
|
||||
2008-06-12 Damien Lefortier <dam@lrde.epita.fr>
|
||||
|
||||
Add ELTL visitors in eltlvisit/ and start the ELTL translation (LACIM).
|
||||
Merge all eltlast/ files into formula.hh (except automatop.hh).
|
||||
|
||||
* src/eltlast/allnodes.hh, src/eltlast/atomic_prop.hh,
|
||||
src/eltlast/binop.hh, src/eltlast/constant.hh, src/eltlast/multop.hh,
|
||||
src/eltlast/refformula.hh, src/eltlast/unop.hh,
|
||||
src/eltlast/visitor.hh: Delete and merge all these files into ...
|
||||
* src/eltlast/formula.hh: ... this one.
|
||||
* src/eltlvisit/: Add some visitors (clone, destroy, ...).
|
||||
* src/internal/baseformula.hh, src/internal/baseformula.cc:
|
||||
Add base_formula, a new base class of internal::formula.
|
||||
* src/tgba/bdddict.cc src/tgba/bdddict.hh, src/tgba/bddprint.cc,
|
||||
src/tgba/tgbabddconcretefactory.cc, src/tgba/tgbabddconcretefactory.hh
|
||||
Replace ltl::formula by internal::base_formula.
|
||||
* src/tgbatest/eltl2tgba.cc: Beginning of the ELTL translation (LACIM).
|
||||
* m4/boost.m4: Add AX_BOOST_BASE([MINIMUM-VERSION]).
|
||||
|
||||
2008-06-12 Alexandre Duret-Lutz <adl@lrde.epita.fr>
|
||||
|
||||
* iface/nips/nipstest/dotty.test,
|
||||
|
|
@ -191,56 +172,15 @@
|
|||
enough to make it pass "make check". Some major work is needed
|
||||
after the changes from 2008-04-16.
|
||||
|
||||
2008-06-12 Alexandre Duret-Lutz <adl@lrde.epita.fr>
|
||||
|
||||
Merge all ltlast/ files into formula.hh. The forward declaration
|
||||
of visitor was causing error messages too cryptic for users.
|
||||
|
||||
* src/ltlast/allnodes.hh, src/ltlast/atomic_prop.hh,
|
||||
src/ltlast/binop.hh, src/ltlast/constant.hh, src/ltlast/multop.hh,
|
||||
src/ltlast/refformula.hh, src/ltlast/unop.hh,
|
||||
src/ltlast/visitor.hh: Delete and merge all these files into ...
|
||||
* src/ltlast/formula.hh: ... this one.
|
||||
* src/ltlast/Makefile.am: Adjust.
|
||||
* ltlparse/ltlparse.yy, ltlparse/public.hh, ltltest/equals.cc,
|
||||
ltltest/randltl.cc, ltltest/readltl.cc, ltltest/reduc.cc,
|
||||
ltltest/syntimpl.cc, ltltest/tostring.cc, ltlvisit/apcollect.hh,
|
||||
ltlvisit/basicreduce.cc, ltlvisit/clone.cc, ltlvisit/clone.hh,
|
||||
ltlvisit/contain.cc, ltlvisit/dotty.cc, ltlvisit/dump.cc,
|
||||
ltlvisit/lunabbrev.cc, ltlvisit/nenoform.cc, ltlvisit/nenoform.hh,
|
||||
ltlvisit/postfix.cc, ltlvisit/postfix.hh, ltlvisit/randomltl.cc,
|
||||
ltlvisit/reduce.cc, ltlvisit/reduce.hh, ltlvisit/simpfg.cc,
|
||||
ltlvisit/syntimpl.cc, ltlvisit/tostring.cc, ltlvisit/tunabbrev.cc,
|
||||
tgba/bdddict.cc, tgba/formula2bdd.cc, tgba/tgbaexplicit.cc,
|
||||
tgba/tgbatba.cc, tgbaalgos/ltl2tgba_fm.cc,
|
||||
tgbaalgos/ltl2tgba_lacim.cc, tgbaalgos/randomgraph.cc,
|
||||
tgbaalgos/randomgraph.hh, tgbaalgos/save.cc, tgbaparse/public.hh,
|
||||
tgbaparse/tgbaparse.yy, tgbatest/explicit.cc,
|
||||
tgbatest/explprod.cc, tgbatest/ltl2tgba.cc, tgbatest/ltlprod.cc,
|
||||
tgbatest/mixprod.cc, tgbatest/powerset.cc, tgbatest/randtgba.cc,
|
||||
tgbatest/readsave.cc, tgbatest/reductgba.cc, tgbatest/tgbaread.cc,
|
||||
tgbatest/tripprod.cc: Adjust includes.
|
||||
|
||||
2008-06-12 Alexandre Duret-Lutz <adl@lrde.epita.fr>
|
||||
|
||||
* src/ltlast/atomic_prop.cc, src/ltlast/binop.cc,
|
||||
src/ltlast/constant.cc, src/ltlast/formula.cc,
|
||||
src/ltlast/multop.cc, src/ltlast/predecl.hh,
|
||||
src/ltlast/refformula.cc, src/ltlast/unop.cc: Delete these files,
|
||||
not used anymore since 2008-04-16.
|
||||
|
||||
2008-06-11 Alexandre Duret-Lutz <adl@lrde.epita.fr>
|
||||
|
||||
* iface/nips/dottynips.cc: Include ctsdlib for exit().
|
||||
* iface/nips/emptiness_check.cc: Likewise.
|
||||
|
||||
* src/eltlparse/eltlparse.yy: Include limits.h for INT_MIN and
|
||||
INT_MAX.
|
||||
|
||||
* src/sanity/includes.test: Remove empty line at beginning of file.
|
||||
|
||||
* src/internal/formula.hh (formula::hash): Remove the const
|
||||
qualifier from the return type, GCC 4.3.1 gicomplains.
|
||||
qualifier from the return type, GCC 4.3.1 complains.
|
||||
|
||||
2008-06-02 Guillaume SADEGH <sadegh@lrde.epita.fr>
|
||||
|
||||
|
|
@ -317,30 +257,6 @@
|
|||
|
||||
* src/Makefile.am (_.cc): Fix for `make tags`.
|
||||
|
||||
2008-04-16 Damien Lefortier <dam@lrde.epita.fr>
|
||||
|
||||
* configure.ac, Makefile.am: Add src/eltltest/ support.
|
||||
* src/eltlast/Makefile.am, src/eltlast/formula.hh,
|
||||
src/eltlast/nfa.cc, src/eltlast/nfa.hh: Update nfa implementation.
|
||||
* src/eltlparse/Makefile.am, src/eltlparse/eltlparse.yy,
|
||||
src/eltlparse/eltlscan.ll, src/eltlparse/parsedecl.hh,
|
||||
src/eltlparse/public.hh: Finish the parser for ELTL files.
|
||||
* src/eltltest/Makefile.am, src/eltltest/acc.cc,
|
||||
src/eltltest/acc.test: Add tests for the ELTL parser.
|
||||
* src/internal/atomic_prop.hh, src/internal/atomic_prop.hxx,
|
||||
src/internal/binop.hh, src/internal/binop.hxx,
|
||||
src/internal/constant.hh, src/internal/constant.hxx,
|
||||
src/internal/defaultenv.hh, src/internal/defaultenv.hxx,
|
||||
src/internal/environment.hh, src/internal/formula.hh,
|
||||
src/internal/formula.hxx, src/internal/multop.hh,
|
||||
src/internal/multop.hxx, src/internal/predecl.hh,
|
||||
src/internal/refformula.hh, src/internal/refformula.hxx,
|
||||
src/internal/unop.hh src/internal/unop.hxx: Clean and update
|
||||
documentation.
|
||||
* src/ltlast/formula.hh, src/ltlenv/Makefile.am,
|
||||
src/ltlenv/declenv.hh, src/tgbaalgos/randomgraph.hh: Fix make
|
||||
check issues.
|
||||
|
||||
2008-04-14 Alexandre Duret-Lutz <adl@lrde.epita.fr>
|
||||
|
||||
Kill some FIXMEs.
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ AC_LANG(C++)
|
|||
AX_CHECK_BUDDY
|
||||
AX_CHECK_LBTT
|
||||
AX_CHECK_GSPNLIB
|
||||
AX_BOOST_BASE([1.34])
|
||||
|
||||
AC_CHECK_FUNCS([srand48 drand48])
|
||||
|
||||
|
|
@ -87,18 +86,11 @@ AC_CONFIG_FILES([
|
|||
iface/nips/nipstest/Makefile
|
||||
iface/nips/nipstest/defs
|
||||
src/Makefile
|
||||
src/eltlast/Makefile
|
||||
src/eltlenv/Makefile
|
||||
src/eltlparse/Makefile
|
||||
src/eltltest/Makefile
|
||||
src/eltltest/defs
|
||||
src/eltlvisit/Makefile
|
||||
src/evtgba/Makefile
|
||||
src/evtgbaalgos/Makefile
|
||||
src/evtgbaparse/Makefile
|
||||
src/evtgbatest/Makefile
|
||||
src/evtgbatest/defs
|
||||
src/internal/Makefile
|
||||
src/ltlast/Makefile
|
||||
src/ltlenv/Makefile
|
||||
src/ltlparse/Makefile
|
||||
|
|
|
|||
194
m4/boost.m4
194
m4/boost.m4
|
|
@ -1,194 +0,0 @@
|
|||
##### http://autoconf-archive.cryp.to/ax_boost_base.html
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_BOOST_BASE([MINIMUM-VERSION])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Test for the Boost C++ libraries of a particular version (or newer)
|
||||
#
|
||||
# If no path to the installed boost library is given the macro
|
||||
# searchs under /usr, /usr/local, /opt and /opt/local and evaluates
|
||||
# the $BOOST_ROOT environment variable. Further documentation is
|
||||
# available at <http://randspringer.de/boost/index.html>.
|
||||
#
|
||||
# This macro calls:
|
||||
#
|
||||
# AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
|
||||
#
|
||||
# And sets:
|
||||
#
|
||||
# HAVE_BOOST
|
||||
#
|
||||
# LAST MODIFICATION
|
||||
#
|
||||
# 2007-07-28
|
||||
#
|
||||
# COPYLEFT
|
||||
#
|
||||
# Copyright (c) 2007 Thomas Porschberg <thomas@randspringer.de>
|
||||
#
|
||||
# Copying and distribution of this file, with or without
|
||||
# modification, are permitted in any medium without royalty provided
|
||||
# the copyright notice and this notice are preserved.
|
||||
|
||||
AC_DEFUN([AX_BOOST_BASE],
|
||||
[
|
||||
AC_ARG_WITH([boost],
|
||||
AS_HELP_STRING([--with-boost@<:@=DIR@:>@], [use boost (default is yes) - it is possible to specify the root directory for boost (optional)]),
|
||||
[
|
||||
if test "$withval" = "no"; then
|
||||
want_boost="no"
|
||||
elif test "$withval" = "yes"; then
|
||||
want_boost="yes"
|
||||
ac_boost_path=""
|
||||
else
|
||||
want_boost="yes"
|
||||
ac_boost_path="$withval"
|
||||
fi
|
||||
],
|
||||
[want_boost="yes"])
|
||||
|
||||
if test "x$want_boost" = "xyes"; then
|
||||
boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
|
||||
boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
|
||||
boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
|
||||
boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
|
||||
boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
|
||||
if test "x$boost_lib_version_req_sub_minor" = "x" ; then
|
||||
boost_lib_version_req_sub_minor="0"
|
||||
fi
|
||||
WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
|
||||
AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
|
||||
succeeded=no
|
||||
|
||||
dnl first we check the system location for boost libraries
|
||||
dnl this location ist chosen if boost libraries are installed with the --layout=system option
|
||||
dnl or if you install boost with RPM
|
||||
if test "$ac_boost_path" != ""; then
|
||||
BOOST_LDFLAGS="-L$ac_boost_path/lib"
|
||||
BOOST_CPPFLAGS="-I$ac_boost_path/include"
|
||||
else
|
||||
for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
|
||||
if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
|
||||
BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib"
|
||||
BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
|
||||
break;
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
CPPFLAGS_SAVED="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
||||
|
||||
LDFLAGS_SAVED="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
|
||||
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
@%:@include <boost/version.hpp>
|
||||
]], [[
|
||||
#if BOOST_VERSION >= $WANT_BOOST_VERSION
|
||||
// Everything is okay
|
||||
#else
|
||||
# error Boost version is too old
|
||||
#endif
|
||||
]])],[
|
||||
AC_MSG_RESULT(yes)
|
||||
succeeded=yes
|
||||
found_system=yes
|
||||
],[
|
||||
])
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
|
||||
|
||||
dnl if we found no boost with system layout we search for boost libraries
|
||||
dnl built and installed without the --layout=system option or for a staged(not installed) version
|
||||
if test "x$succeeded" != "xyes"; then
|
||||
_version=0
|
||||
if test "$ac_boost_path" != ""; then
|
||||
BOOST_LDFLAGS="-L$ac_boost_path/lib"
|
||||
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
|
||||
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
|
||||
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
|
||||
V_CHECK=`expr $_version_tmp \> $_version`
|
||||
if test "$V_CHECK" = "1" ; then
|
||||
_version=$_version_tmp
|
||||
fi
|
||||
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
|
||||
BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
|
||||
done
|
||||
fi
|
||||
else
|
||||
for ac_boost_path in /usr /usr/local /opt /opt/local ; do
|
||||
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
|
||||
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
|
||||
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
|
||||
V_CHECK=`expr $_version_tmp \> $_version`
|
||||
if test "$V_CHECK" = "1" ; then
|
||||
_version=$_version_tmp
|
||||
best_path=$ac_boost_path
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
|
||||
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
|
||||
BOOST_LDFLAGS="-L$best_path/lib"
|
||||
|
||||
if test "x$BOOST_ROOT" != "x"; then
|
||||
if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then
|
||||
version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
|
||||
stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
|
||||
stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
|
||||
V_CHECK=`expr $stage_version_shorten \>\= $_version`
|
||||
if test "$V_CHECK" = "1" ; then
|
||||
AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
|
||||
BOOST_CPPFLAGS="-I$BOOST_ROOT"
|
||||
BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
||||
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
|
||||
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
@%:@include <boost/version.hpp>
|
||||
]], [[
|
||||
#if BOOST_VERSION >= $WANT_BOOST_VERSION
|
||||
// Everything is okay
|
||||
#else
|
||||
# error Boost version is too old
|
||||
#endif
|
||||
]])],[
|
||||
AC_MSG_RESULT(yes)
|
||||
succeeded=yes
|
||||
found_system=yes
|
||||
],[
|
||||
])
|
||||
AC_LANG_POP([C++])
|
||||
fi
|
||||
|
||||
if test "$succeeded" != "yes" ; then
|
||||
CPPFLAGS="$CPPFLAGS_SAVED"
|
||||
LDFLAGS="$LDFLAGS_SAVED"
|
||||
|
||||
if test "$_version" = "0" ; then
|
||||
AC_MSG_ERROR([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
|
||||
else
|
||||
AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
|
||||
fi
|
||||
else
|
||||
AC_SUBST(BOOST_CPPFLAGS)
|
||||
AC_SUBST(BOOST_LDFLAGS)
|
||||
AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
|
||||
fi
|
||||
fi
|
||||
|
||||
])
|
||||
|
|
@ -23,23 +23,20 @@ AUTOMAKE_OPTIONS = subdir-objects
|
|||
|
||||
# List directories in the order they must be built.
|
||||
# Keep tests at the end.
|
||||
SUBDIRS = misc ltlenv ltlast ltlvisit ltlparse internal \
|
||||
eltlenv eltlast eltlvisit eltlparse \
|
||||
SUBDIRS = misc ltlenv ltlast ltlvisit ltlparse \
|
||||
tgba tgbaalgos tgbaparse \
|
||||
evtgba evtgbaalgos evtgbaparse . \
|
||||
ltltest eltltest tgbatest evtgbatest sanity
|
||||
ltltest tgbatest evtgbatest sanity
|
||||
|
||||
lib_LTLIBRARIES = libspot.la
|
||||
libspot_la_SOURCES =
|
||||
libspot_la_LDFLAGS = $(BUDDY_LDFLAGS) -no-undefined
|
||||
libspot_la_LIBADD = \
|
||||
misc/libmisc.la \
|
||||
ltlenv/libltlenv.la \
|
||||
ltlparse/libltlparse.la \
|
||||
ltlvisit/libltlvisit.la \
|
||||
internal/libinternal.la \
|
||||
eltlast/libeltlast.la \
|
||||
eltlparse/libeltlparse.la \
|
||||
eltlvisit/libeltlvisit.la \
|
||||
ltlast/libltlast.la \
|
||||
tgba/libtgba.la \
|
||||
tgbaalgos/libtgbaalgos.la \
|
||||
tgbaparse/libtgbaparse.la \
|
||||
|
|
|
|||
|
|
@ -1,35 +0,0 @@
|
|||
## Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
## Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
## 02111-1307, USA.
|
||||
|
||||
AM_CPPFLAGS = -I$(srcdir)/..
|
||||
AM_CXXFLAGS = $(WARNING_CXXFLAGS)
|
||||
|
||||
eltlastdir = $(pkgincludedir)/eltlast
|
||||
|
||||
eltlast_HEADERS = \
|
||||
automatop.hh \
|
||||
formula.hh \
|
||||
nfa.hh
|
||||
|
||||
noinst_LTLIBRARIES = libeltlast.la
|
||||
libeltlast_la_SOURCES = \
|
||||
automatop.cc \
|
||||
nfa.cc
|
||||
|
|
@ -1,120 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include "automatop.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
automatop::automatop(vec* v)
|
||||
: nfa_(), children_(v)
|
||||
{
|
||||
dump_ = "automatop(";
|
||||
dump_ += (*v)[0]->dump();
|
||||
for (unsigned n = 1; n < v->size(); ++n)
|
||||
dump_ += ", " + (*v)[n]->dump();
|
||||
dump_ += ")";
|
||||
set_key_();
|
||||
}
|
||||
|
||||
automatop::~automatop()
|
||||
{
|
||||
delete children_;
|
||||
}
|
||||
|
||||
void
|
||||
automatop::accept(visitor& v)
|
||||
{
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
void
|
||||
automatop::accept(const_visitor& v) const
|
||||
{
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
automatop*
|
||||
automatop::instance(nfa::ptr nfa, formula* autop)
|
||||
{
|
||||
vec* v = new vec;
|
||||
v->push_back(autop);
|
||||
automatop* res = instance(v);
|
||||
res->nfa_ = nfa;
|
||||
return res;
|
||||
}
|
||||
|
||||
automatop*
|
||||
automatop::instance(formula* first, formula* second)
|
||||
{
|
||||
vec* v = new vec;
|
||||
v->push_back(first);
|
||||
v->push_back(second);
|
||||
return instance(v);
|
||||
}
|
||||
|
||||
automatop*
|
||||
automatop::instance(vec* v)
|
||||
{
|
||||
// Inline children of same kind.
|
||||
{
|
||||
vec inlined;
|
||||
vec::iterator i = v->begin();
|
||||
while (i != v->end())
|
||||
{
|
||||
if (automatop* p = dynamic_cast<automatop*>(*i))
|
||||
{
|
||||
unsigned ps = p->size();
|
||||
for (unsigned n = 0; n < ps; ++n)
|
||||
inlined.push_back(p->nth(n));
|
||||
formula::unref(*i);
|
||||
i = v->erase(i);
|
||||
}
|
||||
else
|
||||
++i;
|
||||
}
|
||||
v->insert(v->end(), inlined.begin(), inlined.end());
|
||||
}
|
||||
|
||||
automatop* res = new automatop(v);
|
||||
return static_cast<automatop*>(res->ref());
|
||||
}
|
||||
|
||||
unsigned
|
||||
automatop::size() const
|
||||
{
|
||||
return children_->size();
|
||||
}
|
||||
|
||||
const formula*
|
||||
automatop::nth(unsigned n) const
|
||||
{
|
||||
return (*children_)[n];
|
||||
}
|
||||
|
||||
formula*
|
||||
automatop::nth(unsigned n)
|
||||
{
|
||||
return (*children_)[n];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
/// \file eltlast/automatop.hh
|
||||
/// \brief ELTL automaton operators
|
||||
#ifndef SPOT_ELTLAST_AUTOMATOP_HH
|
||||
# define SPOT_ELTLAST_AUTOMATOP_HH
|
||||
|
||||
# include "formula.hh"
|
||||
# include "nfa.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
/// \brief Counted-reference formulae.
|
||||
/// \ingroup eltl_ast
|
||||
typedef spot::internal::ref_formula<eltl_t> ref_formula;
|
||||
|
||||
/// \brief Automaton operators.
|
||||
/// \ingroup eltl_ast
|
||||
///
|
||||
class automatop : public ref_formula
|
||||
{
|
||||
public:
|
||||
/// List of formulae.
|
||||
typedef std::vector<formula*> vec;
|
||||
|
||||
/// \brief Build a spot::eltl::automatop with automaton \c nfa
|
||||
/// and children of \c autop.
|
||||
static automatop* instance(nfa::ptr nfa, formula* autop);
|
||||
|
||||
/// \brief Build a spot::eltl::automatop with two children.
|
||||
///
|
||||
/// If one of the children itself is a spot::eltl::automatop,
|
||||
/// it will be merged. This allows incremental building of
|
||||
/// n-ary eltl::automatop.
|
||||
static automatop* instance(formula* first, formula* second);
|
||||
|
||||
/// \brief Build a spot::eltl::automatop with many children.
|
||||
static automatop* instance(vec* v);
|
||||
|
||||
virtual void accept(visitor& v);
|
||||
virtual void accept(const_visitor& v) const;
|
||||
|
||||
/// Get the number of argument.
|
||||
unsigned size() const;
|
||||
/// \brief Get the nth argument.
|
||||
///
|
||||
/// Starting with \a n = 0.
|
||||
const formula* nth(unsigned n) const;
|
||||
/// \brief Get the nth argument.
|
||||
///
|
||||
/// Starting with \a n = 0.
|
||||
formula* nth(unsigned n);
|
||||
|
||||
protected:
|
||||
automatop(vec* v);
|
||||
virtual ~automatop();
|
||||
|
||||
private:
|
||||
nfa::ptr nfa_;
|
||||
vec* children_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_ELTLAST_AUTOMATOP_HH
|
||||
|
|
@ -1,200 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
/// \file eltlast/formula.hh
|
||||
/// \brief ELTL formula interface
|
||||
#ifndef SPOT_ELTLAST_FORMULA_HH
|
||||
# define SPOT_ELTLAST_FORMULA_HH
|
||||
|
||||
# include "internal/formula.hh"
|
||||
# include "internal/atomic_prop.hh"
|
||||
# include "internal/constant.hh"
|
||||
# include "internal/unop.hh"
|
||||
# include "internal/binop.hh"
|
||||
# include "internal/multop.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
/// \defgroup eltl ELTL formulae
|
||||
///
|
||||
/// This module gathers types and definitions related to ELTL formulae.
|
||||
|
||||
/// \addtogroup eltl_essential Essential ELTL types
|
||||
/// \ingroup eltl
|
||||
|
||||
/// \addtogroup eltl_ast ELTL Abstract Syntax Tree
|
||||
/// \ingroup eltl
|
||||
|
||||
/// \addtogroup eltl_environment ELTL environments
|
||||
/// \ingroup eltl
|
||||
/// ELTL environment implementations.
|
||||
|
||||
/// \addtogroup eltl_algorithm Algorithms for ELTL formulae
|
||||
/// \ingroup eltl
|
||||
|
||||
/// \addtogroup eltl_io Input/Output of ELTL formulae
|
||||
/// \ingroup eltl_algorithm
|
||||
|
||||
/// \addtogroup eltl_visitor Derivable visitors
|
||||
/// \ingroup eltl_algorithm
|
||||
|
||||
/// Forward declarations
|
||||
struct eltl_t;
|
||||
struct visitor;
|
||||
struct const_visitor;
|
||||
|
||||
/// \brief An ELTL formula.
|
||||
/// \ingroup eltl_essential
|
||||
/// \ingroup eltl_ast
|
||||
///
|
||||
/// The only way you can work with a formula is to
|
||||
/// build a spot::eltl::visitor or spot::eltl::const_visitor.
|
||||
typedef spot::internal::formula<eltl_t> formula;
|
||||
|
||||
/// Forward declarations
|
||||
formula* clone(const formula* f);
|
||||
std::ostream& to_string(const formula* f, std::ostream& os);
|
||||
void destroy(const formula* f);
|
||||
|
||||
struct eltl_t
|
||||
{
|
||||
typedef spot::eltl::visitor visitor;
|
||||
typedef spot::eltl::const_visitor const_visitor;
|
||||
|
||||
static formula* clone_(const formula* f)
|
||||
{
|
||||
return clone(f);
|
||||
}
|
||||
|
||||
static std::ostream& to_string_(const formula* f, std::ostream& os)
|
||||
{
|
||||
return to_string(f, os);
|
||||
}
|
||||
|
||||
static void destroy_(const formula* f)
|
||||
{
|
||||
destroy(f);
|
||||
}
|
||||
|
||||
enum binop { Xor, Implies, Equiv };
|
||||
const char* binop_name(binop op) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case Xor:
|
||||
return "Xor";
|
||||
case Implies:
|
||||
return "Implies";
|
||||
case Equiv:
|
||||
return "Equiv";
|
||||
}
|
||||
// Unreachable code.
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum unop { Not };
|
||||
const char* unop_name(unop op) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case Not:
|
||||
return "Not";
|
||||
}
|
||||
// Unreachable code.
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
typedef spot::internal::formula_ptr_less_than formula_ptr_less_than;
|
||||
typedef spot::internal::formula_ptr_hash formula_ptr_hash;
|
||||
|
||||
/// \brief Atomic propositions.
|
||||
/// \ingroup eltl_ast
|
||||
typedef spot::internal::atomic_prop<eltl_t> atomic_prop;
|
||||
|
||||
/// \brief A constant (True or False)
|
||||
/// \ingroup eltl_ast
|
||||
typedef spot::internal::constant<eltl_t> constant;
|
||||
|
||||
/// \brief Unary operators.
|
||||
/// \ingroup eltl_ast
|
||||
typedef spot::internal::unop<eltl_t> unop;
|
||||
|
||||
/// \brief Binary operator.
|
||||
/// \ingroup eltl_ast
|
||||
typedef spot::internal::binop<eltl_t> binop;
|
||||
|
||||
/// \brief Multi-operand operators.
|
||||
/// \ingroup eltl_ast
|
||||
///
|
||||
/// These operators are considered commutative and associative.
|
||||
typedef spot::internal::multop<eltl_t> multop;
|
||||
|
||||
// Forward declaration.
|
||||
struct automatop;
|
||||
|
||||
/// \brief Formula visitor that can modify the formula.
|
||||
/// \ingroup eltl_essential
|
||||
///
|
||||
/// Writing visitors is the prefered way
|
||||
/// to traverse a formula, since it doesn't
|
||||
/// involve any cast.
|
||||
///
|
||||
/// If you do not need to modify the visited formula, inherit from
|
||||
/// spot::eltl:const_visitor instead.
|
||||
struct visitor
|
||||
{
|
||||
virtual ~visitor() {}
|
||||
virtual void visit(atomic_prop* node) = 0;
|
||||
virtual void visit(constant* node) = 0;
|
||||
virtual void visit(binop* node) = 0;
|
||||
virtual void visit(unop* node) = 0;
|
||||
virtual void visit(multop* node) = 0;
|
||||
virtual void visit(automatop* node) = 0;
|
||||
};
|
||||
|
||||
/// \brief Formula visitor that cannot modify the formula.
|
||||
///
|
||||
/// Writing visitors is the prefered way
|
||||
/// to traverse a formula, since it doesn't
|
||||
/// involve any cast.
|
||||
///
|
||||
/// If you want to modify the visited formula, inherit from
|
||||
/// spot::eltl:visitor instead.
|
||||
struct const_visitor
|
||||
{
|
||||
virtual ~const_visitor() {}
|
||||
virtual void visit(const atomic_prop* node) = 0;
|
||||
virtual void visit(const constant* node) = 0;
|
||||
virtual void visit(const binop* node) = 0;
|
||||
virtual void visit(const unop* node) = 0;
|
||||
virtual void visit(const multop* node) = 0;
|
||||
virtual void visit(const automatop* node) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !SPOT_ELTLAST_FORMULA_HH_ */
|
||||
|
|
@ -1,127 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include <cassert>
|
||||
#include "nfa.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
nfa::nfa()
|
||||
: ns_(), sn_(), init_(0), arity_(0), finals_()
|
||||
{
|
||||
}
|
||||
|
||||
nfa::~nfa()
|
||||
{
|
||||
ns_map::iterator i;
|
||||
for (i = ns_.begin(); i != ns_.end(); ++i)
|
||||
{
|
||||
state::iterator i2;
|
||||
for (i2 = i->second->begin(); i2 != i->second->end(); ++i2)
|
||||
delete *i2;
|
||||
delete i->second;
|
||||
}
|
||||
}
|
||||
|
||||
nfa::state*
|
||||
nfa::add_state(const std::string& name)
|
||||
{
|
||||
ns_map::iterator i = ns_.find(name);
|
||||
if (i == ns_.end())
|
||||
{
|
||||
state* s = new nfa::state;
|
||||
ns_[name] = s;
|
||||
sn_[s] = name;
|
||||
|
||||
if (!init_)
|
||||
init_ = s;
|
||||
return s;
|
||||
}
|
||||
return i->second;
|
||||
}
|
||||
|
||||
void
|
||||
nfa::add_transition(const std::string& s, const std::string& d, int c)
|
||||
{
|
||||
state* source = add_state(s);
|
||||
nfa::transition* t = new transition;
|
||||
t->dest = add_state(d);
|
||||
t->cost = c;
|
||||
source->push_back(t);
|
||||
if (c > arity_)
|
||||
arity_ = c;
|
||||
}
|
||||
|
||||
void
|
||||
nfa::set_init_state(const std::string& state)
|
||||
{
|
||||
init_ = add_state(state);
|
||||
}
|
||||
|
||||
void
|
||||
nfa::set_final(const std::string& state)
|
||||
{
|
||||
finals_.insert(state);
|
||||
}
|
||||
|
||||
bool
|
||||
nfa::is_final(const std::string& state)
|
||||
{
|
||||
return finals_.find(state) != finals_.end();
|
||||
}
|
||||
|
||||
int
|
||||
nfa::arity()
|
||||
{
|
||||
return arity_ + 1;
|
||||
}
|
||||
|
||||
const nfa::state*
|
||||
nfa::get_init_state()
|
||||
{
|
||||
if (!init_)
|
||||
add_state("empty");
|
||||
return init_;
|
||||
}
|
||||
|
||||
nfa::iterator
|
||||
nfa::begin(const state* s) const
|
||||
{
|
||||
return nfa::iterator(s->begin());
|
||||
}
|
||||
|
||||
nfa::iterator
|
||||
nfa::end(const state* s) const
|
||||
{
|
||||
return nfa::iterator(s->end());
|
||||
}
|
||||
|
||||
std::string
|
||||
nfa::format_state(const state* s) const
|
||||
{
|
||||
sn_map::const_iterator i = sn_.find(s);
|
||||
assert(i != sn_.end());
|
||||
return i->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
/// \file eltlast/nfa.hh
|
||||
/// \brief NFA interface
|
||||
#ifndef SPOT_ELTLAST_NFA_HH
|
||||
# define SPOT_ELTLAST_NFA_HH
|
||||
|
||||
# include "misc/hash.hh"
|
||||
# include <boost/shared_ptr.hpp>
|
||||
# include <list>
|
||||
# include <set>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
/// Forward declaration. See below.
|
||||
class succ_iterator;
|
||||
|
||||
/// \brief A Nondeterministic Finite Automaton used in ELTL
|
||||
/// automata operators.
|
||||
/// \ingroup eltl_essential
|
||||
class nfa
|
||||
{
|
||||
public:
|
||||
struct transition;
|
||||
typedef std::list<transition*> state;
|
||||
/// Iterator over the successors of a state.
|
||||
typedef succ_iterator iterator;
|
||||
typedef boost::shared_ptr<nfa> ptr;
|
||||
|
||||
/// Explicit transitions.
|
||||
struct transition
|
||||
{
|
||||
int cost;
|
||||
const state* dest;
|
||||
};
|
||||
|
||||
nfa();
|
||||
~nfa();
|
||||
|
||||
void
|
||||
add_transition(const std::string& s, const std::string& d, int c);
|
||||
|
||||
void
|
||||
set_init_state(const std::string& state);
|
||||
const state*
|
||||
get_init_state();
|
||||
|
||||
void
|
||||
set_final(const std::string& state);
|
||||
bool
|
||||
is_final(const std::string& state);
|
||||
|
||||
/// \brief Get the `arity' i.e. max t.cost, for each transition t.
|
||||
int
|
||||
arity();
|
||||
|
||||
/// \brief Return an iterator on the first succesor (if any) of \a state.
|
||||
///
|
||||
/// The usual way to do this with a \c for lopp.
|
||||
/// \code
|
||||
/// for (nfa::iterator i = a.begin(state); i != a.end(state); ++i)
|
||||
/// ...
|
||||
/// \endcode
|
||||
iterator
|
||||
begin(const state* state) const;
|
||||
|
||||
/// \brief Return an iterator just past the last succesor of \a state.
|
||||
iterator
|
||||
end(const state* state) const;
|
||||
|
||||
std::string
|
||||
format_state(const state* state) const;
|
||||
|
||||
private:
|
||||
state*
|
||||
add_state(const std::string& name);
|
||||
|
||||
typedef Sgi::hash_map<const std::string, state*, string_hash> ns_map;
|
||||
typedef Sgi::hash_map<const state*, std::string, ptr_hash<state> > sn_map;
|
||||
|
||||
ns_map ns_;
|
||||
sn_map sn_;
|
||||
state* init_;
|
||||
|
||||
int arity_;
|
||||
std::set<std::string> finals_;
|
||||
|
||||
/// Explicitly disllow use of implicity generated member functions
|
||||
/// we don't want.
|
||||
nfa(const nfa& other);
|
||||
nfa& operator=(const nfa& other);
|
||||
};
|
||||
|
||||
class succ_iterator
|
||||
{
|
||||
public:
|
||||
succ_iterator(const nfa::state::const_iterator s)
|
||||
: i_(s)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
operator++()
|
||||
{
|
||||
++i_;
|
||||
}
|
||||
|
||||
bool
|
||||
operator!=(const succ_iterator& rhs) const
|
||||
{
|
||||
return i_ != rhs.i_;
|
||||
}
|
||||
|
||||
const nfa::transition* operator*() const
|
||||
{
|
||||
return *i_;
|
||||
}
|
||||
|
||||
private:
|
||||
nfa::state::const_iterator i_;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_ELTLAST_NFA_HH_
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
## Copyright (C) 2003, 2004 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
## Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
## 02111-1307, USA.
|
||||
|
||||
eltlenvdir = $(pkgincludedir)/eltlenv
|
||||
|
||||
eltlenv_HEADERS = \
|
||||
defaultenv.hh \
|
||||
declenv.hh \
|
||||
environment.hh
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_ELTLENV_DECLENV_HH
|
||||
# define SPOT_ELTLENV_DECLENV_HH
|
||||
|
||||
# include "environment.hh"
|
||||
# include "internal/declenv.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
|
||||
/// \brief A declarative environment.
|
||||
/// \ingroup eltl_environment
|
||||
///
|
||||
/// This environment recognizes all atomic propositions
|
||||
/// that have been previously declared. It will reject other.
|
||||
typedef spot::internal::declarative_environment<eltl_t>
|
||||
declarative_environment;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_ELTLENV_DECLENV_HH
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_ELTLENV_DEFAULTENV_HH
|
||||
# define SPOT_ELTLENV_DEFAULTENV_HH
|
||||
|
||||
# include "environment.hh"
|
||||
# include "internal/defaultenv.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
|
||||
/// \brief A laxist environment.
|
||||
/// \ingroup eltl_environment
|
||||
///
|
||||
/// This environment recognizes all atomic propositions.
|
||||
///
|
||||
/// This is a singleton. Use default_environment::instance()
|
||||
/// to obtain the instance.
|
||||
typedef spot::internal::default_environment<eltl_t> default_environment;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_ELTLENV_DEFAULTENV_HH
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_ELTLENV_ENVIRONMENT_HH
|
||||
# define SPOT_ELTLENV_ENVIRONMENT_HH
|
||||
|
||||
# include "eltlast/formula.hh"
|
||||
# include "internal/environment.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
/// \brief An environment that describes atomic propositions.
|
||||
/// \ingroup eltl_essential
|
||||
typedef spot::internal::environment<eltl_t> environment;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_ELTLENV_ENVIRONMENT_HH
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
## Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
## Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
## 02111-1307, USA.
|
||||
|
||||
AM_CPPFLAGS = -I$(srcdir)/..
|
||||
AM_CXXFLAGS = #$(WARNING_CXXFLAGS)
|
||||
|
||||
eltlparsedir = $(pkgincludedir)/eltlparse
|
||||
|
||||
noinst_LTLIBRARIES = libeltlparse.la
|
||||
|
||||
ELTLPARSE_YY = eltlparse.yy
|
||||
FROM_ELTLPARSE_YY_MAIN = eltlparse.cc
|
||||
FROM_ELTLPARSE_YY_OTHERS = \
|
||||
stack.hh \
|
||||
position.hh \
|
||||
location.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 --defines --locations --skeleton=lalr1.cc --report=all \
|
||||
$(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 \
|
||||
location.hh \
|
||||
position.hh
|
||||
|
|
@ -1,289 +0,0 @@
|
|||
/* Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
** Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
** 02111-1307, USA.
|
||||
*/
|
||||
%{
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <limits>
|
||||
#include <cerrno>
|
||||
#include <limits.h>
|
||||
#include "public.hh"
|
||||
#include "eltlast/automatop.hh"
|
||||
|
||||
// Implementation detail for error handling.
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
struct parse_error_list_t
|
||||
{
|
||||
parse_error_list list_;
|
||||
std::string file_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#define PARSE_ERROR(Loc, Msg) \
|
||||
pe.list_.push_back \
|
||||
(parse_error(Loc, spair(pe.file_, Msg)))
|
||||
|
||||
%}
|
||||
|
||||
%name-prefix="eltlyy"
|
||||
%parse-param {spot::eltl::nfamap& nmap}
|
||||
%parse-param {spot::eltl::parse_error_list_t &pe}
|
||||
%parse-param {spot::eltl::environment &parse_environment}
|
||||
%parse-param {spot::eltl::formula* &result}
|
||||
%lex-param {spot::eltl::parse_error_list_t &pe}
|
||||
%expect 0
|
||||
%debug
|
||||
%error-verbose
|
||||
%pure-parser
|
||||
%union
|
||||
{
|
||||
int ival;
|
||||
std::string* sval;
|
||||
spot::eltl::nfa* nval;
|
||||
spot::eltl::formula* fval;
|
||||
}
|
||||
|
||||
%{
|
||||
/* 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;
|
||||
|
||||
%}
|
||||
|
||||
/* All tokens. */
|
||||
|
||||
%token <sval> ARG "argument"
|
||||
ATOMIC_PROP "atomic proposition"
|
||||
IDENT "identifier"
|
||||
OP_NOT "not operator"
|
||||
STATE "state"
|
||||
|
||||
%token <ival> OP_OR "or operator"
|
||||
OP_XOR "xor operator"
|
||||
OP_AND "and operator"
|
||||
OP_IMPLIES "implication operator"
|
||||
OP_EQUIV "equivalent operator"
|
||||
|
||||
%token ACC "accept"
|
||||
EQ "="
|
||||
LPAREN "("
|
||||
RPAREN ")"
|
||||
COMMA ","
|
||||
END_OF_FILE "end of file"
|
||||
CONST_TRUE "constant true"
|
||||
CONST_FALSE "constant false"
|
||||
|
||||
/* Priorities. */
|
||||
|
||||
/* Logical operators. */
|
||||
%left OP_OR
|
||||
%left OP_XOR
|
||||
%left OP_AND
|
||||
%left OP_IMPLIES OP_EQUIV
|
||||
|
||||
%nonassoc OP_NOT
|
||||
|
||||
%type <nval> nfa_def;
|
||||
%type <fval> subformula;
|
||||
%type <fval> arg_list;
|
||||
|
||||
%destructor { delete $$; } "atomic proposition"
|
||||
|
||||
%printer { debug_stream() << *$$; } "atomic proposition"
|
||||
|
||||
%%
|
||||
|
||||
result: nfa_list subformula
|
||||
{
|
||||
result = $2;
|
||||
YYACCEPT;
|
||||
}
|
||||
;
|
||||
|
||||
/* NFA definitions. */
|
||||
|
||||
nfa_list: /* empty. */
|
||||
| nfa_list nfa
|
||||
;
|
||||
|
||||
nfa: IDENT "=" "(" nfa_def ")"
|
||||
{
|
||||
nmap[*$1] = nfa::ptr($4);
|
||||
delete $1;
|
||||
}
|
||||
;
|
||||
|
||||
nfa_def: /* empty. */
|
||||
{
|
||||
$$ = new nfa();
|
||||
}
|
||||
| nfa_def STATE STATE ARG
|
||||
{
|
||||
errno = 0;
|
||||
long i = strtol($4->c_str(), 0, 10);
|
||||
if (i > std::numeric_limits<long>::max() ||
|
||||
i < std::numeric_limits<long>::min() || errno == ERANGE)
|
||||
{
|
||||
std::string s = "out of range integer `";
|
||||
s += *$4;
|
||||
s += "'";
|
||||
PARSE_ERROR(@1, s);
|
||||
delete $2;
|
||||
delete $3;
|
||||
delete $4;
|
||||
YYERROR;
|
||||
}
|
||||
$1->add_transition(*$2, *$3, i);
|
||||
$$ = $1;
|
||||
}
|
||||
| nfa_def STATE STATE CONST_TRUE
|
||||
{
|
||||
$1->add_transition(*$2, *$3, -1);
|
||||
$$ = $1;
|
||||
}
|
||||
| nfa_def ACC STATE
|
||||
{
|
||||
$1->set_final(*$3);
|
||||
}
|
||||
;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
| ATOMIC_PROP "(" arg_list ")"
|
||||
{
|
||||
nfamap::iterator i = nmap.find(*$1);
|
||||
if (i == nmap.end())
|
||||
{
|
||||
std::string s = "unknown automaton operator `";
|
||||
s += *$1;
|
||||
s += "'";
|
||||
PARSE_ERROR(@1, s);
|
||||
delete $1;
|
||||
YYERROR;
|
||||
}
|
||||
|
||||
automatop* res = automatop::instance(i->second, $3);
|
||||
if (res->size() != i->second->arity())
|
||||
{
|
||||
std::ostringstream oss1;
|
||||
oss1 << res->size();
|
||||
std::ostringstream oss2;
|
||||
oss2 << i->second->arity();
|
||||
|
||||
std::string s(*$1);
|
||||
s += " is used with ";
|
||||
s += oss1.str();
|
||||
s += " arguments, but has an arity of ";
|
||||
s += oss2.str();
|
||||
PARSE_ERROR(@1, s);
|
||||
delete $1;
|
||||
YYERROR;
|
||||
}
|
||||
$$ = res;
|
||||
}
|
||||
| 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); }
|
||||
;
|
||||
|
||||
arg_list: subformula
|
||||
{ $$ = $1; }
|
||||
| subformula "," arg_list
|
||||
{ $$ = automatop::instance($1, $3); }
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
void
|
||||
eltlyy::parser::error(const location_type& loc, const std::string& s)
|
||||
{
|
||||
PARSE_ERROR(loc, s);
|
||||
}
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
formula*
|
||||
parse(const std::string& name,
|
||||
parse_error_list& error_list,
|
||||
environment& env,
|
||||
bool debug)
|
||||
{
|
||||
if (eltlyyopen(name))
|
||||
{
|
||||
error_list.push_back
|
||||
(parse_error(eltlyy::location(),
|
||||
spair("-", std::string("Cannot open file ") + name)));
|
||||
return 0;
|
||||
}
|
||||
formula* result = 0;
|
||||
nfamap nmap;
|
||||
parse_error_list_t pe;
|
||||
pe.file_ = name;
|
||||
eltlyy::parser parser(nmap, pe, env, result);
|
||||
parser.set_debug_level(debug);
|
||||
parser.parse();
|
||||
error_list = pe.list_;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Local Variables:
|
||||
// mode: c++
|
||||
// End:
|
||||
|
|
@ -1,187 +0,0 @@
|
|||
/* Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
** Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
** 02111-1307, USA.
|
||||
*/
|
||||
%option noyywrap
|
||||
%option prefix="eltlyy"
|
||||
%option outfile="lex.yy.c"
|
||||
|
||||
%{
|
||||
#include <string>
|
||||
#include <stack>
|
||||
#include "eltlparse/parsedecl.hh"
|
||||
|
||||
#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 automaton definitions part. */
|
||||
|
||||
<INITIAL>"=" return token::EQ;
|
||||
<IINTIAL>"accept" return token::ACC;
|
||||
<INITIAL>[tT][rR][uU][eE] {
|
||||
return token::CONST_TRUE;
|
||||
}
|
||||
<INITIAL>"(" return token::LPAREN;
|
||||
<INITIAL>")" return token::RPAREN;
|
||||
<INITIAL>"%" BEGIN(formula);
|
||||
|
||||
<INITIAL>"include" BEGIN(incl);
|
||||
|
||||
<INITIAL>[a-zA-Z][a-zA-Z0-9_]* {
|
||||
yylval->sval = new std::string(yytext, yyleng);
|
||||
return token::IDENT;
|
||||
}
|
||||
|
||||
<INITIAL>[0-9]+ {
|
||||
yylval->sval = new std::string(yytext, yyleng);
|
||||
return token::STATE;
|
||||
}
|
||||
|
||||
<INITIAL>$[0-9]+ {
|
||||
yylval->sval = new std::string(++yytext, --yyleng);
|
||||
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 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);
|
||||
}
|
||||
|
||||
/* Rules for the formula part. */
|
||||
|
||||
<formula>"(" return token::LPAREN;
|
||||
<formula>")" return token::RPAREN;
|
||||
<formula>"!" return token::OP_NOT;
|
||||
<formula>"," return token::COMMA;
|
||||
|
||||
|
||||
<formula>"1"|[tT][rR][uU][eE] {
|
||||
return token::CONST_TRUE;
|
||||
}
|
||||
<formula>"0"|[fF][aA][lL][sS][eE] {
|
||||
return token::CONST_FALSE;
|
||||
}
|
||||
|
||||
/* & and | come from Spin. && and || from LTL2BA.
|
||||
/\, \/, and xor are from LBTT.
|
||||
*/
|
||||
<formula>"||"|"|"|"+"|"\\/" {
|
||||
return token::OP_OR;
|
||||
}
|
||||
<formula>"&&"|"&"|"."|"*"|"/\\" {
|
||||
return token::OP_AND;
|
||||
}
|
||||
<formula>"^"|"xor" return token::OP_XOR;
|
||||
<formula>"=>"|"->" return token::OP_IMPLIES;
|
||||
<formula>"<=>"|"<->" return token::OP_EQUIV;
|
||||
|
||||
<formula>[a-zA-Z][a-zA-Z0-9_]* {
|
||||
yylval->sval = new std::string(yytext, yyleng);
|
||||
return token::ATOMIC_PROP;
|
||||
}
|
||||
|
||||
/* Global rules. */
|
||||
|
||||
/* 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
|
||||
eltlyyopen(const std::string &name)
|
||||
{
|
||||
if (name == "-")
|
||||
yyin = stdin;
|
||||
else
|
||||
{
|
||||
yyin = fopen(name.c_str(), "r");
|
||||
if (!yyin)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
eltlyyclose()
|
||||
{
|
||||
fclose(yyin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#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 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_ELTLPARSE_PARSEDECL_HH
|
||||
# define SPOT_ELTLPARSE_PARSEDECL_HH
|
||||
|
||||
#include "eltlparse.hh"
|
||||
#include "location.hh"
|
||||
|
||||
# define YY_DECL \
|
||||
int eltlyylex (eltlyy::parser::semantic_type *yylval, \
|
||||
eltlyy::location *yylloc, \
|
||||
spot::eltl::parse_error_list_t &pe)
|
||||
YY_DECL;
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
int eltlyyopen(const std::string& name);
|
||||
void eltlyyclose();
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_ELTLPARSE_PARSEDECL_HH
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
// Copyright (C) 2003, 2004, 2005, 2006, 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_ELTLPARSE_PUBLIC_HH
|
||||
# define SPOT_ELTLPARSE_PUBLIC_HH
|
||||
|
||||
# include "eltlast/formula.hh"
|
||||
// Unfortunately Bison 2.3 uses the same guards in all parsers :(
|
||||
# undef BISON_LOCATION_HH
|
||||
# undef BISON_POSITION_HH
|
||||
# include "eltlparse/location.hh"
|
||||
# include "eltlenv/defaultenv.hh"
|
||||
# include "eltlast/nfa.hh"
|
||||
# include <string>
|
||||
# include <list>
|
||||
# include <map>
|
||||
# include <utility>
|
||||
# include <iosfwd>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
/// \addtogroup eltl_io
|
||||
/// @{
|
||||
|
||||
typedef std::pair<std::string, std::string> spair;
|
||||
/// \brief A parse diagnostic <location, <file, message>>.
|
||||
typedef std::pair<eltlyy::location, spair> parse_error;
|
||||
/// \brief A list of parser diagnostics, as filled by parse.
|
||||
typedef std::list<parse_error> parse_error_list;
|
||||
|
||||
///
|
||||
typedef std::map<std::string, nfa::ptr> nfamap;
|
||||
|
||||
/// \brief Build a formula from a text file.
|
||||
/// \param name 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.
|
||||
formula* parse(const std::string& name,
|
||||
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 eltl_string The string that were parsed.
|
||||
/// \param error_list The error list filled by spot::eltl::parse while
|
||||
/// parsing \a eltl_string.
|
||||
/// \return \c true iff any diagnostic was output.
|
||||
bool
|
||||
format_parse_errors(std::ostream& os,
|
||||
parse_error_list& error_list);
|
||||
|
||||
/// @}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_ELTLPARSE_PUBLIC_HH
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
## Copyright (C) 2003, 2004, 2005, 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
## Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
## 02111-1307, USA.
|
||||
|
||||
AM_CPPFLAGS = -I$(srcdir)/.. $(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
|
||||
|
||||
CLEANFILES = \
|
||||
input \
|
||||
prelude
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
#include "eltlparse/public.hh"
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
spot::eltl::parse_error_list p;
|
||||
const spot::eltl::formula* f = spot::eltl::parse(
|
||||
argv[1], p, spot::eltl::default_environment::instance(), argc > 2);
|
||||
|
||||
if (spot::eltl::format_parse_errors(std::cerr, p))
|
||||
{
|
||||
if (f != 0)
|
||||
std::cout << f->dump() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
assert(f != 0);
|
||||
std::cout << f->dump() << std::endl;
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./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
|
||||
X=(
|
||||
0 1 true
|
||||
1 2 \$0
|
||||
accept 2
|
||||
)
|
||||
U=(
|
||||
0 0 \$0
|
||||
0 1 \$1
|
||||
accept 1
|
||||
)
|
||||
EOF
|
||||
|
||||
cat >input <<EOF
|
||||
A=(
|
||||
)
|
||||
%
|
||||
1
|
||||
EOF
|
||||
run 0 ./acc input || exit 1
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
# -*- shell-script -*-
|
||||
# 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# 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', be verbose.
|
||||
if test -z "$srcdir"; then
|
||||
test -z "$VERBOSE" && VERBOSE=x
|
||||
# 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
|
||||
}
|
||||
|
||||
# User can set VERBOSE to see all output.
|
||||
test -z "$VERBOSE" && exec >/dev/null 2>&1
|
||||
|
||||
echo "== Running test $0"
|
||||
|
||||
DOT='@DOT@'
|
||||
VALGRIND='@VALGRIND@'
|
||||
|
||||
run()
|
||||
{
|
||||
expected_exitcode=$1
|
||||
shift
|
||||
exitcode=0
|
||||
if test -n "$VALGRIND"; then
|
||||
exec 6>valgrind.err
|
||||
GLIBCPP_FORCE_NEW=1 \
|
||||
$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
|
||||
}
|
||||
|
||||
# Turn on shell traces when VERBOSE=x.
|
||||
if test "x$VERBOSE" = xx; then
|
||||
set -x
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include <iostream>
|
||||
#include "eltlast/nfa.hh"
|
||||
|
||||
using namespace spot::eltl;
|
||||
|
||||
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 << a.format_state((*i)->dest) << std::endl;
|
||||
dfs(a, (*i)->dest, m);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
nfa a;
|
||||
|
||||
a.add_transition("0", "1", 1);
|
||||
a.add_transition("1", "2", 2);
|
||||
|
||||
std::cout << "init: " << a.format_state(a.get_init_state()) << std::endl;
|
||||
|
||||
mset m;
|
||||
dfs(a, a.get_init_state(), m);
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./defs || exit 1
|
||||
|
||||
set -e
|
||||
run 0 ./nfa || exit 1
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
## Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
## Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
## 02111-1307, USA.
|
||||
|
||||
AM_CPPFLAGS = -I$(srcdir)/.. $(BUDDY_CPPFLAGS)
|
||||
AM_CXXFLAGS = $(WARNING_CXXFLAGS)
|
||||
|
||||
eltlvisitdir = $(pkgincludedir)/eltlvisit
|
||||
|
||||
eltlvisit_HEADERS = \
|
||||
clone.hh \
|
||||
destroy.hh \
|
||||
lunabbrev.hh \
|
||||
nenoform.hh \
|
||||
postfix.hh \
|
||||
tostring.hh
|
||||
|
||||
noinst_LTLIBRARIES = libeltlvisit.la
|
||||
libeltlvisit_la_SOURCES = \
|
||||
clone.cc \
|
||||
destroy.cc \
|
||||
lunabbrev.cc \
|
||||
nenoform.cc \
|
||||
postfix.cc \
|
||||
tostring.cc
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include "eltlast/automatop.hh"
|
||||
#include "clone.hh"
|
||||
#include "destroy.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
clone_visitor::clone_visitor()
|
||||
{
|
||||
}
|
||||
|
||||
clone_visitor::~clone_visitor()
|
||||
{
|
||||
}
|
||||
|
||||
formula*
|
||||
clone_visitor::result() const
|
||||
{
|
||||
return result_;
|
||||
}
|
||||
|
||||
void
|
||||
clone_visitor::visit(atomic_prop* ap)
|
||||
{
|
||||
result_ = ap->ref();
|
||||
}
|
||||
|
||||
void
|
||||
clone_visitor::visit(constant* c)
|
||||
{
|
||||
result_ = c->ref();
|
||||
}
|
||||
|
||||
void
|
||||
clone_visitor::visit(unop* uo)
|
||||
{
|
||||
result_ = unop::instance(uo->op(), recurse(uo->child()));
|
||||
}
|
||||
|
||||
void
|
||||
clone_visitor::visit(binop* bo)
|
||||
{
|
||||
result_ = binop::instance(bo->op(),
|
||||
recurse(bo->first()), recurse(bo->second()));
|
||||
}
|
||||
|
||||
void
|
||||
clone_visitor::visit(multop* mo)
|
||||
{
|
||||
multop::vec* res = new multop::vec;
|
||||
unsigned mos = mo->size();
|
||||
for (unsigned i = 0; i < mos; ++i)
|
||||
res->push_back(recurse(mo->nth(i)));
|
||||
result_ = multop::instance(mo->op(), res);
|
||||
}
|
||||
|
||||
formula*
|
||||
clone_visitor::recurse(formula* f)
|
||||
{
|
||||
return clone(f);
|
||||
}
|
||||
|
||||
void
|
||||
clone_visitor::visit(automatop* ao)
|
||||
{
|
||||
automatop::vec* res = new automatop::vec;
|
||||
for (unsigned i = 0; i < ao->size(); ++i)
|
||||
res->push_back(recurse(ao->nth(i)));
|
||||
result_ = automatop::instance(res);
|
||||
// FIXME: nfa clone !
|
||||
}
|
||||
|
||||
formula*
|
||||
clone(const formula* f)
|
||||
{
|
||||
clone_visitor v;
|
||||
const_cast<formula*>(f)->accept(v);
|
||||
return v.result();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_ELTLVISIT_CLONE_HH
|
||||
# define SPOT_ELTLVISIT_CLONE_HH
|
||||
|
||||
#include "eltlast/formula.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
/// \brief Clone a formula.
|
||||
/// \ingroup eltl_visitor
|
||||
///
|
||||
/// This visitor is public, because it's convenient to derive from
|
||||
/// it and override part of its methods. But if you just want the
|
||||
/// functionality, consider using spot::eltl::clone instead.
|
||||
class clone_visitor : public visitor
|
||||
{
|
||||
public:
|
||||
clone_visitor();
|
||||
virtual ~clone_visitor();
|
||||
|
||||
formula* result() const;
|
||||
|
||||
void visit(atomic_prop* ap);
|
||||
void visit(unop* uo);
|
||||
void visit(binop* bo);
|
||||
void visit(multop* mo);
|
||||
void visit(constant* c);
|
||||
void visit(automatop* ao);
|
||||
|
||||
virtual formula* recurse(formula* f);
|
||||
|
||||
protected:
|
||||
formula* result_;
|
||||
};
|
||||
|
||||
/// \brief Clone a formula.
|
||||
/// \ingroup eltl_essential
|
||||
formula* clone(const formula* f);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_ELTLVISIT_LUNABBREV_HH
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_ELTLVISIT_DESTROY_HH
|
||||
# define SPOT_ELTLVISIT_DESTROY_HH
|
||||
|
||||
#include "eltlvisit/postfix.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
/// \ingroup eltl_visitor
|
||||
///
|
||||
/// This visitor is public, because it's convenient to write the
|
||||
/// destroy method of the base_formula class. But if you just
|
||||
/// want the functionality, consider using spot::eltl::destroy
|
||||
/// instead.
|
||||
class destroy_visitor: public postfix_visitor
|
||||
{
|
||||
public:
|
||||
virtual void
|
||||
doit_default(formula* c);
|
||||
};
|
||||
|
||||
/// \brief Destroys a formula
|
||||
/// \ingroup eltl_essential
|
||||
void destroy(const formula *f);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_ELTLVISIT_DESTROY_HH
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include <cassert>
|
||||
#include "clone.hh"
|
||||
#include "destroy.hh"
|
||||
#include "lunabbrev.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
|
||||
unabbreviate_logic_visitor::unabbreviate_logic_visitor()
|
||||
{
|
||||
}
|
||||
|
||||
unabbreviate_logic_visitor::~unabbreviate_logic_visitor()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
unabbreviate_logic_visitor::visit(binop* bo)
|
||||
{
|
||||
formula* f1 = recurse(bo->first());
|
||||
formula* f2 = recurse(bo->second());
|
||||
|
||||
switch (bo->op())
|
||||
{
|
||||
/* f1 ^ f2 == (f1 & !f2) | (f2 & !f1) */
|
||||
case binop::Xor:
|
||||
result_ = multop::instance(multop::Or,
|
||||
multop::instance(multop::And, clone(f1),
|
||||
unop::instance(unop::Not,
|
||||
f2)),
|
||||
multop::instance(multop::And, clone(f2),
|
||||
unop::instance(unop::Not,
|
||||
f1)));
|
||||
return;
|
||||
/* f1 => f2 == !f1 | f2 */
|
||||
case binop::Implies:
|
||||
result_ = multop::instance(multop::Or,
|
||||
unop::instance(unop::Not, f1), f2);
|
||||
return;
|
||||
/* f1 <=> f2 == (f1 & f2) | (!f1 & !f2) */
|
||||
case binop::Equiv:
|
||||
result_ = multop::instance(multop::Or,
|
||||
multop::instance(multop::And,
|
||||
clone(f1), clone(f2)),
|
||||
multop::instance(multop::And,
|
||||
unop::instance(unop::Not,
|
||||
f1),
|
||||
unop::instance(unop::Not,
|
||||
f2)));
|
||||
return;
|
||||
default:
|
||||
result_ = binop::instance(bo->op(), f1, f2);
|
||||
return;
|
||||
}
|
||||
/* Unreachable code. */
|
||||
assert(0);
|
||||
}
|
||||
|
||||
formula*
|
||||
unabbreviate_logic_visitor::recurse(formula* f)
|
||||
{
|
||||
return unabbreviate_logic(f);
|
||||
}
|
||||
|
||||
formula*
|
||||
unabbreviate_logic(const formula* f)
|
||||
{
|
||||
unabbreviate_logic_visitor v;
|
||||
const_cast<formula*>(f)->accept(v);
|
||||
return v.result();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_ELTLVISIT_LUNABBREV_HH
|
||||
# define SPOT_ELTLVISIT_LUNABBREV_HH
|
||||
|
||||
#include "clone.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
/// \brief Clone and rewrite a formula to remove most of the
|
||||
/// abbreviated logical operators.
|
||||
/// \ingroup eltl_visitor
|
||||
///
|
||||
/// This will rewrite binary operators such as binop::Implies,
|
||||
/// binop::Equals, and binop::Xor, using only unop::Not,
|
||||
/// multop::Or, and multop::And.
|
||||
///
|
||||
/// This visitor is public, because it's convenient to derive from
|
||||
/// it and override some of its methods. But if you just want the
|
||||
/// functionality, consider using spot::ltl::unabbreviate_logic
|
||||
/// instead.
|
||||
class unabbreviate_logic_visitor : public clone_visitor
|
||||
{
|
||||
typedef clone_visitor super;
|
||||
public:
|
||||
unabbreviate_logic_visitor();
|
||||
virtual ~unabbreviate_logic_visitor();
|
||||
|
||||
using super::visit;
|
||||
void visit(binop* bo);
|
||||
|
||||
virtual formula* recurse(formula* f);
|
||||
};
|
||||
|
||||
/// \brief Clone and rewrite a formula to remove most of the
|
||||
/// abbreviated logical operators.
|
||||
/// \ingroup eltl_rewriting
|
||||
///
|
||||
/// This will rewrite binary operators such as binop::Implies,
|
||||
/// binop::Equals, and binop::Xor, using only unop::Not,
|
||||
/// multop::Or, and multop::And.
|
||||
formula* unabbreviate_logic(const formula* f);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_ELTLVISIT_LUNABBREV_HH
|
||||
|
|
@ -1,187 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include "nenoform.hh"
|
||||
#include "clone.hh"
|
||||
#include "destroy.hh"
|
||||
#include <cassert>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
namespace
|
||||
{
|
||||
class negative_normal_form_visitor: public visitor
|
||||
{
|
||||
public:
|
||||
negative_normal_form_visitor(bool negated)
|
||||
: negated_(negated)
|
||||
{
|
||||
}
|
||||
|
||||
virtual
|
||||
~negative_normal_form_visitor()
|
||||
{
|
||||
}
|
||||
|
||||
formula* result() const
|
||||
{
|
||||
return result_;
|
||||
}
|
||||
|
||||
void
|
||||
visit(atomic_prop* ap)
|
||||
{
|
||||
formula* f = ap->ref();
|
||||
if (negated_)
|
||||
result_ = unop::instance(unop::Not, f);
|
||||
else
|
||||
result_ = f;
|
||||
}
|
||||
|
||||
void
|
||||
visit(constant* c)
|
||||
{
|
||||
if (!negated_)
|
||||
{
|
||||
result_ = c;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (c->val())
|
||||
{
|
||||
case constant::True:
|
||||
result_ = constant::false_instance();
|
||||
return;
|
||||
case constant::False:
|
||||
result_ = constant::true_instance();
|
||||
return;
|
||||
}
|
||||
/* Unreachable code. */
|
||||
assert(0);
|
||||
}
|
||||
|
||||
void
|
||||
visit(unop* uo)
|
||||
{
|
||||
formula* f = uo->child();
|
||||
switch (uo->op())
|
||||
{
|
||||
case unop::Not:
|
||||
result_ = recurse_(f, negated_ ^ true);
|
||||
return;
|
||||
}
|
||||
/* Unreachable code. */
|
||||
assert(0);
|
||||
}
|
||||
|
||||
void
|
||||
visit(binop* bo)
|
||||
{
|
||||
formula* f1 = bo->first();
|
||||
formula* f2 = bo->second();
|
||||
switch (bo->op())
|
||||
{
|
||||
case binop::Xor:
|
||||
/* !(a ^ b) == a <=> b */
|
||||
result_ = binop::instance(negated_ ? binop::Equiv : binop::Xor,
|
||||
recurse_(f1, false),
|
||||
recurse_(f2, false));
|
||||
return;
|
||||
case binop::Equiv:
|
||||
/* !(a <=> b) == a ^ b */
|
||||
result_ = binop::instance(negated_ ? binop::Xor : binop::Equiv,
|
||||
recurse_(f1, false),
|
||||
recurse_(f2, false));
|
||||
return;
|
||||
case binop::Implies:
|
||||
if (negated_)
|
||||
/* !(a => b) == a & !b */
|
||||
result_ = multop::instance(multop::And,
|
||||
recurse_(f1, false),
|
||||
recurse_(f2, true));
|
||||
else
|
||||
result_ = binop::instance(binop::Implies,
|
||||
recurse(f1), recurse(f2));
|
||||
return;
|
||||
}
|
||||
/* Unreachable code. */
|
||||
assert(0);
|
||||
}
|
||||
|
||||
void
|
||||
visit(multop* mo)
|
||||
{
|
||||
/* !(a & b & c) == !a | !b | !c */
|
||||
/* !(a | b | c) == !a & !b & !c */
|
||||
multop::type op = mo->op();
|
||||
if (negated_)
|
||||
switch (op)
|
||||
{
|
||||
case multop::And:
|
||||
op = multop::Or;
|
||||
break;
|
||||
case multop::Or:
|
||||
op = multop::And;
|
||||
break;
|
||||
}
|
||||
multop::vec* res = new multop::vec;
|
||||
unsigned mos = mo->size();
|
||||
for (unsigned i = 0; i < mos; ++i)
|
||||
res->push_back(recurse(mo->nth(i)));
|
||||
result_ = multop::instance(op, res);
|
||||
}
|
||||
|
||||
void
|
||||
visit(automatop* ao)
|
||||
{
|
||||
(void) ao;
|
||||
}
|
||||
|
||||
formula*
|
||||
recurse_(formula* f, bool negated)
|
||||
{
|
||||
return negative_normal_form(f, negated);
|
||||
}
|
||||
|
||||
formula*
|
||||
recurse(formula* f)
|
||||
{
|
||||
return recurse_(f, negated_);
|
||||
}
|
||||
|
||||
protected:
|
||||
formula* result_;
|
||||
bool negated_;
|
||||
};
|
||||
}
|
||||
|
||||
formula*
|
||||
negative_normal_form(const formula* f, bool negated)
|
||||
{
|
||||
negative_normal_form_visitor v(negated);
|
||||
const_cast<formula*>(f)->accept(v);
|
||||
return v.result();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_ELTLVISIT_NENOFORM_HH
|
||||
# define SPOT_ELTLVISIT_NENOFORM_HH
|
||||
|
||||
#include "eltlast/formula.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
/// \brief Build the negative normal form of \a f.
|
||||
/// \ingroup eltl_rewriting
|
||||
///
|
||||
/// All negations of the formula are pushed in front of the
|
||||
/// atomic propositions.
|
||||
///
|
||||
/// \param f The formula to normalize.
|
||||
/// \param negated If \c true, return the negative normal form of
|
||||
/// \c !f
|
||||
///
|
||||
/// Note that this will not remove abbreviated operators. If you
|
||||
/// want to remove abbreviations, call
|
||||
/// spot::eltl::unabbreviate_logic first. (Calling these
|
||||
/// functions after spot::eltl::negative_normal_form would likely
|
||||
/// produce a formula which is not in negative normal form.)
|
||||
|
||||
formula* negative_normal_form(const formula* f, bool negated = false);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_ELTLVISIT_NENOFORM_HH
|
||||
|
|
@ -1,125 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include "eltlast/automatop.hh"
|
||||
#include "postfix.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
postfix_visitor::postfix_visitor()
|
||||
{
|
||||
}
|
||||
|
||||
postfix_visitor::~postfix_visitor()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
postfix_visitor::visit(atomic_prop* ap)
|
||||
{
|
||||
doit(ap);
|
||||
}
|
||||
|
||||
void
|
||||
postfix_visitor::visit(unop* uo)
|
||||
{
|
||||
uo->child()->accept(*this);
|
||||
doit(uo);
|
||||
}
|
||||
|
||||
void
|
||||
postfix_visitor::visit(binop* bo)
|
||||
{
|
||||
bo->first()->accept(*this);
|
||||
bo->second()->accept(*this);
|
||||
doit(bo);
|
||||
}
|
||||
|
||||
void
|
||||
postfix_visitor::visit(multop* mo)
|
||||
{
|
||||
unsigned s = mo->size();
|
||||
for (unsigned i = 0; i < s; ++i)
|
||||
mo->nth(i)->accept(*this);
|
||||
doit(mo);
|
||||
}
|
||||
|
||||
void
|
||||
postfix_visitor::visit(constant* c)
|
||||
{
|
||||
doit(c);
|
||||
}
|
||||
|
||||
void
|
||||
postfix_visitor::visit(automatop* ao)
|
||||
{
|
||||
unsigned s = ao->size();
|
||||
for (unsigned i = 0; i < s; ++i)
|
||||
ao->nth(i)->accept(*this);
|
||||
doit(ao);
|
||||
}
|
||||
|
||||
void
|
||||
postfix_visitor::doit(atomic_prop* ap)
|
||||
{
|
||||
doit_default(ap);
|
||||
}
|
||||
|
||||
void
|
||||
postfix_visitor::doit(unop* uo)
|
||||
{
|
||||
doit_default(uo);
|
||||
}
|
||||
|
||||
void
|
||||
postfix_visitor::doit(binop* bo)
|
||||
{
|
||||
doit_default(bo);
|
||||
}
|
||||
|
||||
void
|
||||
postfix_visitor::doit(multop* mo)
|
||||
{
|
||||
doit_default(mo);
|
||||
}
|
||||
|
||||
void
|
||||
postfix_visitor::doit(constant* c)
|
||||
{
|
||||
doit_default(c);
|
||||
}
|
||||
|
||||
void
|
||||
postfix_visitor::doit(automatop* c)
|
||||
{
|
||||
doit_default(c);
|
||||
}
|
||||
|
||||
void
|
||||
postfix_visitor::doit_default(formula* f)
|
||||
{
|
||||
(void)f;
|
||||
// Dummy implementation that does nothing.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_ELTLVISIT_POSTFIX_HH
|
||||
# define SPOT_ELTLVISIT_POSTFIX_HH
|
||||
|
||||
#include "eltlast/formula.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
/// \brief Apply an algorithm on each node of an AST,
|
||||
/// during a postfix traversal.
|
||||
/// \ingroup eltl_visitor
|
||||
///
|
||||
/// Override one or more of the postifix_visitor::doit methods
|
||||
/// with the algorithm to apply.
|
||||
class postfix_visitor : public visitor
|
||||
{
|
||||
public:
|
||||
postfix_visitor();
|
||||
virtual ~postfix_visitor();
|
||||
|
||||
void visit(atomic_prop* ap);
|
||||
void visit(unop* uo);
|
||||
void visit(binop* bo);
|
||||
void visit(multop* mo);
|
||||
void visit(constant* c);
|
||||
void visit(automatop* ao);
|
||||
|
||||
virtual void doit(atomic_prop* ap);
|
||||
virtual void doit(unop* uo);
|
||||
virtual void doit(binop* bo);
|
||||
virtual void doit(multop* mo);
|
||||
virtual void doit(constant* c);
|
||||
virtual void doit(automatop* ao);
|
||||
virtual void doit_default(formula* f);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_ELTLVISIT_POSTFIX_HH
|
||||
|
|
@ -1,198 +0,0 @@
|
|||
// Copyright (C) 2003, 2004, 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
#include <ctype.h>
|
||||
#include <ostream>
|
||||
#include <cstring>
|
||||
#include "tostring.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
namespace
|
||||
{
|
||||
static bool
|
||||
is_bare_word(const char* str)
|
||||
{
|
||||
// Bare words cannot be empty, start with the letter of a unary
|
||||
// operator, or be the name of an existing constant. Also they
|
||||
// should start with an letter.
|
||||
if (!*str
|
||||
|| *str == 'F'
|
||||
|| *str == 'G'
|
||||
|| *str == 'X'
|
||||
|| !(isalpha(*str) || *str == '_')
|
||||
|| !strcasecmp(str, "true")
|
||||
|| !strcasecmp(str, "false"))
|
||||
return false;
|
||||
// The remaining of the word must be alphanumeric.
|
||||
while (*++str)
|
||||
if (!(isalnum(*str) || *str == '_'))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
class to_string_visitor: public const_visitor
|
||||
{
|
||||
public:
|
||||
to_string_visitor(std::ostream& os)
|
||||
: os_(os), top_level_(true)
|
||||
{
|
||||
}
|
||||
|
||||
virtual
|
||||
~to_string_visitor()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
visit(const atomic_prop* ap)
|
||||
{
|
||||
std::string str = ap->name();
|
||||
if (!is_bare_word(str.c_str()))
|
||||
{
|
||||
os_ << '"' << str << '"';
|
||||
}
|
||||
else
|
||||
{
|
||||
os_ << str;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
visit(const constant* c)
|
||||
{
|
||||
os_ << c->val_name();
|
||||
}
|
||||
|
||||
void
|
||||
visit(const binop* bo)
|
||||
{
|
||||
bool top_level = top_level_;
|
||||
top_level_ = false;
|
||||
if (!top_level)
|
||||
os_ << "(";
|
||||
|
||||
bo->first()->accept(*this);
|
||||
|
||||
switch (bo->op())
|
||||
{
|
||||
case binop::Xor:
|
||||
os_ << " ^ ";
|
||||
break;
|
||||
case binop::Implies:
|
||||
os_ << " => ";
|
||||
break;
|
||||
case binop::Equiv:
|
||||
os_ << " <=> ";
|
||||
break;
|
||||
}
|
||||
|
||||
bo->second()->accept(*this);
|
||||
if (!top_level)
|
||||
os_ << ")";
|
||||
}
|
||||
|
||||
void
|
||||
visit(const unop* uo)
|
||||
{
|
||||
// The parser treats F0, F1, G0, G1, X0, and X1 as atomic
|
||||
// propositions. So make sure we output F(0), G(1), etc.
|
||||
bool need_parent = !!dynamic_cast<const constant*>(uo->child());
|
||||
switch (uo->op())
|
||||
{
|
||||
case unop::Not:
|
||||
os_ << "!";
|
||||
need_parent = false;
|
||||
break;
|
||||
}
|
||||
|
||||
top_level_ = false;
|
||||
if (need_parent)
|
||||
os_ << "(";
|
||||
uo->child()->accept(*this);
|
||||
if (need_parent)
|
||||
os_ << ")";
|
||||
}
|
||||
|
||||
void
|
||||
visit(const multop* mo)
|
||||
{
|
||||
bool top_level = top_level_;
|
||||
top_level_ = false;
|
||||
if (!top_level)
|
||||
os_ << "(";
|
||||
unsigned max = mo->size();
|
||||
mo->nth(0)->accept(*this);
|
||||
const char* ch = " ";
|
||||
switch (mo->op())
|
||||
{
|
||||
case multop::Or:
|
||||
ch = " | ";
|
||||
break;
|
||||
case multop::And:
|
||||
ch = " & ";
|
||||
break;
|
||||
}
|
||||
|
||||
for (unsigned n = 1; n < max; ++n)
|
||||
{
|
||||
os_ << ch;
|
||||
mo->nth(n)->accept(*this);
|
||||
}
|
||||
if (!top_level)
|
||||
os_ << ")";
|
||||
}
|
||||
|
||||
void
|
||||
visit(const automatop*)
|
||||
{
|
||||
// FIXME !
|
||||
os_ << "AP";
|
||||
}
|
||||
|
||||
protected:
|
||||
std::ostream& os_;
|
||||
bool top_level_;
|
||||
};
|
||||
|
||||
} // anonymous
|
||||
|
||||
std::ostream&
|
||||
to_string(const formula* f, std::ostream& os)
|
||||
{
|
||||
to_string_visitor v(os);
|
||||
f->accept(v);
|
||||
return os;
|
||||
}
|
||||
|
||||
std::string
|
||||
to_string(const formula* f)
|
||||
{
|
||||
std::ostringstream os;
|
||||
to_string(f, os);
|
||||
return os.str();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
// Copyright (C) 2003, 2004, 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_ELTLVISIT_TOSTRING_HH
|
||||
# define SPOT_ELTLVISIT_TOSTRING_HH
|
||||
|
||||
#include <iosfwd>
|
||||
#include "eltlast/formula.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
/// \addtogroup eltl_io
|
||||
/// @{
|
||||
|
||||
/// \brief Output a formula as a (parsable) string.
|
||||
/// \param f The formula to translate.
|
||||
/// \param os The stream where it should be output.
|
||||
std::ostream& to_string(const formula* f, std::ostream& os);
|
||||
|
||||
/// \brief Convert a formula into a (parsable) string.
|
||||
/// \param f The formula to translate.
|
||||
std::string to_string(const formula* f);
|
||||
|
||||
/// @}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_ELTLVISIT_TOSTRING_HH
|
||||
|
|
@ -86,10 +86,10 @@ namespace spot
|
|||
bdd low = bdd_low(one);
|
||||
if (low == bddfalse)
|
||||
{
|
||||
const internal::base_formula* v =
|
||||
const ltl::formula* v =
|
||||
automata_->get_dict()->var_formula_map[bdd_var(one)];
|
||||
res->add_transition(name_[in],
|
||||
v->to_string(),
|
||||
to_string(v),
|
||||
ss,
|
||||
name_[out]);
|
||||
break;
|
||||
|
|
@ -121,8 +121,8 @@ namespace spot
|
|||
bdd low = bdd_low(one);
|
||||
if (low == bddfalse)
|
||||
{
|
||||
const ltl::formula* v = dynamic_cast<const ltl::formula*>(
|
||||
automata_->get_dict()->acc_formula_map[bdd_var(one)]);
|
||||
const ltl::formula* v =
|
||||
automata_->get_dict()->acc_formula_map[bdd_var(one)];
|
||||
ss.insert(rsymbol(to_string(v)));
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include "ltlvisit/destroy.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include "ltlparse/public.hh"
|
||||
#include "evtgbaparse/public.hh"
|
||||
#include "evtgbaalgos/save.hh"
|
||||
|
|
|
|||
|
|
@ -1,52 +0,0 @@
|
|||
## Copyright (C) 2003 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
## Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
## 02111-1307, USA.
|
||||
|
||||
AM_CPPFLAGS = -I$(srcdir)/..
|
||||
AM_CXXFLAGS = $(WARNING_CXXFLAGS)
|
||||
|
||||
internaldir = $(pkgincludedir)/internal
|
||||
|
||||
internal_HEADERS = \
|
||||
baseformula.hh \
|
||||
refformula.hh \
|
||||
refformula.hxx \
|
||||
formula.hh \
|
||||
formula.hxx \
|
||||
atomic_prop.hh \
|
||||
atomic_prop.hxx \
|
||||
binop.hh \
|
||||
binop.hxx \
|
||||
constant.hh \
|
||||
constant.hxx \
|
||||
multop.hh \
|
||||
multop.hxx \
|
||||
predecl.hh \
|
||||
unop.hh \
|
||||
unop.hxx \
|
||||
defaultenv.hh \
|
||||
defaultenv.hxx \
|
||||
declenv.hh \
|
||||
declenv.hxx \
|
||||
environment.hh
|
||||
|
||||
noinst_LTLIBRARIES = libinternal.la
|
||||
libinternal_la_SOURCES = \
|
||||
baseformula.cc
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
// Copyright (C) 2003, 2004, 2005, 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
/// \file internal/atomic_prop.hxx
|
||||
/// \brief Generic atomic propositions implementation
|
||||
#ifndef SPOT_INTERNAL_ATOMIC_PROP_HXX
|
||||
# define SPOT_INTERNAL_ATOMIC_PROP_HXX
|
||||
|
||||
#include "atomic_prop.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
|
||||
template<typename T>
|
||||
atomic_prop<T>::atomic_prop(const std::string& name, environment<T>& env)
|
||||
: name_(name), env_(&env)
|
||||
{
|
||||
this->dump_ = "AP(" + name + ")";
|
||||
this->set_key_();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
atomic_prop<T>::~atomic_prop()
|
||||
{
|
||||
// Get this instance out of the instance map.
|
||||
pair p(name(), &env());
|
||||
typename map::iterator i = instances.find(p);
|
||||
assert (i != instances.end());
|
||||
instances.erase(i);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
atomic_prop<T>::accept(visitor& v)
|
||||
{
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
atomic_prop<T>::accept(const_visitor& v) const
|
||||
{
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const std::string&
|
||||
atomic_prop<T>::name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
environment<T>&
|
||||
atomic_prop<T>::env() const
|
||||
{
|
||||
return *env_;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename atomic_prop<T>::map atomic_prop<T>::instances;
|
||||
|
||||
template<typename T>
|
||||
atomic_prop<T>*
|
||||
atomic_prop<T>::instance(const std::string& name, environment<T>& env)
|
||||
{
|
||||
pair p(name, &env);
|
||||
typename map::iterator i = instances.find(p);
|
||||
if (i != instances.end())
|
||||
{
|
||||
return static_cast<atomic_prop<T>*>(i->second->ref());
|
||||
}
|
||||
atomic_prop<T>* ap = new atomic_prop<T>(name, env);
|
||||
instances[p] = ap;
|
||||
return static_cast<atomic_prop<T>*>(ap->ref());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
unsigned
|
||||
atomic_prop<T>::instance_count()
|
||||
{
|
||||
return instances.size();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::ostream&
|
||||
atomic_prop<T>::dump_instances(std::ostream& os)
|
||||
{
|
||||
|
||||
for (typename map::iterator i = instances.begin();
|
||||
i != instances.end(); ++i)
|
||||
{
|
||||
os << i->second << " = " << i->second->ref_count_()
|
||||
<< " * atomic_prop(" << i->first.first << ", "
|
||||
<< i->first.second->name() << ")" << std::endl;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_INTERNAL_ATOMICPROP_HXX
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
// Copyright (C) 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_INTERNAL_BASEFORMULA_HH
|
||||
# define SPOT_INTERNAL_BASEFORMULA_HH
|
||||
|
||||
# include <cassert>
|
||||
# include "misc/hash.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
class base_formula
|
||||
{
|
||||
public:
|
||||
/// \brief Output a formula as a (parsable) string.
|
||||
std::string to_string() const;
|
||||
|
||||
/// Some visitors virtual versions (LTL | ELTL).
|
||||
virtual base_formula* clone() const = 0;
|
||||
virtual std::ostream& to_string(std::ostream& os) const = 0;
|
||||
virtual void destroy() const = 0;
|
||||
|
||||
/// Return a canonic representation of the formula
|
||||
const std::string& dump() const;
|
||||
/// Return a hash_key for the formula.
|
||||
size_t hash() const;
|
||||
protected:
|
||||
virtual ~base_formula() {};
|
||||
/// \brief Compute key_ from dump_.
|
||||
///
|
||||
/// Should be called once in each object, after dump_ has been set.
|
||||
void set_key_();
|
||||
/// The canonic representation of the formula
|
||||
std::string dump_;
|
||||
/// \brief The hash key of this formula.
|
||||
///
|
||||
/// Initialized by set_key_().
|
||||
size_t hash_key_;
|
||||
};
|
||||
|
||||
/// \brief Strict Weak Ordering for <code>const base_formula*</code>.
|
||||
/// \ingroup generic_essentials
|
||||
///
|
||||
/// This is meant to be used as a comparison functor for STL
|
||||
/// \c map whose key are of type <code>const base_formula*</code>.
|
||||
///
|
||||
/// For instance here is how one could declare
|
||||
/// a map of \c const::base_formula*.
|
||||
/// \code
|
||||
/// // Remember how many times each formula has been seen.
|
||||
/// std::map<const spot::internal::base_formula*, int,
|
||||
/// spot::internal::formula_ptr_less_than> seen;
|
||||
/// \endcode
|
||||
struct formula_ptr_less_than:
|
||||
public std::binary_function<const base_formula*,
|
||||
const base_formula*, bool>
|
||||
{
|
||||
bool
|
||||
operator()(const base_formula* left, const base_formula* right) const
|
||||
{
|
||||
assert(left);
|
||||
assert(right);
|
||||
size_t l = left->hash();
|
||||
size_t r = right->hash();
|
||||
if (1 != r)
|
||||
return l < r;
|
||||
return left->dump() < right->dump();
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Hash Function for <code>const formula*</code>.
|
||||
/// \ingroup generic_essentials
|
||||
/// \ingroup hash_funcs
|
||||
///
|
||||
/// This is meant to be used as a hash functor for Sgi's
|
||||
/// \c hash_map whose key are of type <code>const base_formula*</code>.
|
||||
///
|
||||
/// For instance here is how one could declare
|
||||
/// a map of \c const::base_formula*.
|
||||
/// \code
|
||||
/// // Remember how many times each formula has been seen.
|
||||
/// Sgi::hash_map<const spot::internal::base_formula*, int,
|
||||
/// const spot::internal::formula_ptr_hash> seen;
|
||||
/// \endcode
|
||||
struct formula_ptr_hash:
|
||||
public std::unary_function<const base_formula*, size_t>
|
||||
{
|
||||
size_t
|
||||
operator()(const base_formula* that) const
|
||||
{
|
||||
assert(that);
|
||||
return that->hash();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_INTERNAL_BASEFORMULA_HH
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
// Copyright (C) 2004 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_INTERNAL_DECLENV_HH
|
||||
# define SPOT_INTERNAL_DECLENV_HH
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "atomic_prop.hh"
|
||||
#include "environment.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
|
||||
/// \brief A declarative environment.
|
||||
/// \ingroup generic_environment
|
||||
///
|
||||
/// This environment recognizes all atomic propositions
|
||||
/// that have been previously declared. It will reject other.
|
||||
template<typename T>
|
||||
class declarative_environment : public environment<T>
|
||||
{
|
||||
public:
|
||||
declarative_environment();
|
||||
~declarative_environment();
|
||||
|
||||
/// Declare an atomic proposition. Return false iff the
|
||||
/// proposition was already declared.
|
||||
bool declare(const std::string& prop_str);
|
||||
|
||||
virtual formula<T>* require(const std::string& prop_str);
|
||||
|
||||
/// Get the name of the environment.
|
||||
virtual const std::string& name();
|
||||
|
||||
typedef std::map<const std::string, atomic_prop<T>*> prop_map;
|
||||
|
||||
/// Get the map of atomic proposition known to this environment.
|
||||
const prop_map& get_prop_map() const;
|
||||
|
||||
private:
|
||||
prop_map props_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#include "declenv.hxx"
|
||||
|
||||
#endif // SPOT_INTERNAL_DECLENV_HH
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
// Copyright (C) 2004, 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_INTERNAL_DECLENV_HXX
|
||||
# define SPOT_INTERNAL_DECLENV_HXX
|
||||
|
||||
#include "declenv.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
|
||||
template<typename T>
|
||||
declarative_environment<T>::declarative_environment()
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
declarative_environment<T>::~declarative_environment()
|
||||
{
|
||||
// FIXME !!
|
||||
// for (prop_map::iterator i = props_.begin(); i != props_.end(); ++i)
|
||||
// ltl::destroy(i->second);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool
|
||||
declarative_environment<T>::declare(const std::string& prop_str)
|
||||
{
|
||||
if (props_.find(prop_str) != props_.end())
|
||||
return false;
|
||||
props_[prop_str] = internal::atomic_prop<T>::instance(prop_str, *this);
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
formula<T>*
|
||||
declarative_environment<T>::require(const std::string& prop_str)
|
||||
{
|
||||
typename prop_map::iterator i = props_.find(prop_str);
|
||||
if (i == props_.end())
|
||||
return 0;
|
||||
// It's an atomic_prop, so we do not have to use the clone() visitor.
|
||||
return i->second->ref();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const std::string&
|
||||
declarative_environment<T>::name()
|
||||
{
|
||||
static std::string name("declarative environment");
|
||||
return name;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const typename declarative_environment<T>::prop_map&
|
||||
declarative_environment<T>::get_prop_map() const
|
||||
{
|
||||
return props_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_INTERNAL_DECLENV_HXX
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
// Copyright (C) 2003, 2004, 2005 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_INTERNAL_DEFAULTENV_HH
|
||||
# define SPOT_INTERNAL_DEFAULTENV_HH
|
||||
|
||||
#include "atomic_prop.hh"
|
||||
#include "environment.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
|
||||
/// \brief A laxist environment.
|
||||
/// \ingroup generic_environment
|
||||
///
|
||||
/// This environment recognizes all atomic propositions.
|
||||
///
|
||||
/// This is a singleton. Use default_environment<T>::instance()
|
||||
/// to obtain the instance.
|
||||
template<typename T>
|
||||
class default_environment : public environment<T>
|
||||
{
|
||||
public:
|
||||
virtual ~default_environment();
|
||||
virtual formula<T>* require(const std::string& prop_str);
|
||||
virtual const std::string& name();
|
||||
|
||||
/// Get the sole instance of spot::internal::default_environment<T>.
|
||||
static default_environment<T>& instance();
|
||||
protected:
|
||||
default_environment();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#include "defaultenv.hxx"
|
||||
|
||||
#endif // SPOT_INTERNAL_DEFAULTENV_HH
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
// Copyright (C) 2003 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_INTERNAL_DEFAULTENV_HXX
|
||||
# define SPOT_INTERNAL_DEFAULTENV_HXX
|
||||
|
||||
#include "defaultenv.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
|
||||
template<typename T>
|
||||
default_environment<T>::~default_environment()
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
formula<T>*
|
||||
default_environment<T>::require(const std::string& s)
|
||||
{
|
||||
return atomic_prop<T>::instance(s, *this);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const std::string&
|
||||
default_environment<T>::name()
|
||||
{
|
||||
static std::string name("default environment");
|
||||
return name;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
default_environment<T>::default_environment()
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
default_environment<T>&
|
||||
default_environment<T>::instance()
|
||||
{
|
||||
static default_environment<T>* singleton = new default_environment<T>();
|
||||
return *singleton;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_INTERNAL_DEFAULTENV_HXX
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
// Copyright (C) 2003, 2004 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#ifndef SPOT_INTERNAL_ENVIRONMENT_HH
|
||||
# define SPOT_INTERNAL_ENVIRONMENT_HH
|
||||
|
||||
# include "formula.hh"
|
||||
# include <string>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
/// \brief An environment that describes atomic propositions.
|
||||
/// \ingroup generic_essential
|
||||
template<typename T>
|
||||
class environment
|
||||
{
|
||||
public:
|
||||
/// \brief Obtain the formula associated to \a prop_str
|
||||
///
|
||||
/// Usually \a prop_str, is the name of an atomic proposition,
|
||||
/// and spot::internal::require simply returns the associated
|
||||
/// spot::internal::atomic_prop<T>.
|
||||
///
|
||||
/// Note this is not a \c const method. Some environments will
|
||||
/// "create" the atomic proposition when requested.
|
||||
///
|
||||
/// We return a spot::internal::formula<T> instead of an
|
||||
/// spot::internal::atomic_prop<T>, because this
|
||||
/// will allow nifty tricks (e.g., we could name formulae in an
|
||||
/// environment, and let the parser build a larger tree from
|
||||
/// these).
|
||||
///
|
||||
/// \return 0 iff \a prop_str is not part of the environment,
|
||||
/// or the associated spot::internal::formula<T> otherwise.
|
||||
virtual formula<T>* require(const std::string& prop_str) = 0;
|
||||
|
||||
/// Get the name of the environment.
|
||||
virtual const std::string& name() = 0;
|
||||
|
||||
virtual
|
||||
~environment()
|
||||
{
|
||||
}
|
||||
|
||||
// FIXME: More functions will be needed later, but
|
||||
// it's enough for now.
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_INTERNAL_ENVIRONMENT_HH
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
// Copyright (C) 2003, 2004, 2005, 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
/// \file internal/formula.hh
|
||||
/// \brief Generic formula interface
|
||||
#ifndef SPOT_INTERNAL_FORMULA_HH
|
||||
# define SPOT_INTERNAL_FORMULA_HH
|
||||
|
||||
# include "predecl.hh"
|
||||
# include "baseformula.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
/// \brief A Generic formula.
|
||||
/// \ingroup generic_essential
|
||||
/// \ingroup generic_ast
|
||||
///
|
||||
/// The only way you can work with a formula is to
|
||||
/// build a T::visitor or T::const_visitor.
|
||||
template<typename T>
|
||||
class formula : public T, public base_formula
|
||||
{
|
||||
public:
|
||||
typedef typename T::visitor visitor;
|
||||
typedef typename T::const_visitor const_visitor;
|
||||
|
||||
virtual base_formula* clone() const;
|
||||
virtual std::ostream& to_string(std::ostream& os) const;
|
||||
virtual void destroy() const;
|
||||
|
||||
/// Entry point for T::visitor instances.
|
||||
virtual void accept(visitor& v) = 0;
|
||||
/// Entry point for T::const_visitor instances.
|
||||
virtual void accept(const_visitor& v) const = 0;
|
||||
|
||||
/// \brief clone this node
|
||||
///
|
||||
/// This increments the reference counter of this node (if one is
|
||||
/// used). You should almost never use this method directly as
|
||||
/// it doesn't touch the children. If you want to clone a
|
||||
/// whole formula, use a clone visitor instead.
|
||||
formula<T>* ref();
|
||||
/// \brief release this node
|
||||
///
|
||||
/// This decrements the reference counter of this node (if one is
|
||||
/// used) and can free the object. You should almost never use
|
||||
/// this method directly as it doesn't touch the children. If you
|
||||
/// want to release a whole formula, use a destroy() visitor instead.
|
||||
static void unref(formula<T>* f);
|
||||
protected:
|
||||
virtual ~formula();
|
||||
|
||||
/// \brief increment reference counter if any
|
||||
virtual void ref_();
|
||||
/// \brief decrement reference counter if any, return true when
|
||||
/// the instance must be deleted (usually when the counter hits 0).
|
||||
virtual bool unref_();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
# include "formula.hxx"
|
||||
|
||||
#endif // SPOT_INTERNAL_FORMULA_HH
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
// Copyright (C) 2003, 2005, 2008 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
/// \file internal/formula.hxx
|
||||
/// \brief Generic formula implementation
|
||||
#ifndef SPOT_INTERNAL_FORMULA_HXX
|
||||
# define SPOT_INTERNAL_FORMULA_HXX
|
||||
|
||||
#include "formula.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
template<typename T>
|
||||
formula<T>*
|
||||
formula<T>::ref()
|
||||
{
|
||||
ref_();
|
||||
return this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
formula<T>::~formula()
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
formula<T>::unref(formula<T>* f)
|
||||
{
|
||||
if (f->unref_())
|
||||
delete f;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
formula<T>::ref_()
|
||||
{
|
||||
// Not reference counted by default.
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool
|
||||
formula<T>::unref_()
|
||||
{
|
||||
// Not reference counted by default.
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
base_formula*
|
||||
formula<T>::clone() const
|
||||
{
|
||||
return T::clone_(this);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::ostream&
|
||||
formula<T>::to_string(std::ostream& os) const
|
||||
{
|
||||
return T::to_string_(this, os);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
formula<T>::destroy() const
|
||||
{
|
||||
T::destroy_(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_INTERNAL_FORMULA_HXX
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
## Copyright (C) 2003, 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
## Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
## département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
## et Marie Curie.
|
||||
##
|
||||
|
|
@ -19,6 +19,29 @@
|
|||
## Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
## 02111-1307, USA.
|
||||
|
||||
AM_CPPFLAGS = -I$(srcdir)/..
|
||||
AM_CXXFLAGS = $(WARNING_CXXFLAGS)
|
||||
|
||||
ltlastdir = $(pkgincludedir)/ltlast
|
||||
|
||||
ltlast_HEADERS = formula.hh
|
||||
ltlast_HEADERS = \
|
||||
allnodes.hh \
|
||||
atomic_prop.hh \
|
||||
binop.hh \
|
||||
constant.hh \
|
||||
formula.hh \
|
||||
multop.hh \
|
||||
predecl.hh \
|
||||
refformula.hh \
|
||||
unop.hh \
|
||||
visitor.hh
|
||||
|
||||
noinst_LTLIBRARIES = libltlast.la
|
||||
libltlast_la_SOURCES = \
|
||||
atomic_prop.cc \
|
||||
binop.cc \
|
||||
constant.cc \
|
||||
formula.cc \
|
||||
multop.cc \
|
||||
refformula.cc \
|
||||
unop.cc
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -19,24 +19,19 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include "eltlvisit/destroy.hh"
|
||||
#include "eltlvisit/clone.hh"
|
||||
/// \file ltlast/allnodes.hh
|
||||
/// \brief Define all LTL node types.
|
||||
///
|
||||
/// This file is usually needed when \b defining a visitor.
|
||||
/// Prefer ltlast/predecl.hh when only \b declaring methods and functions
|
||||
/// over LTL nodes.
|
||||
#ifndef SPOT_LTLAST_ALLNODES_HH
|
||||
# define SPOT_LTLAST_ALLNODES_HH
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace eltl
|
||||
{
|
||||
void
|
||||
destroy_visitor::doit_default(formula* c)
|
||||
{
|
||||
formula::unref(c);
|
||||
}
|
||||
# include "binop.hh"
|
||||
# include "unop.hh"
|
||||
# include "multop.hh"
|
||||
# include "atomic_prop.hh"
|
||||
# include "constant.hh"
|
||||
|
||||
void
|
||||
destroy(const formula* f)
|
||||
{
|
||||
destroy_visitor v;
|
||||
const_cast<formula*>(f)->accept(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // SPOT_LTLAST_ALLNODES_HH
|
||||
108
src/ltlast/atomic_prop.cc
Normal file
108
src/ltlast/atomic_prop.cc
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
// Copyright (C) 2003, 2004, 2005 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include "atomic_prop.hh"
|
||||
#include "visitor.hh"
|
||||
#include <cassert>
|
||||
#include <ostream>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace ltl
|
||||
{
|
||||
|
||||
atomic_prop::atomic_prop(const std::string& name, environment& env)
|
||||
: name_(name), env_(&env)
|
||||
{
|
||||
dump_ = "AP(" + name + ")";
|
||||
set_key_();
|
||||
}
|
||||
|
||||
atomic_prop::~atomic_prop()
|
||||
{
|
||||
// Get this instance out of the instance map.
|
||||
pair p(name(), &env());
|
||||
map::iterator i = instances.find(p);
|
||||
assert (i != instances.end());
|
||||
instances.erase(i);
|
||||
}
|
||||
|
||||
void
|
||||
atomic_prop::accept(visitor& v)
|
||||
{
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
void
|
||||
atomic_prop::accept(const_visitor& v) const
|
||||
{
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
const std::string&
|
||||
atomic_prop::name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
environment&
|
||||
atomic_prop::env() const
|
||||
{
|
||||
return *env_;
|
||||
}
|
||||
|
||||
atomic_prop::map atomic_prop::instances;
|
||||
|
||||
atomic_prop*
|
||||
atomic_prop::instance(const std::string& name, environment& env)
|
||||
{
|
||||
pair p(name, &env);
|
||||
map::iterator i = instances.find(p);
|
||||
if (i != instances.end())
|
||||
{
|
||||
return static_cast<atomic_prop*>(i->second->ref());
|
||||
}
|
||||
atomic_prop* ap = new atomic_prop(name, env);
|
||||
instances[p] = ap;
|
||||
return static_cast<atomic_prop*>(ap->ref());
|
||||
}
|
||||
|
||||
unsigned
|
||||
atomic_prop::instance_count()
|
||||
{
|
||||
return instances.size();
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
atomic_prop::dump_instances(std::ostream& os)
|
||||
{
|
||||
|
||||
for (map::iterator i = instances.begin(); i != instances.end(); ++i)
|
||||
{
|
||||
os << i->second << " = " << i->second->ref_count_()
|
||||
<< " * atomic_prop(" << i->first.first << ", "
|
||||
<< i->first.second->name() << ")" << std::endl;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2003, 2004, 2008 Laboratoire d'Informatique de Paris
|
||||
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
||||
// Université Pierre et Marie Curie.
|
||||
// Copyright (C) 2003, 2004 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.
|
||||
//
|
||||
|
|
@ -19,37 +19,30 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
/// \file internal/atomic_prop.hh
|
||||
/// \brief Generic atomic propositions
|
||||
#ifndef SPOT_INTERNAL_ATOMIC_PROP_HH
|
||||
# define SPOT_INTERNAL_ATOMIC_PROP_HH
|
||||
/// \file ltlast/atomic_prop.hh
|
||||
/// \brief LTL atomic propositions
|
||||
#ifndef SPOT_LTLAST_ATOMIC_PROP_HH
|
||||
# define SPOT_LTLAST_ATOMIC_PROP_HH
|
||||
|
||||
#include <string>
|
||||
#include <iosfwd>
|
||||
#include <map>
|
||||
#include <cassert>
|
||||
#include <ostream>
|
||||
#include "refformula.hh"
|
||||
#include "environment.hh"
|
||||
#include "ltlenv/environment.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
namespace ltl
|
||||
{
|
||||
|
||||
/// \brief Atomic propositions.
|
||||
/// \ingroup generic_ast
|
||||
template<typename T>
|
||||
class atomic_prop : public ref_formula<T>
|
||||
/// \ingroup ltl_ast
|
||||
class atomic_prop : public ref_formula
|
||||
{
|
||||
public:
|
||||
/// Build an atomic proposition with name \a name in
|
||||
/// environment \a env.
|
||||
static atomic_prop<T>* instance(const std::string& name,
|
||||
environment<T>& env);
|
||||
|
||||
typedef typename T::visitor visitor;
|
||||
typedef typename T::const_visitor const_visitor;
|
||||
static atomic_prop* instance(const std::string& name, environment& env);
|
||||
|
||||
virtual void accept(visitor& visitor);
|
||||
virtual void accept(const_visitor& visitor) const;
|
||||
|
|
@ -57,7 +50,7 @@ namespace spot
|
|||
/// Get the name of the atomic proposition.
|
||||
const std::string& name() const;
|
||||
/// Get the environment of the atomic proposition.
|
||||
environment<T>& env() const;
|
||||
environment& env() const;
|
||||
|
||||
/// Number of instantiated atomic propositions. For debugging.
|
||||
static unsigned instance_count();
|
||||
|
|
@ -65,21 +58,19 @@ namespace spot
|
|||
static std::ostream& dump_instances(std::ostream& os);
|
||||
|
||||
protected:
|
||||
atomic_prop(const std::string& name, environment<T>& env);
|
||||
atomic_prop(const std::string& name, environment& env);
|
||||
virtual ~atomic_prop();
|
||||
|
||||
typedef std::pair<std::string, environment<T>*> pair;
|
||||
typedef std::map<pair, atomic_prop<T>*> map;
|
||||
typedef std::pair<std::string, environment*> pair;
|
||||
typedef std::map<pair, atomic_prop*> map;
|
||||
static map instances;
|
||||
|
||||
private:
|
||||
std::string name_;
|
||||
environment<T>* env_;
|
||||
environment* env_;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
# include "atomic_prop.hxx"
|
||||
|
||||
#endif // SPOT_INTERNAL_ATOMICPROP_HH
|
||||
#endif // SPOT_LTLAST_ATOMICPROP_HH
|
||||
|
|
@ -19,138 +19,135 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
/// \file internal/binop.hxx
|
||||
/// \brief Generic binary operators implementation
|
||||
#ifndef SPOT_INTERNAL_BINOP_HXX
|
||||
# define SPOT_INTERNAL_BINOP_HXX
|
||||
|
||||
#include <cassert>
|
||||
#include <utility>
|
||||
#include "binop.hh"
|
||||
#include "visitor.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
namespace ltl
|
||||
{
|
||||
template<typename T>
|
||||
binop<T>::binop(type op, formula<T>* first, formula<T>* second)
|
||||
binop::binop(type op, formula* first, formula* second)
|
||||
: op_(op), first_(first), second_(second)
|
||||
{
|
||||
this->dump_ = "binop(";
|
||||
this->dump_ += op_name();
|
||||
this->dump_ += ", " + first->dump() + ", " + second->dump() + ")";
|
||||
this->set_key_();
|
||||
dump_ = "binop(";
|
||||
dump_ += op_name();
|
||||
dump_ += ", " + first->dump() + ", " + second->dump() + ")";
|
||||
set_key_();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
binop<T>::~binop()
|
||||
binop::~binop()
|
||||
{
|
||||
// Get this instance out of the instance map.
|
||||
pairf pf(first(), second());
|
||||
pair p(op(), pf);
|
||||
typename map::iterator i = instances.find(p);
|
||||
map::iterator i = instances.find(p);
|
||||
assert (i != instances.end());
|
||||
instances.erase(i);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
binop<T>::accept(visitor& v)
|
||||
binop::accept(visitor& v)
|
||||
{
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
binop<T>::accept(const_visitor& v) const
|
||||
binop::accept(const_visitor& v) const
|
||||
{
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const formula<T>*
|
||||
binop<T>::first() const
|
||||
const formula*
|
||||
binop::first() const
|
||||
{
|
||||
return first_;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
formula<T>*
|
||||
binop<T>::first()
|
||||
formula*
|
||||
binop::first()
|
||||
{
|
||||
return first_;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const formula<T>*
|
||||
binop<T>::second() const
|
||||
const formula*
|
||||
binop::second() const
|
||||
{
|
||||
return second_;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
formula<T>*
|
||||
binop<T>::second()
|
||||
formula*
|
||||
binop::second()
|
||||
{
|
||||
return second_;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename binop<T>::type
|
||||
binop<T>::op() const
|
||||
binop::type
|
||||
binop::op() const
|
||||
{
|
||||
return op_;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const char*
|
||||
binop<T>::op_name() const
|
||||
binop::op_name() const
|
||||
{
|
||||
return T::binop_name(op_);
|
||||
switch (op_)
|
||||
{
|
||||
case Xor:
|
||||
return "Xor";
|
||||
case Implies:
|
||||
return "Implies";
|
||||
case Equiv:
|
||||
return "Equiv";
|
||||
case U:
|
||||
return "U";
|
||||
case R:
|
||||
return "R";
|
||||
}
|
||||
// Unreachable code.
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename binop<T>::map binop<T>::instances;
|
||||
binop::map binop::instances;
|
||||
|
||||
template<typename T>
|
||||
binop<T>*
|
||||
binop<T>::instance(type op, formula<T>* first, formula<T>* second)
|
||||
binop*
|
||||
binop::instance(type op, formula* first, formula* second)
|
||||
{
|
||||
// Sort the operands of associative operators, so that for
|
||||
// example the formula instance for 'a xor b' is the same as
|
||||
// that for 'b xor a'.
|
||||
switch (op)
|
||||
{
|
||||
case T::Xor:
|
||||
case T::Equiv:
|
||||
{
|
||||
case Xor:
|
||||
case Equiv:
|
||||
if (second < first)
|
||||
std::swap(first, second);
|
||||
break;
|
||||
case T::Implies:
|
||||
// case U:
|
||||
// case R:
|
||||
// // Non associative operators.
|
||||
default:
|
||||
case Implies:
|
||||
case U:
|
||||
case R:
|
||||
// Non associative operators.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pairf pf(first, second);
|
||||
pair p(op, pf);
|
||||
typename map::iterator i = instances.find(p);
|
||||
map::iterator i = instances.find(p);
|
||||
if (i != instances.end())
|
||||
{
|
||||
return static_cast<binop<T>*>(i->second->ref());
|
||||
return static_cast<binop*>(i->second->ref());
|
||||
}
|
||||
binop<T>* ap = new binop<T>(op, first, second);
|
||||
binop* ap = new binop(op, first, second);
|
||||
instances[p] = ap;
|
||||
return static_cast<binop<T>*>(ap->ref());
|
||||
return static_cast<binop*>(ap->ref());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
unsigned
|
||||
binop<T>::instance_count()
|
||||
binop::instance_count()
|
||||
{
|
||||
return instances.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_INTERNAL_BINOP_HXX
|
||||
|
|
@ -19,54 +19,48 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
/// \file internal/binop.hh
|
||||
/// \brief Generic binary operators
|
||||
/// \file ltlast/binop.hh
|
||||
/// \brief LTL binary operators
|
||||
///
|
||||
/// This does not include \c AND and \c OR operators. These are
|
||||
/// considered to be multi-operand operators (see spot::internal::multop).
|
||||
#ifndef SPOT_INTERNAL_BINOP_HH
|
||||
# define SPOT_INTERNAL_BINOP_HH
|
||||
/// considered to be multi-operand operators (see spot::ltl::multop).
|
||||
#ifndef SPOT_LTLAST_BINOP_HH
|
||||
# define SPOT_LTLAST_BINOP_HH
|
||||
|
||||
#include <map>
|
||||
#include "refformula.hh"
|
||||
#include <cassert>
|
||||
#include <utility>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
namespace ltl
|
||||
{
|
||||
|
||||
/// \brief Generic binary operator.
|
||||
/// \ingroup generic_ast
|
||||
template<typename T>
|
||||
class binop : public ref_formula<T>
|
||||
/// \brief Binary operator.
|
||||
/// \ingroup ltl_ast
|
||||
class binop : public ref_formula
|
||||
{
|
||||
public:
|
||||
/// Different kinds of binary opertaors
|
||||
///
|
||||
/// And and Or are not here. Because they
|
||||
/// are often nested we represent them as multops.
|
||||
typedef typename T::binop type;
|
||||
enum type { Xor, Implies, Equiv, U, R };
|
||||
|
||||
/// Build an unary operator with operation \a op and
|
||||
/// children \a first and \a second.
|
||||
static binop<T>* instance(type op, formula<T>* first, formula<T>* second);
|
||||
|
||||
typedef typename T::visitor visitor;
|
||||
typedef typename T::const_visitor const_visitor;
|
||||
static binop* instance(type op, formula* first, formula* second);
|
||||
|
||||
virtual void accept(visitor& v);
|
||||
virtual void accept(const_visitor& v) const;
|
||||
|
||||
/// Get the first operand.
|
||||
const formula<T>* first() const;
|
||||
const formula* first() const;
|
||||
/// Get the first operand.
|
||||
formula<T>* first();
|
||||
formula* first();
|
||||
/// Get the second operand.
|
||||
const formula<T>* second() const;
|
||||
const formula* second() const;
|
||||
/// Get the second operand.
|
||||
formula<T>* second();
|
||||
formula* second();
|
||||
|
||||
/// Get the type of this operator.
|
||||
type op() const;
|
||||
|
|
@ -77,23 +71,21 @@ namespace spot
|
|||
static unsigned instance_count();
|
||||
|
||||
protected:
|
||||
typedef std::pair<formula<T>*, formula<T>*> pairf;
|
||||
typedef std::pair<formula*, formula*> pairf;
|
||||
typedef std::pair<type, pairf> pair;
|
||||
typedef std::map<pair, formula<T>*> map;
|
||||
typedef std::map<pair, formula*> map;
|
||||
static map instances;
|
||||
|
||||
binop(type op, formula<T>* first, formula<T>* second);
|
||||
binop(type op, formula* first, formula* second);
|
||||
virtual ~binop();
|
||||
|
||||
private:
|
||||
type op_;
|
||||
formula<T>* first_;
|
||||
formula<T>* second_;
|
||||
formula* first_;
|
||||
formula* second_;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
# include "binop.hxx"
|
||||
|
||||
#endif // SPOT_INTERNAL_BINOP_HH
|
||||
#endif // SPOT_LTLAST_BINOP_HH
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2003, 2005, 2008 Laboratoire d'Informatique de Paris
|
||||
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
||||
// Université Pierre et Marie Curie.
|
||||
// Copyright (C) 2003, 2005 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.
|
||||
//
|
||||
|
|
@ -19,65 +19,56 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
/// \file internal/constant.hxx
|
||||
/// \brief Generic constants implementation
|
||||
#ifndef SPOT_INTERNAL_CONSTANT_HXX
|
||||
# define SPOT_INTERNAL_CONSTANT_HXX
|
||||
|
||||
#include "constant.hh"
|
||||
#include "visitor.hh"
|
||||
#include <cassert>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
namespace ltl
|
||||
{
|
||||
template<typename T>
|
||||
constant<T>::constant(type val)
|
||||
constant::constant(type val)
|
||||
: val_(val)
|
||||
{
|
||||
switch (val)
|
||||
{
|
||||
case True:
|
||||
this->dump_ = "constant(1)";
|
||||
this->set_key_();
|
||||
dump_ = "constant(1)";
|
||||
set_key_();
|
||||
return;
|
||||
case False:
|
||||
this->dump_ = "constant(0)";
|
||||
this->set_key_();
|
||||
dump_ = "constant(0)";
|
||||
set_key_();
|
||||
return;
|
||||
}
|
||||
// Unreachable code.
|
||||
assert(0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constant<T>::~constant()
|
||||
constant::~constant()
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
constant<T>::accept(visitor& v)
|
||||
constant::accept(visitor& v)
|
||||
{
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
constant<T>::accept(const_visitor& v) const
|
||||
constant::accept(const_visitor& v) const
|
||||
{
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename constant<T>::type
|
||||
constant<T>::val() const
|
||||
constant::type
|
||||
constant::val() const
|
||||
{
|
||||
return val_;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const char*
|
||||
constant<T>::val_name() const
|
||||
constant::val_name() const
|
||||
{
|
||||
switch (val_)
|
||||
{
|
||||
|
|
@ -91,22 +82,18 @@ namespace spot
|
|||
return 0;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constant<T>*
|
||||
constant<T>::false_instance()
|
||||
constant*
|
||||
constant::false_instance()
|
||||
{
|
||||
static constant<T> f(constant<T>::False);
|
||||
static constant f(constant::False);
|
||||
return &f;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constant<T>*
|
||||
constant<T>::true_instance()
|
||||
constant*
|
||||
constant::true_instance()
|
||||
{
|
||||
static constant<T> t(constant<T>::True);
|
||||
static constant t(constant::True);
|
||||
return &t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_INTERNAL_CONSTANT_HXX
|
||||
|
|
@ -19,30 +19,24 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
/// \file internal/constant.hh
|
||||
/// \brief Generic constants
|
||||
#ifndef SPOT_INTERNAL_CONSTANT_HH
|
||||
# define SPOT_INTERNAL_CONSTANT_HH
|
||||
/// \file ltlast/constant.hh
|
||||
/// \brief LTL constants
|
||||
#ifndef SPOT_LTLAST_CONSTANT_HH
|
||||
# define SPOT_LTLAST_CONSTANT_HH
|
||||
|
||||
#include <cassert>
|
||||
#include "formula.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
namespace ltl
|
||||
{
|
||||
|
||||
/// \brief A constant (True or False)
|
||||
/// \ingroup generic_ast
|
||||
template<typename T>
|
||||
class constant : public formula<T>
|
||||
/// \ingroup ltl_ast
|
||||
class constant : public formula
|
||||
{
|
||||
public:
|
||||
enum type { False, True };
|
||||
|
||||
typedef typename T::visitor visitor;
|
||||
typedef typename T::const_visitor const_visitor;
|
||||
|
||||
virtual void accept(visitor& v);
|
||||
virtual void accept(const_visitor& v) const;
|
||||
|
||||
|
|
@ -51,9 +45,9 @@ namespace spot
|
|||
/// Return the value of the constant as a string.
|
||||
const char* val_name() const;
|
||||
|
||||
/// Get the sole instance of spot::internal::constant<T>::constant(1).
|
||||
/// Get the sole instance of spot::ltl::constant::constant(True).
|
||||
static constant* true_instance();
|
||||
/// Get the sole instance of spot::internal::constant<T>::constant(0).
|
||||
/// Get the sole instance of spot::ltl::constant::constant(False).
|
||||
static constant* false_instance();
|
||||
|
||||
protected:
|
||||
|
|
@ -67,6 +61,4 @@ namespace spot
|
|||
}
|
||||
}
|
||||
|
||||
# include "constant.hxx"
|
||||
|
||||
#endif // SPOT_INTERNAL_CONSTANT_HH
|
||||
#endif // SPOT_LTLAST_CONSTANT_HH
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright (C) 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// Copyright (C) 2003, 2005 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.
|
||||
|
|
@ -19,38 +19,56 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include <sstream>
|
||||
#include "baseformula.hh"
|
||||
#include "formula.hh"
|
||||
#include "misc/hash.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
namespace ltl
|
||||
{
|
||||
std::string
|
||||
base_formula::to_string() const
|
||||
formula*
|
||||
formula::ref()
|
||||
{
|
||||
std::ostringstream os;
|
||||
to_string(os);
|
||||
return os.str();
|
||||
ref_();
|
||||
return this;
|
||||
}
|
||||
|
||||
formula::~formula()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
formula::unref(formula* f)
|
||||
{
|
||||
if (f->unref_())
|
||||
delete f;
|
||||
}
|
||||
|
||||
void
|
||||
formula::ref_()
|
||||
{
|
||||
// Not reference counted by default.
|
||||
}
|
||||
|
||||
bool
|
||||
formula::unref_()
|
||||
{
|
||||
// Not reference counted by default.
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string&
|
||||
base_formula::dump() const
|
||||
formula::dump() const
|
||||
{
|
||||
return dump_;
|
||||
}
|
||||
|
||||
size_t
|
||||
base_formula::hash() const
|
||||
{
|
||||
return hash_key_;
|
||||
}
|
||||
|
||||
void
|
||||
base_formula::set_key_()
|
||||
formula::set_key_()
|
||||
{
|
||||
string_hash sh;
|
||||
hash_key_ = sh(dump_);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -20,16 +20,13 @@
|
|||
// 02111-1307, USA.
|
||||
|
||||
/// \file ltlast/formula.hh
|
||||
/// \brief LTL formula, AST and visitor interface
|
||||
/// \brief LTL formula interface
|
||||
#ifndef SPOT_LTLAST_FORMULA_HH
|
||||
# define SPOT_LTLAST_FORMULA_HH
|
||||
|
||||
# include "internal/formula.hh"
|
||||
# include "internal/atomic_prop.hh"
|
||||
# include "internal/constant.hh"
|
||||
# include "internal/unop.hh"
|
||||
# include "internal/binop.hh"
|
||||
# include "internal/multop.hh"
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
#include "predecl.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
@ -64,9 +61,6 @@ namespace spot
|
|||
/// \addtogroup ltl_misc Miscellaneous algorithms for LTL formulae
|
||||
/// \ingroup ltl_algorithm
|
||||
|
||||
struct ltl_t;
|
||||
struct visitor;
|
||||
struct const_visitor;
|
||||
|
||||
/// \brief An LTL formula.
|
||||
/// \ingroup ltl_essential
|
||||
|
|
@ -74,136 +68,114 @@ namespace spot
|
|||
///
|
||||
/// The only way you can work with a formula is to
|
||||
/// build a spot::ltl::visitor or spot::ltl::const_visitor.
|
||||
typedef spot::internal::formula<ltl_t> formula;
|
||||
|
||||
/// Forward declarations
|
||||
formula* clone(const formula* f);
|
||||
std::ostream& to_string(const formula* f, std::ostream& os);
|
||||
void destroy(const formula* f);
|
||||
|
||||
struct ltl_t
|
||||
class formula
|
||||
{
|
||||
typedef spot::ltl::visitor visitor;
|
||||
typedef spot::ltl::const_visitor const_visitor;
|
||||
public:
|
||||
/// Entry point for vspot::ltl::visitor instances.
|
||||
virtual void accept(visitor& v) = 0;
|
||||
/// Entry point for vspot::ltl::const_visitor instances.
|
||||
virtual void accept(const_visitor& v) const = 0;
|
||||
|
||||
static formula* clone_(const formula* f)
|
||||
/// \brief clone this node
|
||||
///
|
||||
/// This increments the reference counter of this node (if one is
|
||||
/// used). You should almost never use this method directly as
|
||||
/// it doesn't touch the children. If you want to clone a
|
||||
/// whole formula, use spot::ltl::clone() instead.
|
||||
formula* ref();
|
||||
/// \brief release this node
|
||||
///
|
||||
/// This decrements the reference counter of this node (if one is
|
||||
/// used) and can free the object. You should almost never use
|
||||
/// this method directly as it doesn't touch the children. If you
|
||||
/// want to release a whole formula, use spot::ltl::destroy() instead.
|
||||
static void unref(formula* f);
|
||||
|
||||
/// Return a canonic representation of the formula
|
||||
const std::string& dump() const;
|
||||
|
||||
/// Return a hash_key for the formula.
|
||||
size_t
|
||||
hash() const
|
||||
{
|
||||
return clone(f);
|
||||
return hash_key_;
|
||||
}
|
||||
protected:
|
||||
virtual ~formula();
|
||||
|
||||
static std::ostream& to_string_(const formula* f, std::ostream& os)
|
||||
{
|
||||
return to_string(f, os);
|
||||
}
|
||||
/// \brief increment reference counter if any
|
||||
virtual void ref_();
|
||||
/// \brief decrement reference counter if any, return true when
|
||||
/// the instance must be deleted (usually when the counter hits 0).
|
||||
virtual bool unref_();
|
||||
|
||||
static void destroy_(const formula* f)
|
||||
{
|
||||
destroy(f);
|
||||
}
|
||||
/// \brief Compute key_ from dump_.
|
||||
///
|
||||
/// Should be called once in each object, after dump_ has been set.
|
||||
void set_key_();
|
||||
/// The canonic representation of the formula
|
||||
std::string dump_;
|
||||
/// \brief The hash key of this formula.
|
||||
///
|
||||
/// Initialized by set_key_().
|
||||
size_t hash_key_;
|
||||
};
|
||||
|
||||
enum binop { Xor, Implies, Equiv, U, R };
|
||||
const char* binop_name(binop op) const
|
||||
/// \brief Strict Weak Ordering for <code>const formula*</code>.
|
||||
/// \ingroup ltl_essentials
|
||||
///
|
||||
/// This is meant to be used as a comparison functor for
|
||||
/// STL \c map whose key are of type <code>const formula*</code>.
|
||||
///
|
||||
/// For instance here is how one could declare
|
||||
/// a map of \c const::formula*.
|
||||
/// \code
|
||||
/// // Remember how many times each formula has been seen.
|
||||
/// std::map<const spot::ltl::formula*, int,
|
||||
/// spot::formula_ptr_less_than> seen;
|
||||
/// \endcode
|
||||
struct formula_ptr_less_than:
|
||||
public std::binary_function<const formula*, const formula*, bool>
|
||||
{
|
||||
bool
|
||||
operator()(const formula* left, const formula* right) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case Xor:
|
||||
return "Xor";
|
||||
case Implies:
|
||||
return "Implies";
|
||||
case Equiv:
|
||||
return "Equiv";
|
||||
case U:
|
||||
return "U";
|
||||
case R:
|
||||
return "R";
|
||||
}
|
||||
// Unreachable code.
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum unop { Not, X, F, G };
|
||||
const char* unop_name(unop op) const
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case Not:
|
||||
return "Not";
|
||||
case X:
|
||||
return "X";
|
||||
case F:
|
||||
return "F";
|
||||
case G:
|
||||
return "G";
|
||||
}
|
||||
// Unreachable code.
|
||||
assert(0);
|
||||
return 0;
|
||||
assert(left);
|
||||
assert(right);
|
||||
size_t l = left->hash();
|
||||
size_t r = right->hash();
|
||||
if (1 != r)
|
||||
return l < r;
|
||||
return left->dump() < right->dump();
|
||||
}
|
||||
};
|
||||
|
||||
typedef spot::internal::formula_ptr_less_than formula_ptr_less_than;
|
||||
typedef spot::internal::formula_ptr_hash formula_ptr_hash;
|
||||
|
||||
/// \brief Atomic propositions.
|
||||
/// \ingroup ltl_ast
|
||||
typedef spot::internal::atomic_prop<ltl_t> atomic_prop;
|
||||
|
||||
/// \brief A constant (True or False)
|
||||
/// \ingroup ltl_ast
|
||||
typedef spot::internal::constant<ltl_t> constant;
|
||||
|
||||
/// \brief Unary operators.
|
||||
/// \ingroup ltl_ast
|
||||
typedef spot::internal::unop<ltl_t> unop;
|
||||
|
||||
/// \brief Binary operator.
|
||||
/// \ingroup ltl_ast
|
||||
typedef spot::internal::binop<ltl_t> binop;
|
||||
|
||||
/// \brief Multi-operand operators.
|
||||
/// \ingroup ltl_ast
|
||||
/// \brief Hash Function for <code>const formula*</code>.
|
||||
/// \ingroup ltl_essentials
|
||||
/// \ingroup hash_funcs
|
||||
///
|
||||
/// These operators are considered commutative and associative.
|
||||
typedef spot::internal::multop<ltl_t> multop;
|
||||
|
||||
|
||||
/// \brief Formula visitor that can modify the formula.
|
||||
/// \ingroup ltl_essential
|
||||
/// This is meant to be used as a hash functor for
|
||||
/// Sgi's \c hash_map whose key are of type <code>const formula*</code>.
|
||||
///
|
||||
/// Writing visitors is the prefered way
|
||||
/// to traverse a formula, since it doesn't
|
||||
/// involve any cast.
|
||||
///
|
||||
/// If you do not need to modify the visited formula, inherit from
|
||||
/// spot::ltl:const_visitor instead.
|
||||
struct visitor
|
||||
/// For instance here is how one could declare
|
||||
/// a map of \c const::formula*.
|
||||
/// \code
|
||||
/// // Remember how many times each formula has been seen.
|
||||
/// Sgi::hash_map<const spot::ltl::formula*, int,
|
||||
/// const spot::ltl::formula_ptr_hash> seen;
|
||||
/// \endcode
|
||||
struct formula_ptr_hash:
|
||||
public std::unary_function<const formula*, size_t>
|
||||
{
|
||||
virtual ~visitor() {}
|
||||
virtual void visit(atomic_prop* node) = 0;
|
||||
virtual void visit(constant* node) = 0;
|
||||
virtual void visit(binop* node) = 0;
|
||||
virtual void visit(unop* node) = 0;
|
||||
virtual void visit(multop* node) = 0;
|
||||
size_t
|
||||
operator()(const formula* that) const
|
||||
{
|
||||
assert(that);
|
||||
return that->hash();
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Formula visitor that cannot modify the formula.
|
||||
///
|
||||
/// Writing visitors is the prefered way
|
||||
/// to traverse a formula, since it doesn't
|
||||
/// involve any cast.
|
||||
///
|
||||
/// If you want to modify the visited formula, inherit from
|
||||
/// spot::ltl:visitor instead.
|
||||
struct const_visitor
|
||||
{
|
||||
virtual ~const_visitor() {}
|
||||
virtual void visit(const atomic_prop* node) = 0;
|
||||
virtual void visit(const constant* node) = 0;
|
||||
virtual void visit(const binop* node) = 0;
|
||||
virtual void visit(const unop* node) = 0;
|
||||
virtual void visit(const multop* node) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2003, 2004, 2005, 2008 Laboratoire d'Informatique de
|
||||
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
||||
// Université Pierre et Marie Curie.
|
||||
// Copyright (C) 2003, 2004, 2005 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.
|
||||
//
|
||||
|
|
@ -19,89 +19,81 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
/// \file internal/multop.hxx
|
||||
/// \brief Generic multi-operand operators implementation
|
||||
#ifndef SPOT_INTERNAL_MULTOP_HXX
|
||||
# define SPOT_INTERNAL_MULTOP_HXX
|
||||
|
||||
#include <cassert>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
#include "multop.hh"
|
||||
#include "constant.hh"
|
||||
#include "visitor.hh"
|
||||
#include "ltlvisit/destroy.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
namespace ltl
|
||||
{
|
||||
template<typename T>
|
||||
multop<T>::multop(type op, vec* v)
|
||||
multop::multop(type op, vec* v)
|
||||
: op_(op), children_(v)
|
||||
{
|
||||
this->dump_ = "multop(";
|
||||
this->dump_ += op_name();
|
||||
dump_ = "multop(";
|
||||
dump_ += op_name();
|
||||
unsigned max = v->size();
|
||||
for (unsigned n = 0; n < max; ++n)
|
||||
{
|
||||
this->dump_ += ", " + (*v)[n]->dump();
|
||||
dump_ += ", " + (*v)[n]->dump();
|
||||
}
|
||||
this->dump_ += ")";
|
||||
this->set_key_();
|
||||
dump_ += ")";
|
||||
set_key_();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
multop<T>::~multop()
|
||||
multop::~multop()
|
||||
{
|
||||
// Get this instance out of the instance map.
|
||||
pair p(op(), children_);
|
||||
typename map::iterator i = instances.find(p);
|
||||
map::iterator i = instances.find(p);
|
||||
assert (i != instances.end());
|
||||
instances.erase(i);
|
||||
|
||||
delete children_;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
multop<T>::accept(visitor& v)
|
||||
multop::accept(visitor& v)
|
||||
{
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
multop<T>::accept(const_visitor& v) const
|
||||
multop::accept(const_visitor& v) const
|
||||
{
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
unsigned
|
||||
multop<T>::size() const
|
||||
multop::size() const
|
||||
{
|
||||
return children_->size();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const formula<T>*
|
||||
multop<T>::nth(unsigned n) const
|
||||
const formula*
|
||||
multop::nth(unsigned n) const
|
||||
{
|
||||
return (*children_)[n];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
formula<T>*
|
||||
multop<T>::nth(unsigned n)
|
||||
formula*
|
||||
multop::nth(unsigned n)
|
||||
{
|
||||
return (*children_)[n];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename multop<T>::type
|
||||
multop<T>::op() const
|
||||
multop::type
|
||||
multop::op() const
|
||||
{
|
||||
return op_;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const char*
|
||||
multop<T>::op_name() const
|
||||
multop::op_name() const
|
||||
{
|
||||
switch (op_)
|
||||
{
|
||||
|
|
@ -115,22 +107,20 @@ namespace spot
|
|||
return 0;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename multop<T>::map multop<T>::instances;
|
||||
multop::map multop::instances;
|
||||
|
||||
template<typename T>
|
||||
formula<T>*
|
||||
multop<T>::instance(type op, vec* v)
|
||||
formula*
|
||||
multop::instance(type op, vec* v)
|
||||
{
|
||||
pair p(op, v);
|
||||
|
||||
// Inline children of same kind.
|
||||
{
|
||||
vec inlined;
|
||||
typename vec::iterator i = v->begin();
|
||||
vec::iterator i = v->begin();
|
||||
while (i != v->end())
|
||||
{
|
||||
multop<T>* p = dynamic_cast<multop<T>*>(*i);
|
||||
multop* p = dynamic_cast<multop*>(*i);
|
||||
if (p && p->op() == op)
|
||||
{
|
||||
unsigned ps = p->size();
|
||||
|
|
@ -139,7 +129,7 @@ namespace spot
|
|||
// That sub-formula is now useless, drop it.
|
||||
// Note that we use unref(), not destroy(), because we've
|
||||
// adopted its children and don't want to destroy these.
|
||||
formula<T>::unref(*i);
|
||||
formula::unref(*i);
|
||||
i = v->erase(i);
|
||||
}
|
||||
else
|
||||
|
|
@ -155,8 +145,8 @@ namespace spot
|
|||
// Remove duplicates. We can't use std::unique(), because we
|
||||
// must destroy() any formula we drop.
|
||||
{
|
||||
formula<T>* last = 0;
|
||||
typename vec::iterator i = v->begin();
|
||||
formula* last = 0;
|
||||
vec::iterator i = v->begin();
|
||||
while (i != v->end())
|
||||
{
|
||||
if (*i == last)
|
||||
|
|
@ -171,42 +161,41 @@ namespace spot
|
|||
}
|
||||
}
|
||||
|
||||
typename vec::size_type s = v->size();
|
||||
vec::size_type s = v->size();
|
||||
if (s == 0)
|
||||
{
|
||||
delete v;
|
||||
switch (op)
|
||||
{
|
||||
case And:
|
||||
return constant<T>::true_instance();
|
||||
return constant::true_instance();
|
||||
case Or:
|
||||
return constant<T>::false_instance();
|
||||
return constant::false_instance();
|
||||
}
|
||||
/* Unreachable code. */
|
||||
assert(0);
|
||||
}
|
||||
else if (s == 1)
|
||||
{
|
||||
formula<T>* res = (*v)[0];
|
||||
formula* res = (*v)[0];
|
||||
delete v;
|
||||
return res;
|
||||
}
|
||||
|
||||
typename map::iterator i = instances.find(p);
|
||||
map::iterator i = instances.find(p);
|
||||
if (i != instances.end())
|
||||
{
|
||||
delete v;
|
||||
return static_cast<multop<T>*>(i->second->ref());
|
||||
return static_cast<multop*>(i->second->ref());
|
||||
}
|
||||
multop<T>* ap = new multop<T>(op, v);
|
||||
multop* ap = new multop(op, v);
|
||||
instances[p] = ap;
|
||||
return static_cast<multop<T>*>(ap->ref());
|
||||
return static_cast<multop*>(ap->ref());
|
||||
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
formula<T>*
|
||||
multop<T>::instance(type op, formula<T>* first, formula<T>* second)
|
||||
formula*
|
||||
multop::instance(type op, formula* first, formula* second)
|
||||
{
|
||||
vec* v = new vec;
|
||||
v->push_back(first);
|
||||
|
|
@ -214,39 +203,10 @@ namespace spot
|
|||
return instance(op, v);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
unsigned
|
||||
multop<T>::instance_count()
|
||||
multop::instance_count()
|
||||
{
|
||||
return instances.size();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
multop<T>::destroy(formula<T>* c)
|
||||
{
|
||||
if (unop<T>* uo = dynamic_cast<unop<T>*>(c))
|
||||
{
|
||||
destroy(uo->child());
|
||||
formula<T>::unref(uo);
|
||||
}
|
||||
else if (binop<T>* bo = dynamic_cast<binop<T>*>(c))
|
||||
{
|
||||
destroy(bo->first());
|
||||
destroy(bo->second());
|
||||
formula<T>::unref(bo);
|
||||
}
|
||||
else if (multop<T>* mo = dynamic_cast<multop<T>*>(c))
|
||||
{
|
||||
unsigned s = mo->size();
|
||||
for (unsigned i = 0; i < s; ++i)
|
||||
destroy(mo->nth(i));
|
||||
formula<T>::unref(mo);
|
||||
}
|
||||
else // constant<T>* || atomic_prop<T>*
|
||||
formula<T>::unref(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_INTERNAL_MULTOP_HXX
|
||||
|
|
@ -19,68 +19,59 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
/// \file internal/multop.hh
|
||||
/// \brief Generic multi-operand operators
|
||||
#ifndef SPOT_INTERNAL_MULTOP_HH
|
||||
# define SPOT_INTERNAL_MULTOP_HH
|
||||
/// \file ltlast/multop.hh
|
||||
/// \brief LTL multi-operand operators
|
||||
#ifndef SPOT_LTLAST_MULTOP_HH
|
||||
# define SPOT_LTLAST_MULTOP_HH
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <cassert>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
#include "refformula.hh"
|
||||
#include "constant.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
namespace ltl
|
||||
{
|
||||
|
||||
/// \brief Multi-operand operators.
|
||||
/// \ingroup generic_ast
|
||||
/// \ingroup ltl_ast
|
||||
///
|
||||
/// These operators are considered commutative and associative.
|
||||
template<typename T>
|
||||
class multop : public ref_formula<T>
|
||||
class multop : public ref_formula
|
||||
{
|
||||
public:
|
||||
enum type { Or, And };
|
||||
|
||||
/// List of formulae.
|
||||
typedef std::vector<formula<T>*> vec;
|
||||
typedef std::vector<formula*> vec;
|
||||
|
||||
/// \brief Build a spot::internal::multop<T> with two children.
|
||||
/// \brief Build a spot::ltl::multop with two children.
|
||||
///
|
||||
/// If one of the children itself is a spot::internal::multop<T>
|
||||
/// If one of the children itself is a spot::ltl::multop
|
||||
/// with the same type, it will be merged. I.e., children
|
||||
/// if that child will be added, and that child itself will
|
||||
/// be destroyed. This allows incremental building of
|
||||
/// n-ary internal::multop<T>.
|
||||
/// n-ary ltl::multop.
|
||||
///
|
||||
/// This functions can perform slight optimizations and may not
|
||||
/// return an internal::multop<T> objects. For instance if \c
|
||||
/// first and \c second are equal, that formula is returned
|
||||
/// as-is.
|
||||
static formula<T>* instance(type op,
|
||||
formula<T>* first, formula<T>* second);
|
||||
/// This functions can perform slight optimizations and
|
||||
/// may not return an ltl::multop objects. For instance
|
||||
/// if \c first and \c second are equal, that formula is
|
||||
/// returned as-is.
|
||||
static formula* instance(type op, formula* first, formula* second);
|
||||
|
||||
/// \brief Build a spot::internal::multop<T> with many children.
|
||||
/// \brief Build a spot::ltl::multop with many children.
|
||||
///
|
||||
/// Same as the other instance() function, but take a vector of
|
||||
/// formula in argument. This vector is acquired by the
|
||||
/// spot::internal::multop<T> class, the caller should allocate
|
||||
/// it with \c new, but not use it (especially not destroy it)
|
||||
/// after it has been passed to spot::internal::multop<T>.
|
||||
/// spot::ltl::multop class, the caller should allocate it with
|
||||
/// \c new, but not use it (especially not destroy it) after it
|
||||
/// has been passed to spot::ltl::multop.
|
||||
///
|
||||
/// This functions can perform slight optimizations and may not
|
||||
/// return an internal::multop<T> objects. For instance if the
|
||||
/// vector contain only one unique element, this this formula
|
||||
/// will be returned as-is.
|
||||
static formula<T>* instance(type op, vec* v);
|
||||
|
||||
typedef typename T::visitor visitor;
|
||||
typedef typename T::const_visitor const_visitor;
|
||||
/// This functions can perform slight optimizations and
|
||||
/// may not return an ltl::multop objects. For instance
|
||||
/// if the vector contain only one unique element, this
|
||||
/// this formula will be returned as-is.
|
||||
static formula* instance(type op, vec* v);
|
||||
|
||||
virtual void accept(visitor& v);
|
||||
virtual void accept(const_visitor& v) const;
|
||||
|
|
@ -90,11 +81,11 @@ namespace spot
|
|||
/// \brief Get the nth children.
|
||||
///
|
||||
/// Starting with \a n = 0.
|
||||
const formula<T>* nth(unsigned n) const;
|
||||
const formula* nth(unsigned n) const;
|
||||
/// \brief Get the nth children.
|
||||
///
|
||||
/// Starting with \a n = 0.
|
||||
formula<T>* nth(unsigned n);
|
||||
formula* nth(unsigned n);
|
||||
|
||||
/// Get the type of this operator.
|
||||
type op() const;
|
||||
|
|
@ -106,7 +97,7 @@ namespace spot
|
|||
|
||||
protected:
|
||||
typedef std::pair<type, vec*> pair;
|
||||
/// Comparison functor used internally by internal::multop<T>.
|
||||
/// Comparison functor used internally by ltl::multop.
|
||||
struct paircmp
|
||||
{
|
||||
bool
|
||||
|
|
@ -117,7 +108,7 @@ namespace spot
|
|||
return *p1.second < *p2.second;
|
||||
}
|
||||
};
|
||||
typedef std::map<pair, formula<T>*, paircmp> map;
|
||||
typedef std::map<pair, formula*, paircmp> map;
|
||||
static map instances;
|
||||
|
||||
multop(type op, vec* v);
|
||||
|
|
@ -126,13 +117,9 @@ namespace spot
|
|||
private:
|
||||
type op_;
|
||||
vec* children_;
|
||||
|
||||
static void destroy(formula<T>* c);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
# include "multop.hxx"
|
||||
|
||||
#endif // SPOT_INTERNAL_MULTOP_HH
|
||||
#endif // SPOT_LTLAST_MULTOP_HH
|
||||
|
|
@ -19,31 +19,30 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
/// \file internal/predecl.hh
|
||||
/// \brief Predeclare all node types.
|
||||
/// \file ltlast/predecl.hh
|
||||
/// \brief Predeclare all LTL node types.
|
||||
///
|
||||
/// This file is usually used when \b declaring methods and functions
|
||||
/// over nodes.
|
||||
#ifndef SPOT_INTERNAL_PREDECL_HH
|
||||
# define SPOT_INTERNAL_PREDECL_HH
|
||||
/// over LTL nodes.
|
||||
/// Use ltlast/allnodes.hh or an individual header when the definition of
|
||||
/// the node is actually needed.
|
||||
#ifndef SPOT_LTLAST_PREDECL_HH
|
||||
# define SPOT_LTLAST_PREDECL_HH
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
namespace ltl
|
||||
{
|
||||
template<typename T>
|
||||
struct visitor;
|
||||
struct const_visitor;
|
||||
|
||||
struct atomic_prop;
|
||||
template<typename T>
|
||||
struct unop;
|
||||
template<typename T>
|
||||
struct constant;
|
||||
template<typename T>
|
||||
struct binop;
|
||||
template<typename T>
|
||||
struct formula;
|
||||
template<typename T>
|
||||
struct multop;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_INTERNAL_PREDECL_HH
|
||||
#endif // SPOT_LTLAST_PREDECL_HH
|
||||
|
|
@ -19,51 +19,40 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
/// \file internal/refformula.hxx
|
||||
/// \brief Reference-counted generic formulae implementation
|
||||
#ifndef SPOT_INTERNAL_REFFORMULA_HXX
|
||||
# define SPOT_INTERNAL_REFFORMULA_HXX
|
||||
|
||||
#include "refformula.hh"
|
||||
#include <cassert>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
namespace ltl
|
||||
{
|
||||
template<typename T>
|
||||
ref_formula<T>::ref_formula()
|
||||
ref_formula::ref_formula()
|
||||
: ref_counter_(0)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
ref_formula<T>::~ref_formula()
|
||||
ref_formula::~ref_formula()
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
ref_formula<T>::ref_()
|
||||
ref_formula::ref_()
|
||||
{
|
||||
++ref_counter_;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool
|
||||
ref_formula<T>::unref_()
|
||||
ref_formula::unref_()
|
||||
{
|
||||
assert(ref_counter_ > 0);
|
||||
return !--ref_counter_;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
unsigned
|
||||
ref_formula<T>::ref_count_()
|
||||
ref_formula::ref_count_()
|
||||
{
|
||||
return ref_counter_;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_INTERNAL_REFFORMULA_HXX
|
||||
|
|
@ -19,23 +19,21 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
/// \file internal/refformula.hh
|
||||
/// \brief Reference-counted generic formulae
|
||||
#ifndef SPOT_INTERNAL_REFFORMULA_HH
|
||||
# define SPOT_INTERNAL_REFFORMULA_HH
|
||||
/// \file ltlast/refformula.hh
|
||||
/// \brief Reference-counted LTL formulae
|
||||
#ifndef SPOT_LTLAST_REFFORMULA_HH
|
||||
# define SPOT_LTLAST_REFFORMULA_HH
|
||||
|
||||
#include "formula.hh"
|
||||
#include <cassert>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
namespace ltl
|
||||
{
|
||||
|
||||
/// \brief A reference-counted generic formula.
|
||||
/// \ingroup generic_ast
|
||||
template<typename T>
|
||||
class ref_formula : public formula<T>
|
||||
/// \brief A reference-counted LTL formula.
|
||||
/// \ingroup ltl_ast
|
||||
class ref_formula : public formula
|
||||
{
|
||||
protected:
|
||||
virtual ~ref_formula();
|
||||
|
|
@ -44,7 +42,6 @@ namespace spot
|
|||
bool unref_();
|
||||
/// Number of references to this formula.
|
||||
unsigned ref_count_();
|
||||
|
||||
private:
|
||||
unsigned ref_counter_;
|
||||
};
|
||||
|
|
@ -52,6 +49,4 @@ namespace spot
|
|||
}
|
||||
}
|
||||
|
||||
# include "refformula.hxx"
|
||||
|
||||
#endif // SPOT_INTERNAL_REFFORMULA_HH
|
||||
#endif // SPOT_LTLAST_REFFORMULA_HH
|
||||
|
|
@ -19,104 +19,101 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
/// \file internal/unop.hxx
|
||||
/// \brief Generic unary operators implementation
|
||||
#ifndef SPOT_INTERNAL_UNOP_HXX
|
||||
# define SPOT_INTERNAL_UNOP_HXX
|
||||
|
||||
#include "unop.hh"
|
||||
#include "visitor.hh"
|
||||
#include <cassert>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
namespace ltl
|
||||
{
|
||||
template<typename T>
|
||||
unop<T>::unop(type op, formula<T>* child)
|
||||
unop::unop(type op, formula* child)
|
||||
: op_(op), child_(child)
|
||||
{
|
||||
this->dump_ = "unop(";
|
||||
this->dump_ += op_name();
|
||||
this->dump_ += ", " + child->dump() + ")";
|
||||
this->set_key_();
|
||||
dump_ = "unop(";
|
||||
dump_ += op_name();
|
||||
dump_ += ", " + child->dump() + ")";
|
||||
set_key_();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
unop<T>::~unop()
|
||||
unop::~unop()
|
||||
{
|
||||
// Get this instance out of the instance map.
|
||||
pair p(op(), child());
|
||||
typename map::iterator i = instances.find(p);
|
||||
map::iterator i = instances.find(p);
|
||||
assert (i != instances.end());
|
||||
instances.erase(i);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
unop<T>::accept(visitor& v)
|
||||
unop::accept(visitor& v)
|
||||
{
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
unop<T>::accept(const_visitor& v) const
|
||||
unop::accept(const_visitor& v) const
|
||||
{
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const formula<T>*
|
||||
unop<T>::child() const
|
||||
const formula*
|
||||
unop::child() const
|
||||
{
|
||||
return child_;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
formula<T>*
|
||||
unop<T>::child()
|
||||
formula*
|
||||
unop::child()
|
||||
{
|
||||
return child_;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename unop<T>::type
|
||||
unop<T>::op() const
|
||||
unop::type
|
||||
unop::op() const
|
||||
{
|
||||
return op_;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const char*
|
||||
unop<T>::op_name() const
|
||||
unop::op_name() const
|
||||
{
|
||||
return T::unop_name(op_);
|
||||
switch (op_)
|
||||
{
|
||||
case Not:
|
||||
return "Not";
|
||||
case X:
|
||||
return "X";
|
||||
case F:
|
||||
return "F";
|
||||
case G:
|
||||
return "G";
|
||||
}
|
||||
// Unreachable code.
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename unop<T>::map unop<T>::instances;
|
||||
unop::map unop::instances;
|
||||
|
||||
template<typename T>
|
||||
unop<T>*
|
||||
unop<T>::instance(type op, formula<T>* child)
|
||||
unop*
|
||||
unop::instance(type op, formula* child)
|
||||
{
|
||||
pair p(op, child);
|
||||
typename map::iterator i = instances.find(p);
|
||||
map::iterator i = instances.find(p);
|
||||
if (i != instances.end())
|
||||
{
|
||||
return static_cast<unop<T>*>(i->second->ref());
|
||||
return static_cast<unop*>(i->second->ref());
|
||||
}
|
||||
unop<T>* ap = new unop<T>(op, child);
|
||||
unop* ap = new unop(op, child);
|
||||
instances[p] = ap;
|
||||
return static_cast<unop<T>*>(ap->ref());
|
||||
return static_cast<unop*>(ap->ref());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
unsigned
|
||||
unop<T>::instance_count()
|
||||
unop::instance_count()
|
||||
{
|
||||
return instances.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_INTERNAL_UNOP_HXX
|
||||
|
|
@ -19,42 +19,37 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
/// \file internal/unop.hh
|
||||
/// \brief Generic unary operators
|
||||
#ifndef SPOT_INTERNAL_UNOP_HH
|
||||
# define SPOT_INTERNAL_UNOP_HH
|
||||
/// \file ltlast/unop.hh
|
||||
/// \brief LTL unary operators
|
||||
#ifndef SPOT_LTLAST_UNOP_HH
|
||||
# define SPOT_LTLAST_UNOP_HH
|
||||
|
||||
#include <map>
|
||||
#include "refformula.hh"
|
||||
#include <cassert>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace internal
|
||||
namespace ltl
|
||||
{
|
||||
|
||||
/// \brief Generic unary operators.
|
||||
/// \ingroup generic_ast
|
||||
template<typename T>
|
||||
class unop : public ref_formula<T>
|
||||
/// \brief Unary operators.
|
||||
/// \ingroup ltl_ast
|
||||
class unop : public ref_formula
|
||||
{
|
||||
public:
|
||||
typedef typename T::unop type;
|
||||
enum type { Not, X, F, G };
|
||||
|
||||
/// Build an unary operator with operation \a op and
|
||||
/// child \a child.
|
||||
static unop* instance(type op, formula<T>* child);
|
||||
|
||||
typedef typename T::visitor visitor;
|
||||
typedef typename T::const_visitor const_visitor;
|
||||
static unop* instance(type op, formula* child);
|
||||
|
||||
virtual void accept(visitor& v);
|
||||
virtual void accept(const_visitor& v) const;
|
||||
|
||||
/// Get the sole operand of this operator.
|
||||
const formula<T>* child() const;
|
||||
const formula* child() const;
|
||||
/// Get the sole operand of this operator.
|
||||
formula<T>* child();
|
||||
formula* child();
|
||||
|
||||
/// Get the type of this operator.
|
||||
type op() const;
|
||||
|
|
@ -65,21 +60,19 @@ namespace spot
|
|||
static unsigned instance_count();
|
||||
|
||||
protected:
|
||||
typedef std::pair<type, formula<T>*> pair;
|
||||
typedef std::map<pair, formula<T>*> map;
|
||||
typedef std::pair<type, formula*> pair;
|
||||
typedef std::map<pair, formula*> map;
|
||||
static map instances;
|
||||
|
||||
unop(type op, formula<T>* child);
|
||||
unop(type op, formula* child);
|
||||
virtual ~unop();
|
||||
|
||||
private:
|
||||
type op_;
|
||||
formula<T>* child_;
|
||||
formula* child_;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
# include "unop.hxx"
|
||||
|
||||
#endif // SPOT_INTERNAL_UNOP_HH
|
||||
#endif // SPOT_LTLAST_UNOP_HH
|
||||
74
src/ltlast/visitor.hh
Normal file
74
src/ltlast/visitor.hh
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
// Copyright (C) 2003, 2004, 2005 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 2 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 Spot; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
/// \file ltlast/visitor.hh
|
||||
/// \brief LTL visitor interface
|
||||
#ifndef SPOT_LTLAST_VISITOR_HH
|
||||
# define SPOT_LTLAST_VISITOR_HH
|
||||
|
||||
#include "predecl.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace ltl
|
||||
{
|
||||
/// \brief Formula visitor that can modify the formula.
|
||||
/// \ingroup ltl_essential
|
||||
///
|
||||
/// Writing visitors is the prefered way
|
||||
/// to traverse a formula, since it doesn't
|
||||
/// involve any cast.
|
||||
///
|
||||
/// If you do not need to modify the visited formula, inherit from
|
||||
/// spot::ltl:const_visitor instead.
|
||||
struct visitor
|
||||
{
|
||||
virtual ~visitor() {}
|
||||
virtual void visit(atomic_prop* node) = 0;
|
||||
virtual void visit(constant* node) = 0;
|
||||
virtual void visit(binop* node) = 0;
|
||||
virtual void visit(unop* node) = 0;
|
||||
virtual void visit(multop* node) = 0;
|
||||
};
|
||||
|
||||
/// \brief Formula visitor that cannot modify the formula.
|
||||
///
|
||||
/// Writing visitors is the prefered way
|
||||
/// to traverse a formula, since it doesn't
|
||||
/// involve any cast.
|
||||
///
|
||||
/// If you want to modify the visited formula, inherit from
|
||||
/// spot::ltl:visitor instead.
|
||||
struct const_visitor
|
||||
{
|
||||
virtual ~const_visitor() {}
|
||||
virtual void visit(const atomic_prop* node) = 0;
|
||||
virtual void visit(const constant* node) = 0;
|
||||
virtual void visit(const binop* node) = 0;
|
||||
virtual void visit(const unop* node) = 0;
|
||||
virtual void visit(const multop* node) = 0;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_LTLAST_VISITOR_HH
|
||||
|
|
@ -19,9 +19,17 @@
|
|||
## Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
## 02111-1307, USA.
|
||||
|
||||
AM_CPPFLAGS = -I$(srcdir)/..
|
||||
AM_CXXFLAGS = $(WARNING_CXXFLAGS)
|
||||
|
||||
ltlenvdir = $(pkgincludedir)/ltlenv
|
||||
|
||||
ltlenv_HEADERS = \
|
||||
defaultenv.hh \
|
||||
declenv.hh \
|
||||
defaultenv.hh \
|
||||
environment.hh
|
||||
|
||||
noinst_LTLIBRARIES = libltlenv.la
|
||||
libltlenv_la_SOURCES = \
|
||||
declenv.cc \
|
||||
defaultenv.cc
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -23,7 +23,10 @@
|
|||
# define SPOT_LTLENV_DECLENV_HH
|
||||
|
||||
# include "environment.hh"
|
||||
# include "internal/declenv.hh"
|
||||
# include <string>
|
||||
# include <map>
|
||||
# include "ltlvisit/destroy.hh"
|
||||
# include "ltlast/atomic_prop.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
@ -35,9 +38,29 @@ namespace spot
|
|||
///
|
||||
/// This environment recognizes all atomic propositions
|
||||
/// that have been previously declared. It will reject other.
|
||||
typedef spot::internal::declarative_environment<ltl_t>
|
||||
declarative_environment;
|
||||
class declarative_environment : public environment
|
||||
{
|
||||
public:
|
||||
declarative_environment();
|
||||
~declarative_environment();
|
||||
|
||||
/// Declare an atomic proposition. Return false iff the
|
||||
/// proposition was already declared.
|
||||
bool declare(const std::string& prop_str);
|
||||
|
||||
virtual ltl::formula* require(const std::string& prop_str);
|
||||
|
||||
/// Get the name of the environment.
|
||||
virtual const std::string& name();
|
||||
|
||||
typedef std::map<const std::string, ltl::atomic_prop*> prop_map;
|
||||
|
||||
/// Get the map of atomic proposition known to this environment.
|
||||
const prop_map& get_prop_map() const;
|
||||
|
||||
private:
|
||||
prop_map props_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -23,7 +23,6 @@
|
|||
# define SPOT_LTLENV_DEFAULTENV_HH
|
||||
|
||||
# include "environment.hh"
|
||||
# include "internal/defaultenv.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
@ -37,7 +36,18 @@ namespace spot
|
|||
///
|
||||
/// This is a singleton. Use default_environment::instance()
|
||||
/// to obtain the instance.
|
||||
typedef spot::internal::default_environment<ltl_t> default_environment;
|
||||
class default_environment : public environment
|
||||
{
|
||||
public:
|
||||
virtual ~default_environment();
|
||||
virtual formula* require(const std::string& prop_str);
|
||||
virtual const std::string& name();
|
||||
|
||||
/// Get the sole instance of spot::ltl::default_environment.
|
||||
static default_environment& instance();
|
||||
protected:
|
||||
default_environment();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
# define SPOT_LTLENV_ENVIRONMENT_HH
|
||||
|
||||
# include "ltlast/formula.hh"
|
||||
# include "internal/environment.hh"
|
||||
# include <string>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
@ -31,7 +31,37 @@ namespace spot
|
|||
{
|
||||
/// \brief An environment that describes atomic propositions.
|
||||
/// \ingroup ltl_essential
|
||||
typedef spot::internal::environment<ltl_t> environment;
|
||||
class environment
|
||||
{
|
||||
public:
|
||||
/// \brief Obtain the formula associated to \a prop_str
|
||||
///
|
||||
/// Usually \a prop_str, is the name of an atomic proposition,
|
||||
/// and spot::ltl::require simply returns the associated
|
||||
/// spot::ltl::atomic_prop.
|
||||
///
|
||||
/// Note this is not a \c const method. Some environments will
|
||||
/// "create" the atomic proposition when requested.
|
||||
///
|
||||
/// We return a spot::ltl::formula instead of an
|
||||
/// spot::ltl::atomic_prop, because this
|
||||
/// will allow nifty tricks (e.g., we could name formulae in an
|
||||
/// environment, and let the parser build a larger tree from
|
||||
/// these).
|
||||
///
|
||||
/// \return 0 iff \a prop_str is not part of the environment,
|
||||
/// or the associated spot::ltl::formula otherwise.
|
||||
virtual formula* require(const std::string& prop_str) = 0;
|
||||
|
||||
/// Get the name of the environment.
|
||||
virtual const std::string& name() = 0;
|
||||
|
||||
virtual
|
||||
~environment()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2003, 2004, 2005, 2006, 2008 Laboratoire d'Informatique de
|
||||
/* Copyright (C) 2003, 2004, 2005, 2006 Laboratoire d'Informatique de
|
||||
** Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
||||
** Université Pierre et Marie Curie.
|
||||
**
|
||||
|
|
@ -22,6 +22,7 @@
|
|||
%{
|
||||
#include <string>
|
||||
#include "public.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include "ltlvisit/destroy.hh"
|
||||
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "ltlvisit/nenoform.hh"
|
||||
#include "ltlvisit/destroy.hh"
|
||||
#include "ltlvisit/contain.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include "ltlvisit/reduce.hh"
|
||||
#include "ltlvisit/tostring.hh"
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include <string>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include "ltlast/atomic_prop.hh"
|
||||
#include "ltlvisit/randomltl.hh"
|
||||
#include "ltlvisit/tostring.hh"
|
||||
#include "ltlvisit/destroy.hh"
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "ltlvisit/dump.hh"
|
||||
#include "ltlvisit/dotty.hh"
|
||||
#include "ltlvisit/destroy.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
|
||||
void
|
||||
syntax(char* prog)
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include "ltlvisit/reduce.hh"
|
||||
#include "ltlvisit/length.hh"
|
||||
#include "ltlvisit/contain.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
|
||||
void
|
||||
syntax(char* prog)
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "ltlvisit/destroy.hh"
|
||||
#include "ltlvisit/tostring.hh"
|
||||
#include "ltlvisit/syntimpl.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include "ltlvisit/nenoform.hh"
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "ltlparse/public.hh"
|
||||
#include "ltlvisit/tostring.hh"
|
||||
#include "ltlvisit/destroy.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
|
||||
void
|
||||
syntax(char *prog)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2004, 2005, 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
# define SPOT_LTLVISIT_APCOLLECT_HH
|
||||
|
||||
#include <set>
|
||||
#include "ltlast/formula.hh"
|
||||
#include "ltlast/atomic_prop.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
// 02111-1307, USA.
|
||||
|
||||
#include "basicreduce.hh"
|
||||
#include "ltlast/visitor.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include <cassert>
|
||||
|
||||
#include "clone.hh"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003, 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include "clone.hh"
|
||||
|
||||
namespace spot
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003, 2004, 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -23,6 +23,7 @@
|
|||
# define SPOT_LTLVISIT_CLONE_HH
|
||||
|
||||
#include "ltlast/formula.hh"
|
||||
#include "ltlast/visitor.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2006, 2007, 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2006, 2007 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -23,6 +23,10 @@
|
|||
#include "destroy.hh"
|
||||
#include "clone.hh"
|
||||
#include "tunabbrev.hh"
|
||||
#include "ltlast/unop.hh"
|
||||
#include "ltlast/binop.hh"
|
||||
#include "ltlast/multop.hh"
|
||||
#include "ltlast/constant.hh"
|
||||
#include "tgba/tgbaproduct.hh"
|
||||
#include "tgbaalgos/gtec/gtec.hh"
|
||||
#include "tgbaalgos/save.hh"
|
||||
|
|
|
|||
|
|
@ -25,10 +25,17 @@ namespace spot
|
|||
{
|
||||
namespace ltl
|
||||
{
|
||||
void
|
||||
destroy_visitor::doit_default(formula* c)
|
||||
namespace
|
||||
{
|
||||
formula::unref(c);
|
||||
class destroy_visitor: public postfix_visitor
|
||||
{
|
||||
public:
|
||||
virtual void
|
||||
doit_default(formula* c)
|
||||
{
|
||||
formula::unref(c);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -28,19 +28,6 @@ namespace spot
|
|||
{
|
||||
namespace ltl
|
||||
{
|
||||
/// \ingroup ltl_visitor
|
||||
///
|
||||
/// This visitor is public, because it's convenient to write the
|
||||
/// destroy method of the base_formula class. But if you just
|
||||
/// want the functionality, consider using spot::ltl::destroy
|
||||
/// instead.
|
||||
class destroy_visitor: public postfix_visitor
|
||||
{
|
||||
public:
|
||||
virtual void
|
||||
doit_default(formula* c);
|
||||
};
|
||||
|
||||
/// \brief Destroys a formula
|
||||
/// \ingroup ltl_essential
|
||||
void destroy(const formula *f);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003, 2004, 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "misc/hash.hh"
|
||||
#include "dotty.hh"
|
||||
#include "ltlast/visitor.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include <ostream>
|
||||
|
||||
namespace spot
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2003, 2004, 2005, 2008 Laboratoire d'Informatique de
|
||||
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
|
||||
// Université Pierre et Marie Curie.
|
||||
// Copyright (C) 2003, 2004, 2005 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.
|
||||
//
|
||||
|
|
@ -20,6 +20,8 @@
|
|||
// 02111-1307, USA.
|
||||
|
||||
#include "dump.hh"
|
||||
#include "ltlast/visitor.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include <ostream>
|
||||
|
||||
namespace spot
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003, 2004, 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include "ltlvisit/clone.hh"
|
||||
#include "lunabbrev.hh"
|
||||
#include <cassert>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003, 2004, 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -19,8 +19,9 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include <cassert>
|
||||
#include "nenoform.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include <cassert>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003, 2004, 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -23,6 +23,7 @@
|
|||
# define SPOT_LTLVISIT_NENOFORM_HH
|
||||
|
||||
#include "ltlast/formula.hh"
|
||||
#include "ltlast/visitor.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003, 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
// 02111-1307, USA.
|
||||
|
||||
#include "ltlvisit/postfix.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003, 2004, 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -23,6 +23,7 @@
|
|||
# define SPOT_LTLVISIT_POSTFIX_HH
|
||||
|
||||
#include "ltlast/formula.hh"
|
||||
#include "ltlast/visitor.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <cassert>
|
||||
#include <algorithm>
|
||||
#include "randomltl.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include "misc/random.hh"
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include "reduce.hh"
|
||||
#include "basicreduce.hh"
|
||||
#include "syntimpl.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include <cassert>
|
||||
|
||||
#include "lunabbrev.hh"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2004, 2006, 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2004, 2006 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -23,6 +23,7 @@
|
|||
# define SPOT_LTLVISIT_REDUCE_HH
|
||||
|
||||
#include "ltlast/formula.hh"
|
||||
#include "ltlast/visitor.hh"
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2004, 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -19,6 +19,8 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include "ltlvisit/clone.hh"
|
||||
#include "simpfg.hh"
|
||||
#include <cassert>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2004, 2005, 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
// 02111-1307, USA.
|
||||
|
||||
#include "syntimpl.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include <cassert>
|
||||
|
||||
#include "lunabbrev.hh"
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@
|
|||
#include <ostream>
|
||||
#include <cstring>
|
||||
#include "tostring.hh"
|
||||
#include "ltlast/visitor.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003, 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
// 02111-1307, USA.
|
||||
|
||||
#include "ltlast/allnodes.hh"
|
||||
#include "tunabbrev.hh"
|
||||
|
||||
namespace spot
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue