ltlcheck.cc 18.9 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// -*- coding: utf-8 -*-
// Copyright (C) 2012 Laboratoire de Recherche et Développement de
// l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.


#include "common_sys.hh"

#include <string>
#include <iostream>
#include <sstream>
26
#include <fstream>
27
28
29
30
#include <cstdlib>
#include <cstdio>
#include <argp.h>
#include "error.h"
31
#include "gethrxtime.h"
32
33
34
35
36
37
38
39
40

#include "common_setup.hh"
#include "common_cout.hh"
#include "common_finput.hh"
#include "neverparse/public.hh"
#include "ltlast/unop.hh"
#include "ltlvisit/tostring.hh"
#include "ltlvisit/apcollect.hh"
#include "ltlvisit/lbt.hh"
41
#include "tgbaalgos/lbtt.hh"
42
43
44
45
46
#include "tgba/tgbaproduct.hh"
#include "tgbaalgos/gtec/gtec.hh"
#include "tgbaalgos/randomgraph.hh"
#include "tgbaalgos/scc.hh"
#include "tgbaalgos/dotty.hh"
47
#include "misc/formater.hh"
48
49
#include "tgbaalgos/stats.hh"
#include "tgbaalgos/isdet.hh"
50
51
52
53
54
55
56

const char argp_program_doc[] ="\
Call several LTL/PSL translators and cross-compare their output to detect \
bugs, or to gather statistics.  The list of formula to use should be \
supplied on standard input, or using the -f or -F options.\v\
Examples:\n\
\n\
57
58
  Compare neverclaim produced by ltl2tgba and spin for 100 random formulas:\n\
  % randltl -n 100 --tree-size 20..30 a b c | \\\n\
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
    ltlcheck 'ltl2tgba -s %f > %N' 'spin -f %s > %N'\n\
";


#define OPT_STATES 1
#define OPT_DENSITY 2

static const argp_option options[] =
  {
    /**************************************************/
    { 0, 0, 0, 0, "Specifying translator to call:", 2 },
    { "translator", 't', "COMMANDFMT", 0,
      "register one translators to call", 0 },
    /**************************************************/
    { 0, 0, 0, 0,
      "COMMANDFMT should specify input and output arguments using the "
      "following character sequences:", 3 },
    { "%f,%s,%l", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
      "the formula as a (quoted) string in Spot, Spin, or LBT's syntax", 0 },
    { "%F,%S,%L", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
      "the formula as a file in Spot, Spin, or LBT's syntax", 0 },
80
81
    { "%N,%T", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
      "the output automaton as a Never claim, or in LBTT's format", 0 },
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
    /**************************************************/
    { 0, 0, 0, 0, "State-space generation:", 4 },
    { "states", OPT_STATES, "INT", 0,
      "number of the states in the state-spaces (200 by default)", 0 },
    { "density", OPT_DENSITY, "FLOAT", 0,
      "probability, between 0.0 and 1.0, to add a transition between "
      "two states (0.1 by default)", 0 },
    /**************************************************/
    { 0, 0, 0, 0, "Miscellaneous options:", -1 },
    { 0, 0, 0, 0, 0, 0 }
  };

const struct argp_child children[] =
  {
    { &finput_argp, 0, 0, 1 },
    { 0, 0, 0, 0 }
  };

spot::bdd_dict dict;
unsigned states = 200;
float density = 0.1;

std::vector<char*> translators;

106
107
108
109
110
111
112
113
114
115
struct statistics
{
  bool ok;
  unsigned states;
  unsigned edges;
  unsigned transitions;
  unsigned acc;
  unsigned scc;
  unsigned nondetstates;
  bool nondeterministic;
116
  double time;
117
118
119
120
121
122
123
124
125
126
127
128
129
130
  unsigned product_states;
  unsigned product_transitions;
  unsigned product_scc;

  static void
  fields(std::ostream& os)
  {
    os << ("    \"states\",\n"
	   "    \"edges\",\n"
	   "    \"transitions\",\n"
	   "    \"acc\",\n"
	   "    \"scc\",\n"
	   "    \"nondetstates\",\n"
	   "    \"nondeterministic\",\n"
131
	   "    \"time\",\n"
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
	   "    \"product_states\",\n"
	   "    \"product_transitions\",\n"
	   "    \"product_scc\"");
  }

  void
  to_csv(std::ostream& os)
  {
    os << states << ", "
       << edges << ", "
       << transitions << ", "
       << acc << ", "
       << scc << ", "
       << nondetstates << ", "
       << nondeterministic << ", "
147
       << time << ", "
148
149
150
151
152
153
154
155
156
157
158
       << product_states << ", "
       << product_transitions << ", "
       << product_scc;
  }
};

