Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #1810

Re: Alternatives to Syntax Trees

From George Neuner <gneuner2@comcast.net>
Newsgroups comp.compilers
Subject Re: Alternatives to Syntax Trees
Date 2017-01-16 06:11 -0500
Organization A noiseless patient Spider
Message-ID <17-01-004@comp.compilers> (permalink)
References <17-01-002@comp.compilers>

Show all headers | View raw


On Sun, 15 Jan 2017 16:52:15 -0500 (EST), Seima Rao
<seimarao@gmail.com> wrote:

>    Are there alternatives to syntax trees(i.e. the tree data structure)
>    when compiling via yacc or yacc like  tools ?

Parser tools don't limit the structure of the intermediate
representation.

>[There's quadruples, doubly linked lists of data structures.  They
>make it easier to rearrange code, but harder to do just about anything
>else.  There's also DAGs, which are trees that can have shared subtrees,
>useful when you're doing common subexpressions or tail merging. -John]

To add a bit to John's excellent response:

You can use a combined representation: e.g., a graph to represent
control - function defintions, loops, conditionals, etc. - and within
the graph use 3-address form to represent basic blocks (straight line
code).

Some analyses, e.g., determining dominance for EBB def/kill chains,
require both the basic blocks and the graph of their connectivity.


Also, "quadruples" are one form of 3-address representation.  There
are other forms of 3-address and you can implement them using either
lists or arrays.  Quadruples are the most commonly used because - as
John mentioned - they are the easiest to rearrange.

George

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


Thread

Alternatives to Syntax Trees Seima Rao <seimarao@gmail.com> - 2017-01-15 16:52 -0500
  Re: Alternatives to Syntax Trees Kaz Kylheku <221-501-9011@kylheku.com> - 2017-01-15 22:31 +0000
  Re: Alternatives to Syntax Trees George Neuner <gneuner2@comcast.net> - 2017-01-16 06:11 -0500
  Re: Alternatives to Syntax Trees rpw3@rpw3.org (Rob Warnock) - 2017-01-16 12:12 +0000
    Alternatives to Syntax Trees Seima Rao <seimarao@gmail.com> - 2017-01-17 14:16 +0530
      Re: Alternatives to Syntax Trees Kaz Kylheku <221-501-9011@kylheku.com> - 2017-01-17 22:39 +0000
      Re: Alternatives to Syntax Trees George Neuner <gneuner2@comcast.net> - 2017-01-17 22:08 -0500

csiph-web