ltlprod.cc 1.95 KB
Newer Older
1
// -*- coding: utf-8 -*-
2
3
// Copyright (C) 2008, 2009, 2012, 2014, 2015, 2016 Laboratoire de
// Recherche et Développement de l'Epita (LRDE).
Guillaume Sadegh's avatar
Guillaume Sadegh committed
4
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de
5
6
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
7
8
9
10
11
//
// 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
12
// the Free Software Foundation; either version 3 of the License, or
13
14
15
16
17
18
19
20
// (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
21
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
22

23
24
#include <iostream>
#include <cassert>
25
#include <cstdlib>
26
27
28
29
#include <spot/tl/parse.hh>
#include <spot/twaalgos/product.hh>
#include <spot/twaalgos/ltl2tgba_fm.hh>
#include <spot/twaalgos/dot.hh>
30

31
static void
32
33
34
35
36
37
38
39
40
41
42
43
44
45
syntax(char* prog)
{
  std::cerr << prog << " formula1 formula2" << std::endl;
  exit(2);
}

int
main(int argc, char** argv)
{
  int exit_code = 0;

  if (argc != 3)
    syntax(argv[0]);

46
  {
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
47
    spot::environment& env(spot::default_environment::instance());
48

49
50
    auto pf1 = spot::parse_infix_psl(argv[1], env);
    if (pf1.format_errors(std::cerr))
51
      return 2;
52
    auto f1 = pf1.f;
53

54
55
    auto pf2 = spot::parse_infix_psl(argv[2], env);
    if (pf2.format_errors(std::cerr))
56
      return 2;
57
    auto f2 = pf2.f;
58

59
60
61
62
    auto dict = spot::make_bdd_dict();
    {
      auto a1 = spot::ltl_to_tgba_fm(f1, dict);
      auto a2 = spot::ltl_to_tgba_fm(f2, dict);
63
      spot::print_dot(std::cout, product(a1, a2));
64
    }
65
  }
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
66
  assert(spot::fnode::instances_check());
67
68
  return exit_code;
}