develooper Front page | perl.perl6.internals.api.parser | Postings from December 2000

Re: A parser that can handle partial programs (was Re: Now, totry again...)

Thread Previous | Thread Next
From:
Dan Sugalski
Date:
December 17, 2000 12:59
Subject:
Re: A parser that can handle partial programs (was Re: Now, totry again...)
Message ID:
5.0.1.4.0.20001217155225.0218e790@24.8.96.48
At 12:41 PM 12/17/00 -0500, Bradley M. Kuhn wrote:
>Nicholas Clark <nick@ccl4.org> wrote:
>
> > Something I though of:
> > If you're trying to write an interactive perl inputer - either a perl shell
> > or just the command prompt on the debugger it would be useful if you
> > could tell the parser that the chunk of source you're giving it may be
> > incomplete.
>
>I really like this idea, although I am unsure of how we might implement it.
>I don't recall any of the compiler texts I have read over the years talking
>about formal methods for writing such a "partial programs are acceptable"
>parser.
>
>
>Lisp-like languages handle this, but s-expressions are so trivial to parse
>that it's no help to simply "follow" their example.

BASICs generally allow this.

The rule I was thinking was we'd take source on the fly, and execute bare 
statements and (opionally) print the results. Blocks wouldn't get executed 
until they were closed, and things like "sub" wouldn't get executed, only 
parsed. (Like they are now)

Basically read to the end of a statement and eval the statement, only do it 
with a scopeless eval, so things like lexical variables wouldn't 
immediately disappear.

					Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                      teddy bears get drunk


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About