Re: An interesting Parser problem

Chris F Clark <cfc@shell01.TheWorld.com>
Fri, 30 Nov 2007 19:03:15 -0500

          From comp.compilers

Related articles
An interesting Parser problem sachin.goyal.new@gmail.com (sachin.goyal.new@gmail.com) (2007-11-29)
Re: An interesting Parser problem torbenm@app-4.diku.dk (2007-11-30)
Re: An interesting Parser problem DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-11-30)
Re: An interesting Parser problem holgersiegel74@yahoo.de (Holger Siegel) (2007-11-30)
Re: An interesting Parser problem cfc@shell01.TheWorld.com (Chris F Clark) (2007-11-30)
Re: An interesting Parser problem gene.ressler@gmail.com (Gene) (2007-12-02)
Re: An interesting Parser problem rlwatkins@gmail.com (RLW) (2007-12-08)
| List of all articles for this month |

From: Chris F Clark <cfc@shell01.TheWorld.com>
Newsgroups: comp.compilers
Date: Fri, 30 Nov 2007 19:03:15 -0500
Organization: The World Public Access UNIX, Brookline, MA
References: 07-11-081
Keywords: parse, editor, comment
Posted-Date: 30 Nov 2007 20:49:53 EST

"sachin.goyal.new@gmail.com" <sachin.goyal.new@gmail.com> writes:


> We are planning to make an intelligent text editor (Why is not
> important, we have to do it.) ...


> So the first issue is to find the offset of each token in lex (yacc ?)
> This should also handle if some include file construct like "include
> abc.xyz" is encountered. In such a case, filename and offset from new
> file should be returned. Is there any other tricky case possible ?


If you have a macro pre-processor in your language, then you have one
additional tricky case which is text coming from macros.


Well, if you support #line style directives, you get yet another
tricky case, but for what you are doing, you might be able to handle
#line's by ignoring them.


Hope this helps,
-Chris


*****************************************************************************
Chris Clark Internet : compres@world.std.com
Compiler Resources, Inc. Web Site : http://world.std.com/~compres
23 Bailey Rd voice : (508) 435-5016
Berlin, MA 01503 USA fax : (978) 838-0263 (24 hours)
[In 1981 some friends of mine at Yale were working on syntax editors
and came to the conclusion that you did better with pattern matching
than trying to parse source code in an editor. I'm not sure anything
important has changed since then. It's "Z - the 95% program editor"
published in SIGPLAN Notices in 1981. If you have an online
subscription to the ACM digital library, you can download it. -John]


Post a followup to this message

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