Paradise Regained

2010-10-31 Thread Henry Baragar
Hello,

The Pure and Declarative Syntax Defintion: Paradise Lost and Regained paper 
presented at Onward! 2010 talks about extensible grammars that are very 
similar to the grammars provided by/built into Perl 6:  it appears Perl 6 
already had the Paradise that the authors recently regained!

The work described is part of the Spoofax Language Workbench, a platform for 
developing textual domain-specific languages with full-featured Eclipse editor 
plugins:
With the Spoofax/IMP language workbench, you can write the grammar of your 
language using the high-level SDF grammar formalism. Based on this grammar, 
basic editor services such as syntax highlighting and code folding are 
automatically provided. Using high-level descriptor languages, these services 
can be customized. More sophisticated services such as error marking and 
content completion can be specified using rewrite rules in the Stratego 
language.

This sounds very much like what has been envisioned for Perl 6.  I wonder if 
the Perl6 team can leverage (in the future) the work done for Spoofax?

Regards,
Henry 

-- 
Henry Baragar
Instantiated Software


Re: Lazy Strings and Regexes

2010-10-31 Thread Darren Duncan

Francesco 'Oha' Rivetti wrote:

On Sun, 31 Oct 2010 20:29:27 +0100, Moritz Lenz mor...@faui2k3.org wrote:

If we can efficiently match against a lazy string, and if this doesn't
turn the lazy string into a (large) normal string, then the best way
to process a file might be something similar to:
   my $fh = open ... err die;
   my $contents = cat($fh.lines);
, followed by matching on $contents.

Better still would be to provide a way for filehandles to be directly
asked to produce a lazy Str which reflects the file.


I guess there's no good reason not to have a .Cat method in the IO class
- another thing that'll likely appear when Cats are implemented.


What if a regexp may consider a lazy list of string as a single lazy 
string?


i have no idea exactly what does could mean in practice, but i would like
to see something like:

  MyGrammar.parse($fh.lines);

or better:

  MyGrammar.parse($io); # which could be a file or a socket


If you want to do that, please don't make it a behavior of lazy lists of 
strings, since that would be too magical.  Instead, either do this using, for 
example, MyGrammar.parse() taking a Cat argument but that argument can be 
coerced from a string or array of string argument. -- Darren Duncan