Re: Source code editor using GCC

George Neuner <>
22 Nov 2006 21:17:16 -0500

          From comp.compilers

Related articles
Source code editor using GCC (zheng zhihua) (2006-11-20)
Re: Source code editor using GCC (George Neuner) (2006-11-22)
| List of all articles for this month |

From: George Neuner <>
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"
<> 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,
>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

Here are a few references to get you started.

"Practical Algorithms for Incremental Software Development

"Efficient and Flexible Incremental Parsing"

"The design of parsers for incremental language processors"

"Incremental Semantic Evaluation in Language-based Editors"

"Incremental analysis of real programming languages"

Good luck.

Post a followup to this message

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