Re: Source code editor using GCC

George Neuner <gneuner2@comcast.net>
22 Nov 2006 21:17:16 -0500

          From comp.compilers

Related articles
Source code editor using GCC zhengz@parawireless.com (zheng zhihua) (2006-11-20)
Re: Source code editor using GCC gneuner2@comcast.net (George Neuner) (2006-11-22)
| List of all articles for this month |

From: George Neuner <gneuner2@comcast.net>
Newsgroups: comp.compilers
Date: 22 Nov 2006 21:17:16 -0500
Organization: Compilers Central
References: 06-11-090
Keywords: GCC, editor, bibliography
Posted-Date: 22 Nov 2006 21:17:16 EST

On 20 Nov 2006 23:05:26 -0500, "zheng zhihua"
<zhengz@parawireless.com> wrote:


>I am a freshman, help wanted! who can tell me about the architecture
>of the gcc.And how to pick infomation about the source code.I want to
>use gcc to build up a smart source code editor
>
>thanks a lot
>
>[There is quite a lot of documentation on GCC at http://gcc.gnu.org,
>but I think it would be a better idea to find out how other souce code
>editors work. GCC's parsers are intended to run through a program
>once and parse the whole program, while in an editor you're frequently
>reparsing little bits of the program as the user makes changes. -John]




I agree with John that GCC is the wrong way to go because of its batch
orientation. Smart code editors identify and delimit the minimum edit
unit and minimum compilation unit (these are my terms). The edit unit
is usually a line, an expression or statement; the compilation unit
may be a line, an expression, a function or the whole program
depending on the location of the edit. At each change, the current
edit unit is reparsed and the current compilation unit is reanalyzed.


It is possible to use standard parsing/lexing/analysis tools to create
such an environment, but you have to be creative with them because
most tools assume a batch environment - you need to adjust their
notions of "batch" to suit your needs. The major effort will be
creating/maintaining a flexible analysis environment and determining
how much of the program needs to be reanalyzed due to each editing
change.


Here are a few references to get you started.




"Practical Algorithms for Incremental Software Development
Environments"
http://citeseer.ist.psu.edu/wagner98practical.html


"Efficient and Flexible Incremental Parsing"
http://www.cs.berkeley.edu/Research/Projects/harmonia/papers/twagner-parsing.pdf


"The design of parsers for incremental language processors"
http://portal.acm.org/citation.cfm?id=805153


"Incremental Semantic Evaluation in Language-based Editors"
http://cs.ubc.ca/rr/proceedings/spe91-95/spe/vol22/issue2/spe750dk.pdf


"Incremental analysis of real programming languages"
http://portal.acm.org/citation.cfm?id=258920&coll=portal&dl=ACM&CFID=5041012&CFTOKEN=44363383




Good luck.
George


Post a followup to this message

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