typedef std::vector<statistics> statistics_formula;
typedef std::vector<statistics_formula> statistics_vector;
statistics_vector vstats;
std::vector<std::string> formulas;

159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
static int
to_int(const char* s)
{
  char* endptr;
  int res = strtol(s, &endptr, 10);
  if (*endptr)
    error(2, 0, "failed to parse '%s' as an integer.", s);
  return res;
}

static int
to_pos_int(const char* s)
{
  int res = to_int(s);
  if (res < 0)
    error(2, 0, "%d is not positive", res);
  return res;
}

static float
to_float(const char* s)
{
  char* endptr;
  // Do not use strtof(), it does not exist on Solaris 9.
  float res = strtod(s, &endptr);
  if (*endptr)
    error(2, 0, "failed to parse '%s' as a float.", s);
  return res;
}

static float
to_probability(const char* s)
{
  float res = to_float(s);
  if (res < 0.0 || res > 1.0)
    error(2, 0, "%f is not between 0 and 1.", res);
  return res;
}


static int
parse_opt(int key, char* arg, struct argp_state*)
{
  // This switch is alphabetically-ordered.
  switch (key)
    {
    case 't':
    case ARGP_KEY_ARG:
      translators.push_back(arg);
      break;
    case OPT_DENSITY:
      density = to_probability(arg);
      break;
    case OPT_STATES:
      states = to_pos_int(arg);
      break;
    default:
      return ARGP_ERR_UNKNOWN;
    }
  return 0;
}

static int
222
create_tmpfile(char c, unsigned int n, std::string& name)
223
224
{
  char tmpname[30];
225
  snprintf(tmpname, sizeof tmpname, "lck-%c%u-XXXXXX", c, n);
226
227
228
229
230
231
232
  int fd = mkstemp(tmpname);
  if (fd == -1)
    error(2, errno, "failed to create a temporary file");
  name = tmpname;
  return fd;
}

