Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > comp.compilers > #2888
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Re: Graphical representations of syntax trees? |
| Date | 2022-02-07 18:33 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <22-02-009@comp.compilers> (permalink) |
| References | <22-02-004@comp.compilers> <22-02-006@comp.compilers> <22-02-008@comp.compilers> |
Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.com> writes:
>On 2/6/2022 10:32 PM, Anton Ertl wrote:
>> Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.com> writes:
>>> Are there any resources, or papers, about the subject of representing
>>> syntax trees graphically?
>>
>> There are LaTeX modes for displaying trees. There is also the
>> graphviz package for visualizing graphs.
>
>Sure, these are packages. But no actual algorithms, or discussions of
>how to do these things by myself.
Seems pretty trivial to me. If a rule
A: B C
is used for parsing a part of the input, you generate a node for this
rule (e.g., labeled "A"), with nodes for B and C as children. If you
want it to look nice, you arrange for all the terminals to be at the
same (geometrical, not logical) level. I think that's not very hard
with graphviz. Then you get trees like:
E
/|\
F |F
/|\||
1*2+3
A web search for "bison dot files" resulted in
<https://www.gnu.org/software/bison/manual/html_node/Graphviz.html>,
but this describes a visual representation of the parser, not the
parse tree.
>[I suspect the practical problem is that for any but the tiniest programs
>the parse tree will be so large and bushy as to be unreadable. -John]
IIRC (only read about that part, and a long time ago) graphviz
contains a tool that supports folding/unfolding parts of the graph
interactively, exactly because of this problem.
- anton
--
M. Anton Ertl
anton@mips.complang.tuwien.ac.at
http://www.complang.tuwien.ac.at/anton/
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar
Graphical representations of syntax trees? Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.com> - 2022-02-04 20:20 +0000
Re: Graphical representations of syntax trees? gah4 <gah4@u.washington.edu> - 2022-02-06 13:07 -0800
Re: Graphical representations of syntax trees? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2022-02-06 23:38 +0100
Re: Graphical representations of syntax trees? Steve Limb <stephenjohnlimb@gmail.com> - 2022-02-08 09:14 +0000
Re: Graphical representations of syntax trees? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2022-02-06 22:32 +0000
Re: Graphical representations of syntax trees? Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.com> - 2022-02-07 10:49 +0000
Re: Graphical representations of syntax trees? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2022-02-07 18:33 +0000
Re: Graphical representations of syntax trees? Jonathan Thornburg <jonathan@gold.bkis-orchard.net> - 2022-02-08 21:34 +0000
Re: Graphical representations of syntax trees? Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2022-02-11 21:16 +0000
Re: Graphical representations of syntax trees? "Alexei A. Frounze" <alexfrunews@gmail.com> - 2022-02-07 18:17 -0800
csiph-web