Re: Alternatives to Syntax Trees

George Neuner <gneuner2@comcast.net>
Mon, 16 Jan 2017 06:11:27 -0500

          From comp.compilers

Related articles
Alternatives to Syntax Trees seimarao@gmail.com (Seima Rao) (2017-01-15)
Re: Alternatives to Syntax Trees 221-501-9011@kylheku.com (Kaz Kylheku) (2017-01-15)
Re: Alternatives to Syntax Trees gneuner2@comcast.net (George Neuner) (2017-01-16)
Re: Alternatives to Syntax Trees rpw3@rpw3.org (2017-01-16)
Alternatives to Syntax Trees seimarao@gmail.com (Seima Rao) (2017-01-17)
Re: Alternatives to Syntax Trees 221-501-9011@kylheku.com (Kaz Kylheku) (2017-01-17)
Re: Alternatives to Syntax Trees gneuner2@comcast.net (George Neuner) (2017-01-17)
| List of all articles for this month |
From: George Neuner <gneuner2@comcast.net>
Newsgroups: comp.compilers
Date: Mon, 16 Jan 2017 06:11:27 -0500
Organization: A noiseless patient Spider
References: 17-01-002
Injection-Info: miucha.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="32746"; mail-complaints-to="abuse@iecc.com"
Keywords: parse, optimize
Posted-Date: 16 Jan 2017 09:22:14 EST

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


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.