233
namespace
234
{
235
236
237
  struct quoted_string: public spot::printable_value<std::string>
  {
    using spot::printable_value<std::string>::operator=;
238

239
240
241
242
243
244
245
246
    void
    print(std::ostream& os, const char* pos) const
    {
      os << '\'';
      this->spot::printable_value<std::string>::print(os, pos);
      os << '\'';
    }
  };
247

248
249
250
251
252
  struct printable_result_filename: public spot::printable_value<std::string>
  {
    unsigned translator_num;
    enum output_format { None, Spin, Lbtt };
    mutable output_format format;
253

254
255
256
257
258
259
    void reset(unsigned n)
    {
      val_.clear();
      translator_num = n;
      format = None;
    }
260

261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
    void
    print(std::ostream& os, const char* pos) const
    {
      if (*pos == 'N')
	format = Spin;
      else
	format = Lbtt;
      if (!val_.empty())
	error(2, 0, "you may have only one %%N or %%T specifier: %s",
	      translators[translator_num]);
      close(create_tmpfile('o', translator_num,
			   const_cast<std::string&>(val_)));
      os << '\'' << val_ << '\'';
    }
  };
276

277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
  class translator_runner: protected spot::formater
  {
  private:
    // Round-specific variables
    quoted_string string_ltl_spot;
    quoted_string string_ltl_spin;
    quoted_string string_ltl_lbt;
    quoted_string filename_ltl_spot;
    quoted_string filename_ltl_spin;
    quoted_string filename_ltl_lbt;
    std::list<std::string> toclean;
    // Run-specific variables
    printable_result_filename output;
  public:
    translator_runner()
    {
      declare('f', &string_ltl_spot);
      declare('s', &string_ltl_spin);
      declare('l', &string_ltl_lbt);
      declare('F', &filename_ltl_spot);
      declare('S', &filename_ltl_spin);
      declare('L', &filename_ltl_lbt);
      declare('N', &output);
      declare('T', &output);

      size_t s = translators.size();
      assert(s);
      for (size_t n = 0; n < s; ++n)
	prime(translators[n]);
306

307
308
309
    }

    // Cleanup temporary files.
310
311
    void
    round_cleanup()
312
    {
313
314
315
316
      for (std::list<std::string>::const_iterator i = toclean.begin();
	   i != toclean.end(); ++i)
	unlink(i->c_str());
      toclean.clear();
317
    }
318
319
320

    void
    string_to_tmp(std::string& str, unsigned n, std::string& tmpname)
321
    {
322
323
324
325
326
327
328
      int fd = create_tmpfile('i', n, tmpname);
      write(fd, str.c_str(), str.size());
      write(fd, "\n", 1);
      close(fd);
      toclean.push_back(tmpname);
    }

329
330
    const std::string&
    formula() const
331
332
333
334
335
336
337
338
339
340
341
342
    {
      // Pick the most readable format we have...
      if (!string_ltl_spot.val().empty())
	return string_ltl_spot;
      if (!string_ltl_spin.val().empty())
	return string_ltl_spin;
      if (!string_ltl_lbt.val().empty())
	return string_ltl_lbt;
      error(2, 0, "None of the translators need the input formula?");
      return string_ltl_spot;
    }

343
344
    void
    round_formula(const spot::ltl::formula* f, unsigned serial)
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
    {
      if (has('f') || has('F'))
	string_ltl_spot = spot::ltl::to_string(f, true);
      if (has('s') || has('S'))
	string_ltl_spin = spot::ltl::to_spin_string(f, true);
      if (has('l') || has('L'))
	string_ltl_lbt = spot::ltl::to_lbt_string(f);
      if (has('F'))
	string_to_tmp(string_ltl_spot, serial, filename_ltl_spot);
      if (has('S'))
	string_to_tmp(string_ltl_spin, serial, filename_ltl_spin);
      if (has('L'))
	string_to_tmp(string_ltl_lbt, serial, filename_ltl_lbt);
    }

360
361
    const spot::tgba*
    translate(unsigned int translator_num, char l, statistics_formula* fstats)
362
363
364
365
366
367
368
369
370
    {
      output.reset(translator_num);

      std::ostringstream command;
      format(command, translators[translator_num]);
      toclean.push_back(output.val());
      std::string cmd = command.str();
      std::cerr << "Running [" << l << translator_num << "]: "
		<< cmd << std::endl;
371
      xtime_t before = gethrxtime();
372
      int es = system(cmd.c_str());
373
      xtime_t after = gethrxtime();
374
375
376

      const spot::tgba* res = 0;
      if (es)
377
	{
378
379
380
381
382
383
384
385
386
	  std::cerr << "Execution of: " << cmd << "\n"
		    << "  returned exit code " << WEXITSTATUS(es)
		    << ".\n";
	}
      else
	{
	  switch (output.format)
	    {
	    case printable_result_filename::Spin:
387
	      {
388
389
390
391
392
393
394
395
396
397
398
		spot::neverclaim_parse_error_list pel;
		res = spot::neverclaim_parse(output, pel, &dict);
		if (!pel.empty())
		  {
		    std::cerr << "Failed to parse the produced neverclaim.\n";
		    spot::format_neverclaim_parse_errors(std::cerr,
							 output, pel);
		    delete res;
		    res = 0;
		  }
		break;
399
	      }
400
	    case printable_result_filename::Lbtt:
401
	      {
402
403
404
405
406
407
408
409
410
		std::string error;
		std::fstream f(output.val().c_str());
		if (!f)
		  {
		    std::cerr << "Cannot open " << output.val() << std::endl;
		  }
		else
		  {
		    res = spot::lbtt_parse(f, output.val(), &dict);
411
412
413
414
		    if (!res)
		      std::cerr << ("Failed error to parse output in "
				    "LBTT format: ")
				<< error << std::endl;
415
416
		  }
		break;
417
	      }
418
419
420
	    case printable_result_filename::None:
	      assert(!"unreachable code");
	    }
421
	}
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
      // Compute statistics.
      if (res)
	{
	  statistics* st = &(*fstats)[translator_num];
	  st->ok = true;
	  spot::tgba_sub_statistics s = sub_stats_reachable(res);
	  st->states = s.states;
	  st->edges = s.transitions;
	  st->transitions = s.sub_transitions;
	  st->acc = res->number_of_acceptance_conditions();
	  spot::scc_map m(res);
	  m.build_map();
	  st->scc = m.scc_count();
	  st->nondetstates = spot::count_nondet_states(res);
	  st->nondeterministic = st->nondetstates != 0;
437
438
          double prec = XTIME_PRECISION;
	  st->time = (after - before) / prec;
439
	}
440
      return res;
441
    }
442
  };
443

444
445
446
447
448
449
450
451
452
453
454
455
456
457
  static bool
  is_empty(const spot::tgba* aut)
  {
    spot::emptiness_check* ec = spot::couvreur99(aut);
    spot::emptiness_check_result* res = ec->check();
    delete res;
    delete ec;
    return !res;
  }

  static void
  cross_check(const std::vector<spot::scc_map*>& maps, char l)
  {
    size_t m = maps.size();
458

459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
    std::vector<bool> res(m);
    unsigned verified = 0;
    unsigned violated = 0;
    for (size_t i = 0; i < m; ++i)
      if (spot::scc_map* m = maps[i])
	{
	  // r == true iff the automaton i is accepting.
	  bool r = false;
	  unsigned c = m->scc_count();
	  for (unsigned j = 0; (j < c) && !r; ++j)
	    r |= m->accepting(j);
	  res[i] = r;
	  if (r)
	    ++verified;
	  else
	    ++violated;
	}
    if (verified != 0 && violated != 0)
477
      {
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
	std::cerr << "error: {";
	bool first = true;
	for (size_t i = 0; i < m; ++i)
	  if (maps[i] && res[i])
	    {
	      if (first)
		first = false;
	      else
		std::cerr << ",";
	      std::cerr << l << i;
	    }
	std::cerr << "} disagree with {";
	first = true;
	for (size_t i = 0; i < m; ++i)
	  if (maps[i] && !res[i])
	    {
	      if (first)
		first = false;
	      else
		std::cerr << ",";
	      std::cerr << l << i;
	    }
	std::cerr << "} when evaluating the state-space\n";
501
      }
502
  }
503

504
  typedef std::set<spot::state*, spot::state_ptr_less_than> state_set;
505

506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
  // Collect all the states of SSPACE that appear in the accepting SCCs
  // of PROD.
  static void
  states_in_acc(const spot::scc_map* m, const spot::tgba* sspace,
		state_set& s)
  {
    const spot::tgba* aut = m->get_aut();
    unsigned c = m->scc_count();
    for (unsigned n = 0; n < c; ++n)
      if (m->accepting(n))
	{
	  const std::list<const spot::state*>& l = m->states_of(n);
	  for (std::list<const spot::state*>::const_iterator i = l.begin();
	       i != l.end(); ++i)
	    {
	      spot::state* x = aut->project_state(*i, sspace);
	      if (!s.insert(x).second)
		x->destroy();
	    }
	}
  }
527

528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
  static bool
  consistency_check(const spot::scc_map* pos, const spot::scc_map* neg,
		    const spot::tgba* sspace)
  {
    // the states of SSPACE should appear in the accepting SCC of at
    // least one of POS or NEG.  Maybe both.
    state_set s;
    states_in_acc(pos, sspace, s);
    states_in_acc(neg, sspace, s);
    bool res = s.size() == states;
    state_set::iterator it;
    for (it = s.begin(); it != s.end(); it++)
      (*it)->destroy();
    return res;
  }
543
544
545

  class processor: public job_processor
  {
546
547
    translator_runner runner;

548
549
550
551
552
553
554
  public:
    int
    process_formula(const spot::ltl::formula* f,
		    const char* filename = 0, int linenum = 0)
    {
      (void) filename;
      (void) linenum;
555
      static unsigned round = 0;
556

557
558
559
560
561
      size_t m = translators.size();

      std::vector<const spot::tgba*> pos(m);
      std::vector<const spot::tgba*> neg(m);

562
563
564
565
566
567
568
569
570
      unsigned n = vstats.size();
      vstats.resize(n + 2);
      statistics_formula* pstats = &vstats[n];
      statistics_formula* nstats = &vstats[n + 1];
      pstats->resize(m);
      nstats->resize(m);

      // ---------- Positive Formula ----------

571
      runner.round_formula(f, round);
572

573
574
575
      // Call formula() before printing anything else, in case it
      // complains.
      std::string fstr = runner.formula();
576
577
578
579
580
581
      if (filename)
	std::cerr << filename << ":";
      if (linenum)
	std::cerr << linenum << ":";
      if (filename || linenum)
	std::cerr << " ";
582
      std::cerr << fstr << "\n";
583

584
585
      formulas.push_back(fstr);

586
      for (size_t n = 0; n < m; ++n)
587
588
589
	pos[n] = runner.translate(n, 'P', pstats);

      // ---------- Negative Formula ----------
590

591
592
      const spot::ltl::formula* nf =
	spot::ltl::unop::instance(spot::ltl::unop::Not, f->clone());
593

594
      runner.round_formula(nf, round);
595
596
      formulas.push_back(runner.formula());

597
      for (size_t n = 0; n < m; ++n)
598
	neg[n] = runner.translate(n, 'N', nstats);
599
600

      runner.round_cleanup();
601
      ++round;
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632

      spot::ltl::atomic_prop_set* ap = spot::ltl::atomic_prop_collect(f);

      // intersection test
      for (size_t i = 0; i < m; ++i)
	if (pos[i])
	  for (size_t j = 0; j < m; ++j)
	    if (neg[j])
	      {
		spot::tgba_product* prod =
		  new spot::tgba_product(pos[i], neg[j]);
		if (!is_empty(prod))
		  std::cerr << "error: P" << i << "*N" << j << " is nonempty\n";
		delete prod;
	      }

      // build products with a random state-space.
      spot::tgba* statespace = spot::random_graph(states, density, ap, &dict);

      std::vector<spot::tgba*> pos_prod(m);
      std::vector<spot::tgba*> neg_prod(m);
      std::vector<spot::scc_map*> pos_map(m);
      std::vector<spot::scc_map*> neg_map(m);
      for (size_t i = 0; i < m; ++i)
	if (pos[i])
	  {
	    spot::tgba* p = new spot::tgba_product(pos[i], statespace);
	    pos_prod[i] = p;
	    spot::scc_map* sm = new spot::scc_map(p);
	    sm->build_map();
	    pos_map[i] = sm;
633
634
635
636
637
638

	    // Statistics
	    (*pstats)[i].product_scc = sm->scc_count();
	    spot::tgba_statistics s = spot::stats_reachable(p);
	    (*pstats)[i].product_states = s.states;
	    (*pstats)[i].product_transitions = s.transitions;
639
640
641
642
643
644
645
646
647
	  }
      for (size_t i = 0; i < m; ++i)
	if (neg[i])
	  {
	    spot::tgba* p = new spot::tgba_product(neg[i], statespace);
	    neg_prod[i] = p;
	    spot::scc_map* sm = new spot::scc_map(p);
	    sm->build_map();
	    neg_map[i] = sm;
648
649
650
651
652
653

	    // Statistics
	    (*nstats)[i].product_scc = sm->scc_count();
	    spot::tgba_statistics s = spot::stats_reachable(p);
	    (*nstats)[i].product_states = s.states;
	    (*nstats)[i].product_transitions = s.transitions;
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
	  }

      // cross-comparison test
      cross_check(pos_map, 'P');
      cross_check(neg_map, 'N');

      // consistency check
      for (size_t i = 0; i < m; ++i)
	if (pos_map[i] && neg_map[i] &&
	    !(consistency_check(pos_map[i], neg_map[i], statespace)))
	  {
	    std::cerr << "error: inconsistency between P" << i
		      << " and N" << i << "\n";
	  }

      // Cleanup.
      delete ap;
      nf->destroy();
      f->destroy();

      for (size_t n = 0; n < m; ++n)
	{
	  delete neg_map[n];
	  delete neg_prod[n];
	  delete pos_map[n];
	  delete pos_prod[n];
	}

      delete statespace;

      for (size_t n = 0; n < m; ++n)
	{
	  delete neg[n];
	  delete pos[n];
	}

      return 0;
    }
  };
}

