p2 icon indicating copy to clipboard operation
p2 copied to clipboard

scoped syntax grammars

Open rurban opened this issue 13 years ago • 0 comments

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;
}

rurban avatar Feb 21 '13 17:02 rurban