Re: Alternatives to Syntax Trees

Kaz Kylheku <221-501-9011@kylheku.com>
Sun, 15 Jan 2017 22:31:45 +0000 (UTC)

          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: Kaz Kylheku <221-501-9011@kylheku.com>
Newsgroups: comp.compilers
Date: Sun, 15 Jan 2017 22:31:45 +0000 (UTC)
Organization: Aioe.org NNTP Server
References: 17-01-002
Injection-Info: miucha.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="32457"; mail-complaints-to="abuse@iecc.com"
Keywords: parse, optimize
Posted-Date: 16 Jan 2017 09:21:28 EST

On 2017-01-15, Seima Rao <seimarao@gmail.com> wrote:
> Hi,
>
> Are there alternatives to syntax trees(i.e. the tree data structure)
> when compiling via yacc or yacc like tools ?


If the language you are parsing has a context-free grammar suitable for
Yacc, then the parse corresponds to a tree. More precisely, a real-world
parse corresponds to a DAG: a tree in which some nodes are shared. For
instance if you're parsing Lisp, an input like (a a a) is converted to
DAG in which all three occurences of "a" point to the same symbol
object. This is because the symbols are "interned" as scanning takes
place.


Compilers do not use the tree data structure in all passes. Syntax
trees represent only the raw syntax. An intermediate representation
may be quite different: a graph containing chunks of instruction
sequences.


--
TXR Programming Lanuage: http://nongnu.org/txr
Music DIY Mailing List: http://www.kylheku.com/diy
ADA MP-1 Mailing List: http://www.kylheku.com/mp1



Post a followup to this message

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