Skip to content

Instantly share code, notes, and snippets.

@raydiak
raydiak / gist:8459623
Created January 16, 2014 17:39
Method 'jast' not found for invocant of class 'NQPMu'
Method 'jast' not found for invocant of class 'NQPMu'
in (gen/jvm/stage2/QAST.nqp:3790)
in compile_all_the_stmts (gen/jvm/stage2/QAST.nqp:3772)
in (gen/jvm/stage2/QAST.nqp:3372)
in (gen/jvm/stage2/QAST.nqp:3369)
in as_jast (gen/jvm/stage2/QAST.nqp:3315)
in as_jast (gen/jvm/stage2/QAST.nqp:2990)
in as_jast (gen/jvm/stage2/QAST.nqp:3044)
in as_jast (gen/jvm/stage2/QAST.nqp:2990)
in jast (gen/jvm/stage2/QAST.nqp:2856)
@raydiak
raydiak / matrix_test.pl6
Created February 2, 2014 07:05
fake 2D subscripts "is rw" problem
#!/usr/bin/env perl6
class Matrix4x4 is Array {
method at_pos ($i) is rw {
self.Array::[$_, $_+1, $_+2, $_+3] given $i * 4
}
method perl () {
self.defined ??
$?CLASS.perl ~ '.new(' ~ "\n" ~
#!/usr/bin/env perl6
my $file = open 'MIRRORED.BY';
my %data;
my $key;
for $file.lines {
when /^ \s* '#'/ {
next
@raydiak
raydiak / rule_prob.p6
Created October 3, 2014 02:51
cyclical rule problem
#!/usr/bin/env perl6
use v6;
grammar Problem {
token TOP { <expression> }
rule expression { <operation> | <value> }
rule operation {<expression> <operator> <expression>}
token operator { \+ | \- | \* | \/ }
my %circ = (
'(' => ')',
'[' => ']'
);
token circumfix_operation { (<circumfix_open>) <expression> (<circumfix_close>) <?{ %circ{$0} eq $1 }> }
token circumfix_open { @(%circ.keys) }
token circumfix_close { @(%circ.values) }
> ./alg.p6 'y=m*x+b' x
relation: =
symbol: y
operation: add
operation: multiply
symbol: m
symbol: x
symbol: b
relation: =
symbol: x
#!/usr/bin/env perl6
use v6;
class Point {
has num $.x;
has num $.y;
method new(num $x, num $y ) {
self.bless: :$x, :$y;
}
@raydiak
raydiak / gist:44f56ace282e01bac71a
Created January 3, 2015 20:32
JSON::Tiny R-J failure
==> Fetching JSON::Tiny
==> Building JSON::Tiny
Compiling lib/JSON/Tiny/Actions.pm to jar
Compiling lib/JSON/Tiny/Grammar.pm to jar
java.lang.IllegalThreadStateException: process hasn't exited
in method close at gen/jvm/CORE.setting:15560
in block at /home/raydiak/.rakudobrew/jvm-HEAD/panda/lib/Panda/Builder.pm:136
in sub withp6lib at /home/raydiak/.rakudobrew/jvm-HEAD/panda/lib/Panda/Common.pm:29
in method build at /home/raydiak/.rakudobrew/jvm-HEAD/panda/lib/Panda/Builder.pm:114
in method install at /home/raydiak/.rakudobrew/jvm-HEAD/panda/lib/Panda.pm:118
@raydiak
raydiak / gist:e268376b2cb6280ad7d3
Created January 5, 2015 08:02
testing C::Parser one line at a time
print failing lines only:
cat zmq.h | perl6 -Ilib -MC::Parser -ne '.say unless C::Parser::StdC11Parser.parse($_)'
preprocessed and hand-formatted zmq.h, 1 statement per line for easy testing:
extern int *__errno_location (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
typedef long int ptrdiff_t;
// parse fails
typedef __off64_t __loff_t;
typedef __quad_t *__qaddr_t;
struct _IO_FILE;
typedef struct { __off_t __pos; __mbstate_t __state; } _G_fpos_t;
typedef struct { __off64_t __pos; __mbstate_t __state; } _G_fpos64_t;
struct _IO_jump_t;
struct _IO_FILE;
struct _IO_FILE_plus;
typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);