p2
p2 copied to clipboard
scoped syntax grammars
potion blocks are closures with scoped mixins. so it's easy to override all methods in a scope, by switching to a new parser, eventually changed compiler rules and translate to p2 data. The syntax need not to be dynamically loadable for this, indep of issue #11
{ use v6;
# parse and run perl 6 code - ingy!
}
# back to p5
# ffi
my $num = 1.5;
{ use syntax 'C'; # load syntax-C
#include <math.h>
#pragma perl $num => double
#pragma perl $result <= double n
double n = sqrt(2.0 + $num);
}
say "sqrt(2+$num) => $result";
my $dbh = DBI->($data_source, $username, $auth);
my $t = 'sometable';
{ use syntax 'SQL' => $dbh;
SELECT * FROM $t;
}