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

Re: Now, to try again...

Thread Previous | Thread Next
From:
David Grove
Date:
December 18, 2000 09:21
Subject:
Re: Now, to try again...
Message ID:
200012181819.eBIIJ1m05313@camel.petes-place.com

Andy Dougherty <doughera@lafayette.edu> wrote:

 > > That sounds too complex for what seems like a more simple solution.
When
 > > you say "turn simple 'languages' into perl", that's what Dan's told
me is
 > > my source filter.
 >
 > Correct.  perl-byacc is a source filter.  It takes in yacc source and
 > outputs perl code.  It just may not be what folks first think of as a
 > "source filter" in the sense of using the Filter:: modules.  For
 > some problems, it's certainly too complex.  For others it might not
 > be.
 >
 > Not all problems need be shoe-horned into the same solution box. That's
 > all I'm trying to say.

I _think_ we're on the same page.

The source-filter concept that I've worked on is quite a bit more than a
slough of regex substitutions. It maps grammar to grammar, or lexeme to
lexeme, or keyword to keyword, or keyword combination to keyword
combination, but needn't map an entire grammar to an entire grammar.

If we have more than one way of doing this, that's a good thing. As long
as we don't try to become a full fledged C++ interpreter, or go out of our
way to please the full c++/c/java/etc/etc language spec. It seems
sufficient to suit the goals of this task as I understand them that we be
able to output either pure perl (filter) or source tree (perl lex/yacc)
from modulated perl. Experimentation beyond that is almost
incomprehensible at this point, though admittedly not impossible (though
admittedly "why?").  ;-))

Now, for argument's sake, I'll admit there's another side. A filter won't
debug right. What we see in the debugger won't be the code that we wrote.
If we exec() it, I'm not sure precisely what we'll see. That's a strong
argument, without a solution (yet), in favor of allowing parsing rather
than mere filtering. My greatest concern is for the end user who will want
to find a quick way to add a switch statement if he wants one. The grammar
of the perl-lexer shouldn't be lex or a param-file lex-file lookalike, but
straight Perl, for their sake. From their point of view, we need to
provide them with perfect and/or pretty KISS.

p



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