Skip to content

Instantly share code, notes, and snippets.

View ingydotnet's full-sized avatar

Ingy döt Net ingydotnet

View GitHub Profile
use Pegex;
use Pegex::Compiler;
use XXX;
my $grammar = <<'...';
foo: /foo/ <bar>?
bar: /bar/ <foo>?
...
# XXX 'Pegex::Compiler'->compile($grammar);
---
_FIRST_RULE: foo
bar:
+all:
- +re: bar
- +rule: foo
<: '?'
foo:
+all:
- +re: foo
COPYRIGHT
Copyright (c) 2010. Ingy döt Net.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
The best part of Perl 6 is "Perl 6 Rules"<http://en.wikipedia.org/wiki/Perl_6_rules>, a "PEG"<http://en.wikipedia.org/wiki/Parsing_expression_grammar> parsing language and a replacement for Perl 5 regular expressions. It is a simple and readable way to define new languages, including Perl 6 itself.
"Ingy döt Net"<http://ingy.net/> has taken the best ideas from Perl 6 Rules and created an "Acmeist"<http://acmeism.org/> parsing language called "Pegex"<http://www.pegex.org/>. Pegex can be used to define new languages that work the same in Perl, Python, Ruby, JavaScript and any other languages that support Pegex.
In this talk, Ingy will show you how to use Pegex in Perl, as simply as using a regex. He'll also demonstrate how he is using Pegex as the basis of his Acmeist projects like "YAML"<http://yaml.org/>, "TestML"<http://testml.org/>, "JSYNC"<http://jsync.org/> and "C'Dent"<http://cdent.org/>.
Pegex - Perl 6 Rules for Everyone
The best part of Perl 6 is "Perl 6 Rules"<http://en.wikipedia.org/wiki/Perl_6_rules>, a
"PEG"<http://en.wikipedia.org/wiki/Parsing_expression_grammar>
parsing language and a replacement for Perl 5 regular expressions.It is a simple and
readable way to define new languages, includingPerl 6 itself.
"Ingy döt Net"<http://ingy.net/> has taken the best ideas from Perl 6 Rules and created
an "Acmeist"<http://acmeism.org/> parsing language called
"Pegex"<http://www.pegex.org/>. Pegex can be used to define new
TestML - Write Once, Test Everywhere
When you write "Acmeist"<http://acmeism.org/> software you need to make sure
it passes the same tests in many different programming languages. When you
write modules that you want to publish in Perl 5 and Perl 6, the same truth
applies.
"TestML"<http://testml.org/> is a new Unit Testing language that runs the same
tests in Perl 5, Perl 6, Python, Ruby, JavaScript and many other modern
programming languages. It makes writing tests so nice and simple, that you
Gloom and Mousse (lightning talk)
Moose is the Swiss Army Forest Animal solution for Perl OO, but there are many places
where a Moose won't fit.
What if you could write object oriented modules for CPAN, and get the OO for FREE?
Now you can!
> perlbrew off
> which perl
/usr/local/bin/perl
> perl -V
...
@INC:
/usr/local/lib/perl5/5.10.0/darwin-2level
/usr/local/lib/perl5/5.10.0
/usr/local/lib/perl5/site_perl/5.10.0/darwin-2level
/usr/local/lib/perl5/site_perl/5.10.0
%TestML 1.0
zip(*key.Lines.Chomp, *values.Lines.Chomp).JSON == *hash;
=== Fruity Colors
--- keys
apple
orange
grape
--- values
> cat t/x.t
use TestML -run;
sub f1 {
my $context = shift;
my $num = shift->value;
return $num * 42 + $num;
}
sub f2 {