Re: Incorporating comments in syntax tree?

solution@gate.net (Ken Walter)
1 Feb 1996 21:43:47 -0500

          From comp.compilers

Related articles
Incorporating comments in syntax tree? ag129@ucs.cam.ac.uk (1996-01-30)
Re: Incorporating comments in syntax tree? Steve_Kilbane@cegelecproj.co.uk (1996-01-31)
Re: Incorporating comments in syntax tree? ok@cs.rmit.edu.au (1996-02-01)
Re: Incorporating comments in syntax tree? solution@gate.net (1996-02-01)
Re: Incorporating comments in syntax tree? synaptx!thymus!daveg@uunet.uu.net (Dave Gillespie) (1996-02-02)
Re: Incorporating comments in syntax tree? nadav@cc.huji.ac.il (Nadav Aharoni) (1996-02-02)
Re: Incorporating comments in syntax tree? cef@geodesic.com (Charles Fiterman) (1996-02-02)
Re: Incorporating comments in syntax tree? Uwe.Assmann@inria.fr (1996-02-09)
Re: Incorporating comments in syntax tree? greg.titus@attws.com (Greg Titus) (1996-02-13)
Re: Incorporating comments in syntax tree? Conor@puddle.demon.co.uk (Conor O'Neill) (1996-02-23)
| List of all articles for this month |
From: solution@gate.net (Ken Walter)
Newsgroups: comp.compilers,comp.compilers.tools.pccts
Date: 1 Feb 1996 21:43:47 -0500
Organization: Solution Technology
References: 96-01-121
Keywords: parse, analysis

ag129@ucs.cam.ac.uk (A. Grant) writes:
> Does anyone know of any techniques for reading comments in compiler
> input and associating them with the syntax tree [...] .


I use all sorts of special code in the lex scanner. If a comment
starts a line then it and all other whole line comments following it
are attached to the next token. Otherwise it is attached to the
previous token.


This way comments become attributes and are not part of the syntax.


The semantic processing then moves the information around the parse
tree as needed and does what it needs to the comment.


Ken Walter
--


Post a followup to this message

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