[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 0/6] Print derivations as trees
From: |
Akim Demaille |
Subject: |
[PATCH 0/6] Print derivations as trees |
Date: |
Sat, 18 Jul 2020 07:59:00 +0200 |
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
- [PATCH 0/6] Print derivations as trees,
Akim Demaille <=
- [PATCH 1/6] cex: more colors, Akim Demaille, 2020/07/18
- [PATCH 2/6] cex: simplify tests, Akim Demaille, 2020/07/18
- [PATCH 3/6] cex: style changes, Akim Demaille, 2020/07/18
- [PATCH 4/6] cex: factor the handling of graphical symbols, Akim Demaille, 2020/07/18
- [PATCH 5/6] cex: use the glyphs, Akim Demaille, 2020/07/18
- [PATCH 6/6] cex: display derivations as trees, Akim Demaille, 2020/07/18