[PATCH 0/6] Print derivations as trees

Akim Demaille <[email protected]>
Newsgroups gmane.comp.parsers.bison.patches
Message-ID <[email protected]>
Sometimes, understanding the derivations is difficult, because they
are serialized to fit in one line.  For instance, the example taken
from the NEWS file:

    %token ID
    %%
    s: a ID
    a: expr
    expr: expr ID ',' | "expr"

gave

    First example        expr • ID ',' ID $end
    Shift derivation     $accept → [ s → [ a → [ expr → [ expr • ID ',' ] ] ID ] $end ]
    Second example       expr • ID $end
    Reduce derivation    $accept → [ s → [ a → [ expr • ] ID ] $end ]

Printing as trees, it gives:

    First example        expr • ID ',' ID $end
    Shift derivation
      $accept
      ↳ s                      $end
        ↳ a                 ID
          ↳ expr
            ↳ expr • ID ','
    Second example       expr • ID $end
    Reduce derivation
      $accept
      ↳ s             $end
        ↳ a        ID
          ↳ expr •

I'd like to have feedback on this.  I'll update the documentation afterwards.

Cheers.


Akim Demaille (6):
  cex: more colors
  cex: simplify tests
  cex: style changes
  cex: factor the handling of graphical symbols
  cex: use the glyphs
  cex: display derivations as trees

 NEWS                    |  27 ++-
 THANKS                  |   1 +
 data/bison-default.css  |   4 +
 src/counterexample.c    |   7 +-
 src/derivation.c        | 263 +++++++++++++++++++--
 src/glyphs.c            | 103 +++++++++
 src/glyphs.h            |  46 ++++
 src/gram.c              |   4 +-
 src/gram.h              |  39 ----
 src/local.mk            |   2 +
 src/main.c              |   2 +
 tests/conflicts.at      |  64 +++--
 tests/counterexample.at | 500 +++++++++++++++++++++++++++++++++++++---
 tests/diagnostics.at    | 100 +++++++-
 tests/report.at         | 119 ++++++++--
 15 files changed, 1135 insertions(+), 146 deletions(-)
 create mode 100644 src/glyphs.c
 create mode 100644 src/glyphs.h

-- 
2.27.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.