Re: Syntax directed program editing

cherrman@borland.com (Conrad Hermann)
Fri, 7 Feb 1992 22:51:49 GMT

          From comp.compilers

Related articles
Syntax directed program editing richard@harlqn.co.uk (1992-02-05)
Re: Syntax directed program editing pardo@cs.washington.edu (1992-02-06)
Re: Syntax directed program editing carroll@cis.udel.edu (1992-02-15)
Re: Syntax directed program editing nickh@CS.CMU.EDU (1992-02-07)
Re: Syntax directed program editing cherrman@borland.com (1992-02-07)
Re: Syntax directed program editing anw@maths.nott.ac.uk (1992-02-07)
Re: Syntax directed program editing anw@maths.nott.ac.uk (1992-02-11)
| List of all articles for this month |

Newsgroups: comp.compilers
From: cherrman@borland.com (Conrad Hermann)
Keywords: performance, design
Organization: Borland International
References: 92-02-033
Date: Fri, 7 Feb 1992 22:51:49 GMT

In article 92-02-024 richard@harlqn.co.uk (Richard Brooksby) writes:
>Why aren't there more editors which operate directly on the parse trees of
>languages? Are there fundamental problems with this approach?


I have two references:


1) There is/was a project at UC Berkeley to do a multilanguage,
emacs-like, syntax-sensitive editor for Pascal, MODULA-2, and other
similar languages (called Pan, I think, under Prof. Graham). One problem
they found was that trying to do syntax-directed editing (or incremental
compilation) on a C file with preprocessor statements is not really a good
idea. It seems that a C preprocessor destroys whatever syntactic
structure your program text has, since anything can be redefined to mean
anything else with #define, and you can arbitrarily include or exclude
pieces of code with #if.


2) In '84, a company called ITC released a Modula-2 compiler with a
syntax-directed editor. It wasn't very popular, but it was really fast
because it stored pre-tokenized files on disk instead of raw text.


My thoughts are that your editor could be turned into a precompiler to
save both the text file and a tokenized file (if there are no syntax
errors) when you save the file. Then your compiler should read the
tokenized/parsed file in a lot less time than doing real parsing. Of
course, if the tokenized file is not present, the compiler could parse the
text file directly.


I figure that reparsing every time you save a file shouldn't upset users
much, since computers are so fast nowadays that can tokenize the file in a
split-second.


-- Conrad Herrmann
--


Post a followup to this message

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