At 12:17 PM 12/17/00 +0000, David Grove wrote:

>Andy Dougherty <[EMAIL PROTECTED]> wrote:
>  > Another route to keep in mind is spending effort working on and with
>  > things such as perl-byacc (and maybe even the yet-to-be-written
>perl-lex)
>  > that help turn simple "languages" into perl.
>
>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. Actually, it's a bit more than a source filter. The goal
>would be to turn the creole language into perl, but not necessarily by
>filtering it, at least not solely. It can also map creole lexemes to perl
>lexemes (within the context of a more complex more-than-filter filter).

Filter's appropriate--one thing goes in and a processed version gets spat 
out. It's not unreasonable for a filter to turn source that looks like this:

  (setvar foo 'green)

into

   $foo = $things{green};

and have perl actually only

>Either way, if a creole is used, wouldn't what parses it come before any
>perl-language parsing if a scanner detects that it's going to be used? I
>mean, it's a bit convoluted, but I'm seeing two initial processes before
>the perl parser/lexer:
>
>1. scan for creole pragmata
>2. if they exist, preprocess
>3. perl parser/lexer... etc
>
>Must a creole parser/lexer be invented that outputs a source tree, or
>could it be as simple as translating to a common form (Perl 6 language
>spec) and having only that common form be turned into our source tree? The
>latter may make parsing slower and but would be programmer friendly, the
>former would be faster but would almost certainly be a programming
>nightmare... at least it would complicate things beyond common sense.

Both ways work. Emitting perl source is the domain of a source filter, 
while altering the parser to eat non-perl source and emit a perl syntax 
tree is the domain of parser extensions. Both have their places, and both 
are targets. (And both may well exist lexically, so the parser may stop 
parsing itself in mid-stream and start jamming source down a source filter 
for a while and eating the filter's output)

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to