Re: QUESTION: saving source locations during parse

rekers@wi.leidenuniv.nl (Jan Rekers)
Mon, 26 Jun 1995 13:29:14 GMT

          From comp.compilers

Related articles
QUESTION: saving source locations during parsing bwb@concentra.com (Brent Benson) (1995-06-24)
Re: QUESTION: saving source locations during parse rekers@wi.leidenuniv.nl (1995-06-26)
| List of all articles for this month |

Newsgroups: comp.compilers
From: rekers@wi.leidenuniv.nl (Jan Rekers)
Keywords: parse
Organization: Dept. Computer Science, Leiden University, the Netherlands
References: 95-06-050
Date: Mon, 26 Jun 1995 13:29:14 GMT
Status: RO

Brent Berson wrote:
> I would like to be able to save the beginning and ending source code
> location of each piece of concrete syntax inside the abstract syntax
> node that represents the syntax form.


It would by quite simple to change the lexical scanner such that it
doesn't return a simple token, but a structure which also contains the
starting point and length of each recognized string. This information
can then be interpreted in the action that builds the abstract syntax
tree. (I bet you want to use this information in order to build a
syntax directed editor that preserves the original layout, at least
that is what I have once used it for)


Kind regards,
Jan Rekers


---
<A HREF=http://www.wi.leidenuniv.nl/~rekers> Jan Rekers </A>
Department of Computer Science, Leiden University
P.O. box 9512, 2300 RA Leiden, the Netherlands
email: rekers@wi.leidenuniv.nl, Phone: +31 71 277108




--


Post a followup to this message

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