hoa: swallow the neverclaim parser

This way we can easily parse a stream of HOAs intermixed with
neverclaims.

* src/hoaparse/hoaparse.yy, src/hoaparse/hoascan.ll: Add rules
for neverclaims, adjusted from src/neverparse/neverclaimparse.yy
and src/neverparse/neverclaimparse.ll.
* src/hoaparse/public.hh, NEWS: Update documentation.
* src/neverparse/: Remove this directory.
* README, configure.ac, src/Makefile.am: Adjust accordingly.
* src/tgbatest/ltl2tgba.cc, src/bin/ltlcross.cc: Use HOA
parser to read neverclaims.
* src/tgbatest/hoaparse.test, src/tgbatest/neverclaimread.test: Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2014-12-03 18:20:35 +01:00
parent 39eefd0c6e
commit e1bba50047
18 changed files with 453 additions and 817 deletions

View file

@ -480,6 +480,7 @@ EOF
diff expected input.out
# Mix HOA with neverclaims
cat >input <<EOF
HOA: v1
States: 2
@ -496,6 +497,22 @@ State: 1
[!0] 1
[0] 0
--END--
never { /* a U b */
T0_init:
if
:: ((b)) -> goto accept_all
:: ((a)) -> goto T0_init
fi;
accept_all:
skip
}
never {
start: if :: false -> goto T0 fi;
T0: false
}
EOF
expectok input <<EOF
@ -519,6 +536,32 @@ State: 2 {0}
[1] 1
[!1] 2
--END--
HOA: v1
States: 2
Start: 0
AP: 2 "b" "a"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc
--BODY--
State: 0
[0] 1
[1] 0
State: 1 {0}
[t] 1
--END--
HOA: v1
States: 2
Start: 0
AP: 0
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc deterministic
--BODY--
State: 0
[f] 1
State: 1
--END--
EOF
cat >input <<EOF
@ -665,17 +708,17 @@ this is complete garbage!
and even more garbage
EOF
se='syntax error, unexpected' # this is just to keep lines short
expecterr input <<EOF
input:8.11: syntax error, unexpected identifier, expecting integer or '}'
input:8.11: $se identifier, expecting integer or '}'
input:8.10-12: ignoring this invalid acceptance set
input:11.2: syntax error, unexpected identifier
input:11.2: $se identifier
input:11.1-3: ignoring this invalid label
input:21.5-7: syntax error, unexpected string, expecting integer
input:25.1-4: syntax error, unexpected identifier, expecting end of file or HOA:
input:21.5-7: $se string, expecting integer
input:25.1: $se \$undefined, expecting end of file or HOA: or never
input:25.1-12: ignoring leading garbage
input:32.1-5: syntax error, unexpected header name, expecting --END-- or State:
input:37.1-4: syntax error, unexpected identifier, expecting end of file or HOA:
input:39.1-3: syntax error, unexpected identifier, expecting end of file or HOA:
input:32.1-5: $se header name, expecting --END-- or State:
input:37.1: $se 't', expecting end of file or HOA: or never
EOF
# A comment can contain --BODY-- or --END--, so we do not want to be

View file

@ -41,7 +41,6 @@
#include "tgba/tgbaproduct.hh"
#include "tgbaalgos/reducerun.hh"
#include "tgbaparse/public.hh"
#include "neverparse/public.hh"
#include "dstarparse/public.hh"
#include "hoaparse/public.hh"
#include "tgbaalgos/dupexp.hh"
@ -358,8 +357,7 @@ checked_main(int argc, char** argv)
bool accepting_run = false;
bool accepting_run_replay = false;
bool from_file = false;
enum { ReadSpot, ReadLbtt, ReadNeverclaim, ReadDstar, ReadHoa } readformat
= ReadSpot;
enum { ReadSpot, ReadLbtt, ReadDstar, ReadHoa } readformat = ReadSpot;
bool nra2nba = false;
bool dra2dba = false;
bool scc_filter = false;
@ -936,10 +934,10 @@ checked_main(int argc, char** argv)
from_file = true;
readformat = ReadLbtt;
}
else if (!strcmp(argv[formula_index], "-XN"))
else if (!strcmp(argv[formula_index], "-XN")) // now synonym for -XH
{
from_file = true;
readformat = ReadNeverclaim;
readformat = ReadHoa;
}
else if (!strcmp(argv[formula_index], "-y"))
{
@ -1031,20 +1029,6 @@ checked_main(int argc, char** argv)
e->merge_transitions();
}
break;
case ReadNeverclaim:
{
spot::tgba_digraph_ptr e;
spot::neverclaim_parse_error_list pel;
tm.start("parsing neverclaim");
a = e = spot::neverclaim_parse(input, pel, dict,
env, debug_opt);
tm.stop("parsing neverclaim");
if (spot::format_neverclaim_parse_errors(std::cerr, input, pel))
return 2;
assume_sba = true;
e->merge_transitions();
}
break;
case ReadLbtt:
{
std::string error;
@ -1113,8 +1097,9 @@ checked_main(int argc, char** argv)
tm.stop("parsing hoa");
if (spot::format_hoa_parse_errors(std::cerr, input, pel))
return 2;
daut->aut->merge_transitions();
a = daut->aut;
assume_sba = false;
assume_sba = a->is_sba();
}
break;
}

View file

@ -169,7 +169,7 @@ EOF
run 2 ../ltl2tgba -XN input > stdout 2>stderr
cat >expected <<\EOF
input:9.16: syntax error, unexpected $undefined, expecting fi or ':'
input:9.16: syntax error, unexpected ')', expecting fi or ':'
EOF
grep input: stderr > stderrfilt
diff stderrfilt expected