Re: Do we need parsers?

Scott Stanchfield <>
15 May 1997 00:03:27 -0400

          From comp.compilers

Related articles
Do we need parsers? (John Carter) (1997-05-13)
Re: Do we need parsers? (Scott Stanchfield) (1997-05-15)
Re: Do we need parsers? dgay@barnowl.CS.Berkeley.EDU (1997-05-16)
Re: Do we need parsers? monnier+/news/comp/ (Stefan Monnier) (1997-05-17)
Re: Do we need parsers? monnier+/news/comp/ (Stefan Monnier) (1997-05-17)
Re: Do we need parsers? (Scott Stanchfield) (1997-05-19)
Re: Do we need parsers? (1997-05-22)
Re: Do we need parsers? (John Carter) (1997-05-22)
[2 later articles]
| List of all articles for this month |

From: Scott Stanchfield <>
Newsgroups: comp.compilers
Date: 15 May 1997 00:03:27 -0400
Organization: scruz-net
References: 97-05-158
Keywords: syntax, parse

Sounds to me like you're thinking "store a homogeneous AST that can
'compile' itself."

Basicaly, the editor watches what is typed, creates AST nodes from each
word, grouping nodes into subtrees as it goes, and stores the whlie
she-bang in a database.

This is the type of editor I want to write. Given the time...

Anyway, think about what the _editor_ does. Re-read my description
above. "Watches what was typed." Sounds like a scanner to me, but it
scans the typed keys instead of a file. "Grouping nodes into subtrees"
sounds like parsing to me. But instead of traditional "tokens" we pass
AST nodes to it. (Kind of like Sorcerer, the PCCTS tree-walker
generator does.)

In order to create the structure that knows how to compile itself, you
have to have some sort of scanner/parser. I'm not knocking the idea you
present -- I happen to like it (the editor edits trees, displaying them
however the user wants). I just wanted to point out that something has
to have the smarts to figure out what was typed...

(I'd like to hear more ideas from you via email if you're interested --
I've been playing with several "smart editor" ideas. And you're right:
syntax highliting is just the tip of a proverbial iceberg.)

-- Scott

John Carter wrote:
> Could the assembled wisdom pronounce on this idea?
> If every statement was an object. ie. You had an "if-then" object, an
> "if-then-else" object and a "assign" object and and and..
> If each object knew how to display itself, either as something like
> cout << "if" << ifObj.expr << " then\n" << ifObj.statements <<
> "endif\n";
> or more graphically. And each object knows how to execute itself,
> either in terms of invoking the execute method of other objects or
> invoking primitives. They even could have a compile method that would
> compile that object into a lower code.
> Then do we need lexical analysers and parsers? Couldn't we just create
> object editors and persistent object stores and bypass the whole
> grammar issue? An object editor wouldn't ever allow you to delete or
> add say the 'i' in "if", but only the entire "if-then" object.
> ...

Post a followup to this message

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