Commit 543190f2 authored by Damien Lefortier's avatar Damien Lefortier Committed by Damien Lefortier

Template ltlast/ & ltlenv/ classes in internal/ & Add ELTL parser.

parent 21c98c0a
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.
......
......@@ -79,11 +79,17 @@ AC_CONFIG_FILES([
iface/gspn/Makefile
iface/gspn/defs
src/Makefile
src/eltlast/Makefile
src/eltlenv/Makefile
src/eltlparse/Makefile
src/eltltest/Makefile
src/eltltest/defs
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
......
......@@ -23,20 +23,21 @@ AUTOMAKE_OPTIONS = subdir-objects
# List directories in the order they must be built.
# Keep tests at the end.
SUBDIRS = misc ltlenv ltlast ltlvisit ltlparse \
SUBDIRS = misc ltlenv ltlast ltlvisit ltlparse internal \
eltlenv eltlast eltlparse \
tgba tgbaalgos tgbaparse \
evtgba evtgbaalgos evtgbaparse . \
ltltest tgbatest evtgbatest sanity
ltltest eltltest 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 \
ltlast/libltlast.la \
eltlast/libeltlast.la \
eltlparse/libeltlparse.la \
tgba/libtgba.la \
tgbaalgos/libtgbaalgos.la \
tgbaparse/libtgbaparse.la \
......
## 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 = \
allnodes.hh \
atomic_prop.hh \
automatop.hh \
binop.hh \
constant.hh \
formula.hh \
multop.hh \
nfa.hh \
refformula.hh \
unop.hh \
visitor.hh
noinst_LTLIBRARIES = libeltlast.la
libeltlast_la_SOURCES = \
automatop.cc \
nfa.cc
\ No newline at end of file
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// dpartement Systmes Rpartis Coopratifs (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/allnodes.hh
/// \brief Define all ELTL node types.
///
/// This file is usually needed when \b defining a visitor.
#ifndef SPOT_ELTLAST_ALLNODES_HH
# define SPOT_ELTLAST_ALLNODES_HH
# include "binop.hh"
# include "unop.hh"
# include "multop.hh"
# include "atomic_prop.hh"
# include "constant.hh"
# include "automatop.hh"
#endif // SPOT_ELTLAST_ALLNODES_HH
// Copyright (C) 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
// dpartement Systmes Rpartis Coopratifs (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/atomic_prop.hh
/// \brief ELTL atomic propositions
#ifndef SPOT_ELTLAST_ATOMIC_PROP_HH
# define SPOT_ELTLAST_ATOMIC_PROP_HH
# include "formula.hh"
# include "internal/atomic_prop.hh"
namespace spot
{
namespace eltl
{
/// \brief Atomic propositions.
/// \ingroup eltl_ast
typedef spot::internal::atomic_prop<eltl_t> atomic_prop;
}
}
#endif // SPOT_ELTLAST_ATOMICPROP_HH
// 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 "visitor.hh"
#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];
}
}
}
// 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 "multop.hh"
# include "refformula.hh"
# include "nfa.hh"
namespace spot
{
namespace eltl
{
/// \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
// Copyright (C) 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
// dpartement Systmes Rpartis Coopratifs (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/binop.hh
/// \brief ELTL binary operators
///
/// This does not include \c AND and \c OR operators. These are
/// considered to be multi-operand operators (see spot::eltl::multop).
#ifndef SPOT_ELTLAST_BINOP_HH
# define SPOT_ELTLAST_BINOP_HH
# include "formula.hh"
# include "internal/binop.hh"
namespace spot
{
namespace eltl
{
/// \brief Binary operator.
/// \ingroup eltl_ast
typedef spot::internal::binop<eltl_t> binop;
}
}
#endif // SPOT_ELTLAST_BINOP_HH
// 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.
/// \file eltlast/constant.hh
/// \brief ELTL constants
#ifndef SPOT_ELTLAST_CONSTANT_HH
# define SPOT_ELTLAST_CONSTANT_HH
# include "formula.hh"
# include "internal/constant.hh"
namespace spot
{
namespace eltl
{
/// \brief A constant (True or False)
/// \ingroup eltl_ast
typedef spot::internal::constant<eltl_t> constant;
}
}
#endif // SPOT_ELTLAST_CONSTANT_HH
// 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"
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
/// Forward declarations
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.
struct eltl_t
{
typedef spot::eltl::visitor visitor;
typedef spot::eltl::const_visitor const_visitor;
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<eltl_t> formula;
typedef spot::internal::formula_ptr_less_than<eltl_t> formula_ptr_less_than;
typedef spot::internal::formula_ptr_hash<eltl_t> formula_ptr_hash;
}
}
#endif /* !SPOT_ELTLAST_FORMULA_HH_ */
// Copyright (C) 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
// dpartement Systmes Rpartis Coopratifs (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