Re: Make an editor for a language

anton@mips.complang.tuwien.ac.at (Anton Ertl)
2 Mar 1999 14:06:50 -0500

          From comp.compilers

Related articles
Make an editor for a language dfsgm@tin.it (Davide Marino) (1999-02-27)
Re: Make an editor for a language dwight@pentasoft.com (1999-02-28)
Re: Make an editor for a language anton@mips.complang.tuwien.ac.at (1999-03-02)
Re: Make an editor for a language maratb@CS.Berkeley.EDU (Marat Boshernitsan) (1999-03-02)
Re: Make an editor for a language heinrich@idirect.com (Kenn Heinrich) (1999-03-02)
Re: Make an editor for a language dontspamger@informatik.uni-bremen.de (George Russell) (1999-03-04)
Re: Make an editor for a language mzraly@world.std.com (1999-03-04)
| List of all articles for this month |
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.compilers
Date: 2 Mar 1999 14:06:50 -0500
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
References: 99-02-130
Keywords: tools



  "Davide Marino" <dfsgm@tin.it> writes:
> I need make an editor for a programming language. It would be capable
> of color tokens according their lexical value. ...


One idea for dealing with this for an FSA-based scanner is to remember
the state between any two characters. After a change, you start
running the FSA from the first changed character, and then continue
until the state synchronizes with the stored state. You can defer
this operation for off-screen stuff until it becomes on-screen.


If your lexical analysis requires something like lex' lookahead
feature, things become complicated, though. And I have no idea how to
coerce lex/flex to support this scheme.


> My idea is to mantain in
> memory all the text in this form:
>
> - there is a double linked list with one element for each line of text
> with a link to the line after and before.


I tried that and failed. A much better representation in my
experience is the plain character array with a hole at the cursor.
AFAIK emacs uses this data structure; I have also seen it described in
several places, but don't remember where.


- anton
--
M. Anton Ertl Some things have to be seen to be believed
anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html


Post a followup to this message

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