Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.compilers > #2884

Re: Graphical representations of syntax trees?

From gah4 <gah4@u.washington.edu>
Newsgroups comp.compilers
Subject Re: Graphical representations of syntax trees?
Date 2022-02-06 13:07 -0800
Organization Compilers Central
Message-ID <22-02-005@comp.compilers> (permalink)
References <22-02-004@comp.compilers>

Show all headers | View raw


On Sunday, February 6, 2022 at 10:28:41 AM UTC-8, Johann 'Myrkraverk' Oskarsson wrote:

> Are there any resources, or papers, about the subject of representing
> syntax trees graphically? Given the idea that a compiler reads syntax
> and generates code, all I have to do to "print" it, is to generate post-
> script. Surely this has been done before.

I think you mean what is sometimes called a parse tree.  It might be that
syntax tree sometimes has other meanings.

For an undergraduate linguistics class, I wrote a program to do parse trees
for English sentences. (Drawn on a Tektronix 4010, as that was before
Postscript.)  I believe at the same time I was taking the compilers class.

I added rules to the program, put some sentence into it, and printed out
the result.  Added more rules, and printed out more.  In the end, maybe
after I turned in the project, I found that it wouldn't correctly parse the
earlier ones. Note that there are many ambiguities in English, so one
should not be surprised when it finds the wrong tree.

The main complication with doing this, is positioning the items
on the page.  If you have unlimited page width, it isn't so bad, but often
they come out wider than you might like.  So you need extra logic to
make the page look nice to humans, which often isn't so natural.

I do remember knowing about programs to print out flow charts,
but that is different. But it also has the same problem of positioning
on the page.

Back to comp.compilers | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

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