acc: add a parser for string -> acc_code
* src/tgba/acc.cc, src/tgba/acc.hh (parse_acc_code): New function. * src/tgbatest/acc.cc, src/tgbatest/acc.test: Test it.
This commit is contained in:
parent
c65bf731fd
commit
dfd080e005
4 changed files with 174 additions and 0 deletions
|
|
@ -127,4 +127,18 @@ int main()
|
|||
auto code3 = ac.inf({0, 1});
|
||||
code3.append_and(ac.fin({2, 3}));
|
||||
std::cout << code3.size() << ' ' << code3 << ' ' << code3.is_dnf() << '\n';
|
||||
|
||||
|
||||
std::cout << spot::parse_acc_code("t") << '\n';
|
||||
std::cout << spot::parse_acc_code("f") << '\n';
|
||||
std::cout << spot::parse_acc_code("Fin(2)") << '\n';
|
||||
std::cout << spot::parse_acc_code("Inf(2)") << '\n';
|
||||
std::cout << spot::parse_acc_code("Fin(2) | Inf(2)") << '\n';
|
||||
std::cout << spot::parse_acc_code("Inf(2) & Fin(2)") << '\n';
|
||||
auto c1 = spot::parse_acc_code("Fin(0)|Inf(1)&Fin(2)|Fin(3)");
|
||||
auto c2 = spot::parse_acc_code
|
||||
("( Fin ( 0 )) | (Inf ( 1) & Fin(2 ))| Fin (3) ");
|
||||
std::cout << c1 << '\n';
|
||||
std::cout << c2 << '\n';
|
||||
assert(c1 == c2);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,14 @@ stripping
|
|||
2 f 1
|
||||
9 (Fin(0)|Fin(1)) | Fin(0) | Fin(2) | (Inf(0)&Inf(1)&Inf(3)) 1
|
||||
5 (Fin(2)|Fin(3)) & (Inf(0)&Inf(1)) 0
|
||||
t
|
||||
f
|
||||
Fin(2)
|
||||
Inf(2)
|
||||
Inf(2) | Fin(2)
|
||||
Fin(2) & Inf(2)
|
||||
Fin(3) | (Fin(2) & Inf(1)) | Fin(0)
|
||||
Fin(3) | (Fin(2) & Inf(1)) | Fin(0)
|
||||
EOF
|
||||
|
||||
run 0 ../acc | tee stdout
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue