concrete vs. abstract syntax trees

eliben <eliben@gmail.com>
Fri, 13 Feb 2009 08:40:32 -0800 (PST)

          From comp.compilers

Related articles
concrete vs. abstract syntax trees eliben@gmail.com (eliben) (2009-02-13)
Re: concrete vs. abstract syntax trees haberg_20080406@math.su.se (Hans Aberg) (2009-02-14)
Re: concrete vs. abstract syntax trees idbaxter@semdesigns.com (Ira Baxter) (2009-02-14)
Re: concrete vs. abstract syntax trees cfc@shell01.TheWorld.com (Chris F Clark) (2009-02-14)
Re: concrete vs. abstract syntax trees cfc@shell01.TheWorld.com (Chris F Clark) (2009-02-14)
| List of all articles for this month |

From: eliben <eliben@gmail.com>
Newsgroups: comp.compilers
Date: Fri, 13 Feb 2009 08:40:32 -0800 (PST)
Organization: Compilers Central
Keywords: parse, AST
Posted-Date: 14 Feb 2009 05:07:32 EST

Hello,


I'm trying to nail down the difference between concrete and abstract
syntax trees. In my C parser (http://code.google.com/p/pycparser/) I
construct an AST directly from the parser (which uses the yacc-like
PLY Python module), and I'm not sure where the concrete syntax tree is
in that process.


Is this correct to say that if I semi-mechanically translate the BNF
of a language to a yacc grammar, what I'll get from parsing is a
concrete syntax tree? If so, this tree is almost useless for any kind
of interesting interaction (especially for languages like C where some
things like types don't fit hierarchically in a way that resembles the
concrete syntax). Is this right?


Also, do compilers more commonly go through the concrete-syntax stage
or do they usually build the AST directly in the parser?


Thanks in advance,


Eli



Post a followup to this message

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