bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 0/8] cex: show counterexamples in the reports


From: Akim Demaille
Subject: [PATCH 0/8] cex: show counterexamples in the reports
Date: Sun, 14 Jun 2020 10:24:54 +0200

This series of commits (https://github.com/akimd/bison/pull/40)
changes the way the counterexamples are shown in the diagnostics, and
introduces them in the reports.

In the terminal, we go from

```
Shift/reduce conflict on token B:
1:    7 a: A .
1:    5 b: . B
Example              A • B C
First derivation     s ::=[ a ::=[ A • ] bc ::=[ B C ] ]
Example              A • B C
Second derivation    s ::=[ ac ::=[ A ac ::=[ b ::=[ • B ] ] C ] ]

```

to

```
Shift/reduce conflict on token B:
  Example              A . B C
  First derivation     s ::=[ a ::=[ A . ] bc ::=[ B C ] ]
  Example              A . B C
  Second derivation    s ::=[ ac ::=[ A ac ::=[ b ::=[ . B ] ] C ] ]
```

In the reports, we go from

```
State 5

    1 exp: exp . OP exp
    1    | exp OP exp .  [$end, OP]

    OP  shift, and go to state 4

    OP        [reduce using rule 1 (exp)]
    $default  reduce using rule 1 (exp)
```

to

```
State 5
 
    1 exp: exp . OP exp
    1    | exp OP exp .  [$end, OP]

    OP  shift, and go to state 4

    OP        [reduce using rule 1 (exp)]
    $default  reduce using rule 1 (exp)

    Shift/reduce conflict on token OP:
        1 exp: exp OP exp .
        1 exp: exp . OP exp
      Example                  exp OP exp . OP exp
      First derivation         exp ::=[ exp ::=[ exp OP exp . ] OP exp ]
      Example                  exp OP exp . OP exp
      Second derivation        exp ::=[ exp OP exp ::=[ exp . OP exp ] ]
```

I would very much like to have comments about this series.

The last commit, which relies on the internationalization of "." to
get "•", is unpleasing: I much prefer "•", of course, but so far we
never required the support of anything but ASCII.  I would like to
avoid this, but so far, I don't have any good solution.  Maybe someone
will provide a better alternative
(https://lists.gnu.org/r/bug-gettext/2020-06/msg00011.html).

Cheers!

Akim Demaille (8):
  style: more uses of const
  cex: add an argument to the reporting functions to specify the stream
  cex: make sure traces go to stderr
  cex: don't report the items
  cex: indent the diagnostics to highlight the structure
  cex: also include the counterexamples in the report
  cex: also include in the report on --report=counterexamples
  cex: factor the definition of "•"

 TODO                    |  29 +++++
 po/POTFILES.in          |   1 +
 src/conflicts.c         |  68 ++---------
 src/conflicts.h         |   2 +
 src/counterexample.c    | 126 +++++++++++++++-----
 src/counterexample.h    |   7 +-
 src/derivation.c        |  16 +--
 src/derivation.h        |   4 +-
 src/getargs.c           |  27 +++--
 src/getargs.h           |   1 +
 src/gram.c              |   2 +-
 src/gram.h              |  14 +++
 src/lssi.c              |   2 +-
 src/main.c              |   3 +-
 src/parse-simulation.c  |  20 ++--
 src/parse-simulation.h  |   1 +
 src/print.c             |  29 +++--
 src/state-item.c        |   8 +-
 src/state-item.h        |   2 +-
 src/state.c             |   8 +-
 src/state.h             |   8 +-
 tests/conflicts.at      |  45 ++++++++
 tests/counterexample.at | 250 ++++++++++++++++------------------------
 tests/existing.at       |   2 +-
 tests/local.at          |   2 +-
 tests/report.at         |  63 +++++++++-
 26 files changed, 436 insertions(+), 304 deletions(-)

-- 
2.27.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]