Re: Smart textual editors (Jacob Navia)
18 Jul 1996 23:55:52 -0400

          From comp.compilers

Related articles
Smart textual editors (1996-07-15)
Re: Smart textual editors (1996-07-18)
Re: Smart textual editors (1996-07-20)
Re: Smart textual editors (1996-07-20)
Re: Smart textual editors (Mihai Christodorescu) (1996-07-20)
Re: Smart textual editors (1996-07-22)
Re: Smart textual editors (Nick Geovanis) (1996-07-23)
Re: Smart textual editors (Mihai Christodorescu) (1996-07-23)
[7 later articles]
| List of all articles for this month |

From: (Jacob Navia)
Newsgroups: comp.compilers
Date: 18 Jul 1996 23:55:52 -0400
Organization: Compilers Central
References: 96-07-103
Keywords: tools

> I was looking for smart textual editors. By smart, I mean editors
> which might be doing data flow analysis and such things even while the
> editing is in progress so that they can point out the errors to the
> programmer. (e.g. if certain part of the code is unreachable, then it
> might give hints to the programmer etc.)

> [I've seen plenty of syntax editors, none of which seemed to me to be worth
> the grief they cause. (Many common editing operations are hard to express
> in syntactical terms, e.g. moving parens around.) But I've never seen one
> that tries to analyze the semantics of the code you're typing. -John]

Having implemented a syntax analyzing editor, I think the editor you want
is out of the question for the foreseeable future (2-3 years...).

My editor limits its job to display keywords in a different color than
normal program text, highliting comments as well. The updates are done in
real time of course.

This simple analysis is very difficult to do in real time: If you happen
to type a '/' just before a '*' all the text until the end of the file
will be a comment, and has to be changed (redrawn). The editor has to
scan each character you type looking for 'interesting' ones, like '/', to
avoid rescaning the whole file at each character typed.

The algorithms I used were based in simple heuristics: I limited myself
to the current screenfull of text, keeping a pointer to the comment just
before the start of the text (if there was any). I rescanned the text
starting there, since the user can't modify anything outside the
currently displayed screen. This had a certain impact at the
responsiveness of the editor for fast typists. With the progress of
hardware, more extensive analysis becomes possible.

Just before I save a file, I check for obvious syntax errors (mismatched
parentheses and such). I am thinking of doing this in real time too. This
would be doable.

But doing a DATA FLOW ANALYSIS in real time?

First, a representation of all the globals/variables of the current
procedure would be necessary. This information would have to be updated
constantly, since the user is constantly modifying the program text!!!
Syntax errors would have to be ignored, and I do not know how: what do
you do when the user just typed a ' { ' ???

Where you will put the missing closing brace?

I display the name of the current procedure at the right of the window
frame. Keeping only this MINIMAL information is very difficult with the
user constantly moving the cursor with PgUp or PgDown or changing from
one file to another.

I think a better alternative is to build a dictionary at each
compilation. I have modified the compiler that goes with the editor to
generate the dictionary, and then the editor only has to use this

This solves the syntax error problem. As the moderator rightly pointed
out, syntax errors MUST be accepted by the editor's parsers to let the
user type what he wants without the editor becoming an obstacle to the

Jacob Navia Logiciels/Informatique
41 rue Maurice Ravel Tel (1)
93430 Villetaneuse Fax (1)


Post a followup to this message

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