695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
static void
print_stats_json()
{
  unsigned rounds = vstats.size();
  if (!rounds)
    return;
  unsigned ntrans = translators.size();
  assert(rounds = formulas.size());

  std::cout << "{\n  tools: [\n    \"" << translators[0];
  for (unsigned t = 1; t < ntrans; ++t)
    std::cout << "\",\n    \"" << translators[t];
  std::cout << "\"\n  ],\n  inputs: [\n    \"" << formulas[0];
  for (unsigned r = 1; r < rounds; ++r)
    std::cout << "\",\n    \"" << formulas[r];
  std::cout << ("\"\n  ],\n  fields: [\n    \"input\",\n"
		"    \"tool\",\n");
  statistics::fields(std::cout);
  std::cout << "\n  ],\n  results: [";
  bool notfirst = false;
  for (unsigned r = 0; r < rounds; ++r)
    for (unsigned t = 0; t < ntrans; ++t)
      if (vstats[r][t].ok)
	{
	  if (notfirst)
	    std::cout << ",";
	  notfirst = true;
	  std::cout << "\n    [ " << r << ", " << t << ", ";
	  vstats[r][t].to_csv(std::cout);
	  std::cout << " ]";
	}
  std::cout << "\n  ]\n}\n";
}
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749

int
main(int argc, char** argv)
{
  setup(argv);

  const argp ap = { options, parse_opt, "[COMMANDFMT...]",
		    argp_program_doc, children, 0, 0 };

  if (int err = argp_parse(&ap, argc, argv, 0, 0, 0))
    exit(err);

  if (jobs.empty())
    jobs.push_back(job("-", 1));

  if (translators.empty())
    error(2, 0, "No translator to run?  Run '%s --help' for usage.",
	  program_name);

  processor p;
  if (p.run())
    return 2;
750
751

  print_stats_json();
752
753
  return 0;
}