»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'perl6: say 3;' or rakudo:, niecza:, std:, or /msg p6eval perl6: ... | irclog: irc.perl6.org/ | UTF-8 is our friend!
Set by sorear on 4 February 2011.
jnthn Right 00:00
timotimo OK.
jnthn You probably want to avoid doing anything with those cases.
The inliner doesn't dare touch them.
timotimo OK.
jnthn It is entirely possible that you should do your transform *before* the inliner does its work. 00:01
Oh
Yes, you totally should
Because!
Then we can inline the simple calls, possibly :)
00:01 sftp left, sftp joined
timotimo sounds good to me. anything surprising i may end up finding when i try to do that? 00:01
jnthn So if you do your transform and then run the optimizer on the QAST youv'e produced, the inliner can further optimize what you did :)
You're hacking on the optimizer, be ready for anything :P 00:02
I can't immediately think of anything terribly bad that you'll hit.
What order to do optimizations in is a classic compsci problem :)
timotimo thank you :)
jnthn I think doing yours first and then considering inlining gets us by far the better chance of success. 00:03
In "my int $a = ...; if $a == 1|2 { ... }" then we can actually turn that into something really cheap 00:05
(And will after your work, I expect.)
00:09 hash_table joined
timotimo should i turn a &infix:<|> into a &infix:<||> or into a &CORE::infix<||>? 00:10
r: sub infix:<||> ($a, $b) { say "woop woop"; return CORE::<||>($a, $b) }; if 1|2|3 == 2 { say "yay" } 00:11
p6eval rakudo 1553b1: OUTPUT«yay␤»
timotimo apparently i should 00:12
r: sub infix:<||> ($a, $b) { say "woop woop"; return CORE::<||>($a, $b) }; if 1 == 2 || 2 == 2 || 3 == 2 { say "yay" }
p6eval rakudo 1553b1: OUTPUT«yay␤»
timotimo er, wait, what? did i do that wrong?
jnthn timotimo: It turns into a different op
timotimo: No, || compiles into a QAST::Op with :op('unless') 00:14
To give the short-circuit semantics.
00:14 SHODAN joined
jnthn See infix:sym<||> definition in Grammar.pm, of note the :pasttype 00:14
(which really should be named something like :op these days...) 00:15
Or qastop or so
timotimo good to know.
so i don't have to worry about overwritten infix:<||> or overwritten infix:<&&>
jnthn The compiler today sure doesn't :)
(we may need to fix that eventually, but it's not a show-stopper) 00:16
timotimo so i can create one like that with QAST::Op.new("%tight_and", :pasttype<if>) or QAST::Op.new("%tight_or", :assoc<left>, :pasttype<unless>)? 00:19
jnthn neither 00:20
QAST::Op.new( :op('unless'), ... )
Just that
timotimo ah, ok
jnthn The assoc and stuff are all about parsing
You're at QAST level here
timotimo nods 00:21
somewhat unfamiliar territory for me
do you have a good suggestion for a check that would let me bail out if i'm going to be in danger of getting side-effects multiple times? 00:22
check for call ops a few nodes down the tree?
jnthn Don't detect them 00:24
Just evaluate the thing once.
And store bind it into a temporary 00:25
s/store//
timotimo should i treat the nodes as if they were immutable? or clone and change attributes? or just change?
jnthn It's cleaner to go the immutable way
timotimo good
jnthn Technically you *can* do it by changing them, but I suspect the result will be harder to understand
OK, I need rest 00:26
happy hacking :)
timotimo good night! i'll probably go to sleep soon-ish, too, though
if i get too frustrated perhaps :D
jnthn ;)
o/
timotimo ho-hum 00:43
now i've rebuilt the if, but i get "use of initialized value of type Mu in string context" from somewhere and then it says "could not find sub cuid_7_.....", probably didn't copy the if's child node correctly?
00:46 [particle] joined 00:50 cognominal left 00:53 japhb_ left 00:55 Targen joined
timotimo i've apparently created some sort of endless loop or recursion with my ast :| 01:06
01:08 ashleydev joined
timotimo that really seems like a useful optimisation. 01:08
i may have made it! wow. 01:18
now i've gotta get some rest, too >_<
01:18 xinming left
timotimo jnthn (and others): sprunge.us/EHUD - it looks kind of insane, code-style-wise, i'll clean it up tomorrow and then try to get it into rakudo proper. until then, that code example works and does what it's intended to do (also, right-hand-side expansion isn't in yet, but shouldn't be too hard) 01:20
01:22 xinming joined
timotimo but the local temporary var stashing is still missing 01:23
01:23 hash_table left 01:32 skids joined 01:33 swarles left 01:34 alec left 01:36 wk_ left 01:47 Chillance left 01:52 Khisanth left 01:59 LordVorp joined 02:01 odoacre left 02:02 odoacre joined 02:14 Khisanth joined 02:18 ifim left 02:39 PacoAir left 02:47 FROGGS_ joined 02:51 FROGGS left 03:06 LordVorp left 03:15 am0c joined 03:26 echowuhao joined 03:27 echowuhao left, am0c left 03:45 alec joined
[Coke] I am consistentingly segfaulting building 1553b11 (rakudo) 03:53
03:59 orafu left
[Coke] ... apparently consistently ws the wrong word. :P 04:12
04:12 atrodo left 04:14 Targen left 04:17 preflex_ joined, preflex left, preflex_ is now known as preflex, inverse joined 04:21 fgomez left 04:42 fgomez joined
lue just found wiki.perl6.org 04:56
05:13 telex left 05:14 nnunley left 05:17 daniel-s_ joined 05:20 daniel-s left 05:23 telex joined 05:33 telex left 05:38 telex joined 05:39 telex left 05:40 nnunley joined 05:41 telex joined 05:54 SunilJoshi joined 07:10 SunilJoshi left 07:15 SunilJoshi joined 07:21 zby_home joined 07:34 kaare_ joined 07:39 [particle]1 joined 07:42 [particle] left 08:00 SunilJoshi left 08:05 daniel-s_ is now known as daniel-s 08:21 swarles joined 08:31 GlitchMr left
Su-Shee good morning everyone 08:33
08:33 GlitchMr joined 08:45 swarles left 08:48 FROGGS_ left 08:54 SunilJoshi joined
sorear o/ SunilJoshi 08:58
o/ Su-Shee
09:00 GlitchMr left 09:02 GlitchMr joined 09:29 FROGGS joined
FROGGS jnthn: about "abc" ~~ / $( $_.substr(1,2) ) /, I got the $(...) in rakudos Perl6::RegexGrammar, how do I make it literal within the regex? 09:36
jnthn: is it a regex subrule of some kind?
I tried make QAST::Regex.new( $<variable>.ast, :rxtype<literal> );
but I get no match... 09:37
timotimo morning, people! 09:41
FROGGS morning timotimo 09:42
jnthn: with the original code of metachar:sym<rakvar> if get: No such method 'Any' for invocant of type 'Str' 09:44
where Str is the $( $_.substr(1,2) ) IMO
09:47 Patterner left
FROGGS github.com/rakudo/rakudo/blob/nom/...5872-L5876 09:48
09:49 Psyche^ joined, Psyche^ is now known as Patterner
timotimo i'm not quite sure how i can put the var in that's supposed to bind temporary values :| 09:53
FROGGS timotimo: what are you talking about? 09:55
timotimo i'm being incoherent again, sorry 09:56
sprunge.us/EHUD - i'm building this AST transformation that turns a|b|c == 5 into a == 5 || b == 5 || c == 5, but i will have to bind a, b and c to local variables before i can finish this, so that side-effects will only get run once 09:57
but until then i have plenty other things to worry about 09:59
moritz timotimo: you can generate uniq names for that with $path.uniq('your_prefix') 10:01
you can declare them with QAST::Var.new(:name($yourname), :scope<local>, :decl<var>) 10:02
see for example sub sink in Actions.pm for an example
timotimo so i don't need an additional bind op for that?
FROGGS timotimo: example: github.com/rakudo/rakudo/blob/nom/...s.pm#L3975
moritz yes 10:03
FROGGS my example is better because of $comments
timotimo but it does use the bind op ;) 10:04
10:04 PacoAir joined
FROGGS I wish there where more though 10:04
10:04 wk joined
FROGGS timotimo: what is the problem again with binding? 10:05
timotimo oh there's no problem, i just don't quite know how it fits into the QAST. can i just put a Stmt wherever i want? i guess i can! 10:06
FROGGS I think you can, yes 10:07
timotimo is there an obligation that the var is on the same level or above from the var nodes that try to access it? 10:08
FROGGS I'd say if you call $past.unique, it in in scope of $past 10:10
and that's good
timotimo oh, that sounds good
FROGGS but keep in mind, thats just what I learned by try&error from the last weeks 10:11
timotimo i would probably have tried&errord about the same things as you, but would have probably taken longer doing it :D 10:12
so thanks, that's quite excellent
i guess at first i'll just bind every value and after that i'll make up some heuristic to see when a value needs to be bound away and when not 10:13
masak good forenoon, #perl6 10:15
FROGGS hi masak 10:18
timotimo huh, that was ten times more easy than i thought it would be! 10:20
oh, here comes the catch already 10:21
since i have to temporarily bind the right hand side, too, i'll lose the ability to easily see and disect a junction if one is there on the other side as well 10:22
oh, but now i lose the short-circuiting nature of the side-effects :| 10:25
i might have to put the bind in the first place it appears in the actual junction evaluation and then refer to it later in the evaluation :| 10:26
jnthn morning o/ 10:27
timotimo morning jnthn
this is kind of mindbendy at times
it's time i put this under serious version control 10:28
FROGGS hi jnthn 10:29
jnthn
.oO( What does unserious version control look like? Oh...probably TFS... )
masak jnthn: Excel files, in manually merged versions, send over email at the last minute. 10:30
jnthn masak: No, that's lack of control :P 10:31
masak .oO( Version Chaos System ) 10:32
10:34 MayDaniel joined
timotimo i think i'll have to do both left and right side in one pass, or even better, generalise it for any number of chains in a row 10:35
that is, 1 | 2 | 3 == 2 & 3 should be handled by the same code that does 1 | 2 | 3 == 2 and the same code that does 1 | 2 | 3 == 2 & 3 == 1 ^ 2
otherwise i'll end up in a whole lot of trouble, i think
this is going to be ... fun 10:36
jnthn I think that if you start multiplying out big junctions we'll end up with huge QAST trees 10:38
FROGGS it is fun
jnthn optimizing the "junction literal on one side" is probably enough.
timotimo yes, but it will still be faster than creating the junction objects every time at run time and autothreading through them manually, no?
hm, so if there's a junction on both sides, we'll still get the benefit of one unfolded junction and the drawback of one autothreaded junction? 10:39
jnthn Perhaps; on the other hand, it's not like QAST nodes and the extra code you'll produce are totally cost-free...
timotimo you may be right :| 10:40
i wonder if i should check which one is the bigger junction if there's two :P
jnthn Also, we could create junction literals at compile time 10:42
Trouble is that we should do that after things like you're doing
Otherwise we leave behind a tree that's just a QAST::WVal. 10:43
timotimo yes 10:44
that's not a very costly optimisation ; shouldn't the auto-inliner do that already anyway?
jnthn No, it's not really an inlining optimizatin. 10:45
It's more a "just construct this at compile time rather than runtime" one.
We could do it for parcels too 10:46
timotimo OK.
how much would we win for parcels?
jnthn Anyway, one opt at a time :)
It's hard to say...if we did it to the parcel in for 1..10000 { my @a = @x[$_] Z (1,2,1,2); ... } 10:47
Then we save creating 9999 extra parcel objects for example :)
In other cases, probably it's not so different :)
bbi10 10:48
timotimo at least my "evaluate side-effect only once" code is now apparently correct 10:51
masak .oO( I vill only evaluate dis once ) 10:55
timotimo really, really enjoying the fact that i can just put subs into my innermost pieces of code and refer to the outer lexicals 10:57
11:06 Su-Shee_ joined 11:09 Su-Shee left 11:11 wk left 11:15 spider-mario joined 11:16 MikeFair joined, Su-Shee_ is now known as Su-Shee, MikeFair__ left 11:18 grondilu joined 11:31 SunilJoshi left 11:59 SunilJoshi joined 12:13 SamuraiJack joined 12:46 SamuraiJack left 13:07 zby_home left 13:18 Targen joined 13:21 imarcusthis left 13:24 imarcusthis joined
masak r: given Date.today { if .month == 1 && .day-of-month == 26 { say "Happy birthday, jnthn!" } } 13:33
p6eval rakudo 1553b1: OUTPUT«Happy birthday, jnthn!␤»
jnthn :) 13:37
sjn hey, happy b(eer|irth)day, jnthn! :) 13:39
13:42 preflex left 13:53 am0c joined 14:01 am0c left
timotimo oooh! 14:06
jnthn: \o/ happy birthday
FROGGS happy birthday jnthn! 14:20
14:26 spider-mario left
masak r: say ~("hip" xx 2, [].^name), "!" 14:35
p6eval rakudo 1553b1: OUTPUT«hip hip Array!␤» 14:36
14:43 swarles joined
swarles r: my token test-token-name { . }; say "hello" ~~ /<test-token-name>/; 14:45
p6eval rakudo 1553b1: OUTPUT«「h」␤ test-token-name => 「h」␤␤»
swarles Wonderful
14:47 zby_home joined 14:59 PacoAir left, PacoAir joined 15:00 swarles left
swarley r: say "hello" ~~ /<!l> e/ 15:00
p6eval rakudo 1553b1: OUTPUT«No such method 'l' for invocant of type 'Cursor'␤ in regex at /tmp/sw6FifoJLA:1␤ in method ACCEPTS at src/gen/CORE.setting:10738␤ in block at /tmp/sw6FifoJLA:1␤␤»
swarley r: say "hello" ~~ /<! 'l'> e/
p6eval rakudo 1553b1: OUTPUT«===SORRY!===␤Unrecognized regex metacharacter < (must be quoted to match literally)␤at /tmp/E5uXVFk6B1:1␤------> say "hello" ~~ /<!⏏ 'l'> e/␤Unrecognized regex metacharacter ! (must be quoted to match literally)␤at /tmp/E5uXVFk6…
swarley r: say "hello" ~~ /<!before 'l'> e/
p6eval rakudo 1553b1: OUTPUT«「e」␤␤»
swarley r: say "hello" ~~ /<!before l> e/
p6eval rakudo 1553b1: OUTPUT«「e」␤␤»
swarley r: say "hello" ~~ /<![l]> e/ 15:02
p6eval rakudo 1553b1: OUTPUT«「e」␤␤»
swarley r: say "hello" ~~ /<?before <-[l]>> e/ 15:03
p6eval rakudo 1553b1: OUTPUT«「e」␤␤»
swarley I'm confused
Ayiko r: say "hello" ~~ /e <!before 'l'>/ 15:04
p6eval rakudo 1553b1: OUTPUT«#<failed match>␤»
swarley Oh
Whoops
masak did your confusion lift?
swarley Yup
masak happy to hear that :)
swarley I was still thinking pcre 15:05
/(?<=e)l/
Ayiko should be same there? 15:06
swarley [8] pry(main)> "hello" =~ /(?<=e)l/
=> 2
Ayiko r: say "hello" ~~ /<!after h> e/
p6eval rakudo 1553b1: OUTPUT«#<failed match>␤»
masak yeah, the principle is the same. 15:07
(?<=e) is just a strange and ugly way to write <!after e>
swarley Yeah, I was running that in a ruby repl 15:08
(The regex engine I'm most familiar with)
It uses the regex engine I'm most familiar with*
Ayiko (?<!e) or <after e> ? :)
masak oh, right. 15:13
15:13 SamuraiJack joined 15:15 am0c joined
swarley r: say 49.chr 15:16
p6eval rakudo 1553b1: OUTPUT«1␤»
swarley say "1" ~~ /\c[49]/
r: say "1" ~~ /\c[49]/ 15:17
p6eval rakudo 1553b1: OUTPUT«「1」␤␤»
swarley k.
Does it have to be square brackets there?
r: say "1" ~~ /\c{49}/ 15:18
p6eval rakudo 1553b1: OUTPUT«===SORRY!===␤Unrecognized \\c character␤at /tmp/M5klW9R4az:1␤------> say "1" ~~ /\c⏏{49}/␤ expecting any of:␤ postfix␤ infix or meta-infix␤ infix stopper␤ prefix or term␤ prefix or meta-pref…
swarley Yes.
Alright then
Ayiko r: say "10" ~~ /\c49 0/ 15:27
p6eval rakudo 1553b1: OUTPUT«「10」␤␤»
swarley How would I assert that if something is equal to something else, then the regex is false? like, a ~~ /b <{ if not a ~~ c }>/ but within a token 15:31
/c/*
Ayiko I'm not sure I understand... 15:35
swarley match "b but not c"
Assuming b is a superset of c 15:36
Ayiko as character classes?
swarley b and c are both tokens
Ayiko or 'b' ~~ / b { fail if 'c'; } / 15:37
swarley Is there a way to check it against a token? Well, I'm assuming there is a way so I suppose a better question would be, how would I do that? 15:38
Ayiko r: say 'b' ~~ / b <!after a|b|c> /
p6eval rakudo 1553b1: OUTPUT«#<failed match>␤» 15:39
masak r: say 'b' ~~ / <+[\w] - [c]> /
p6eval rakudo 1553b1: OUTPUT«「b」␤␤»
masak r: say 'c' ~~ / <+[\w] - [c]> /
p6eval rakudo 1553b1: OUTPUT«#<failed match>␤»
swarley oh. That's really cool.
masak that's one option.
Ayiko r: say 'c' ~~ / <[\w]-[c]> /
p6eval rakudo 1553b1: OUTPUT«#<failed match>␤»
masak r: say 'b' ~~ / (\w) <!{ $0 eq 'c' }> /
Ayiko oh, right
p6eval rakudo 1553b1: OUTPUT«「b」␤ 0 => 「b」␤␤»
masak r: say 'c' ~~ / (\w) <!{ $0 eq 'c' }> /
p6eval rakudo 1553b1: OUTPUT«#<failed match>␤»
masak that's another.
swarley: if these things intrigue you, I'd recommend S05, where there's lots of this stuff. 15:40
swarley Yeah, I'm reading through it
It's just somewhat massive
masak yeah.
swarley A little overwhelming
masak Perl 6 -- a little overwhelming.
Ayiko little?
swarley I figure it's easier to get it from the horses mouth than it is to search through it to find out what I want
I mean, I did search before I asked 15:41
Don't get me wrong
But, failing to decipher it, I had to fall back to you all.
I went with
token multi-line-comment-line { <comment-line> <!after <multi-line-comment-end-line>> }
, for what it's worth
15:42 Chillance joined
swarley Since the comment-line token isn't a range 15:42
^^ is beginning of a line correct? 15:46
masak oh, you're very welcome to fall back on #perl6.
I just wanted to make sure you hadn't missed S05. 15:47
swarley: '^^' is beginning of a line, correct.
swarley \o/ wonderful 15:48
r: say "testing" ~~ /<lower>+/; 15:55
p6eval rakudo 1553b1: OUTPUT«「testing」␤ lower => 「t」␤ lower => 「e」␤ lower => 「s」␤ lower => 「t」␤ lower => 「i」␤ lower => 「n」␤ lower => 「g」␤␤»
16:02 PacoAir left
swarley r: "hello" ~~ /[.]-< \> >/ 16:03
p6eval rakudo 1553b1: OUTPUT«===SORRY!===␤Unrecognized regex metacharacter - (must be quoted to match literally)␤at /tmp/iGaq0NLxE9:1␤------> "hello" ~~ /[.]⏏-< \> >/␤Unable to parse regex; couldn't find final '/'␤at /tmp/iGaq0NLxE9:1␤------> "hello" ~…
swarley yeaj..
yeah*
r: "hello" ~~ /< hello >/ 16:06
p6eval rakudo 1553b1: ( no output )
swarley r: say "hello" ~~ /< hello >/
p6eval rakudo 1553b1: OUTPUT«#<failed match>␤»
moritz n: say "hello" ~~ /< hello >/ 16:07
p6eval niecza v24-18-gaf64300: OUTPUT«#<match from(0) to(5) text(hello) pos([].list) named({}.hash)>␤»
moritz looks like a rakudo bug
jnthn r: "hello" ~~ /< hello hi >/ 16:09
p6eval rakudo 1553b1: ( no output )
jnthn r: say "hello" ~~ /< hello hi >/
p6eval rakudo 1553b1: OUTPUT«「hello」␤␤»
jnthn r: say "hello" ~~ /< hello >/
p6eval rakudo 1553b1: OUTPUT«#<failed match>␤»
jnthn Huh
weird.
swarley looks for a fly swatter
moritz r: say "hello" ~~ / < hello hi > /
p6eval rakudo 1553b1: OUTPUT«「hello」␤␤»
moritz r: say "hello" ~~ / < hello > /
p6eval rakudo 1553b1: OUTPUT«#<failed match>␤» 16:10
jnthn It turns it into an alternation. Soemthing must be going wrong with the single item case.
FROGGS r: say "hello" ~~ / '<hello>' / 16:14
p6eval rakudo 1553b1: OUTPUT«#<failed match>␤»
FROGGS r: say "hello" ~~ / '<hello' '>' /
p6eval rakudo 1553b1: OUTPUT«#<failed match>␤»
FROGGS r: say "hello" ~~ / '<' 'hello' '>' /
p6eval rakudo 1553b1: OUTPUT«#<failed match>␤»
FROGGS r: say "<hello>" ~~ / '<' 'hello' '>' /
p6eval rakudo 1553b1: OUTPUT«「<hello>」␤␤»
FROGGS r: say "<hello>" ~~ / <hello> / 16:15
p6eval rakudo 1553b1: OUTPUT«No such method 'hello' for invocant of type 'Cursor'␤ in regex at /tmp/tpF5R0KEEw:1␤ in method ACCEPTS at src/gen/CORE.setting:10738␤ in block at /tmp/tpF5R0KEEw:1␤␤»
FROGGS r: say "<hello>" ~~ / < hello > /
p6eval rakudo 1553b1: OUTPUT«#<failed match>␤»
grondilu weird
jnthn tries a fix locally
FROGGS what should < String > do? 16:16
jnthn Same as String.
grondilu FROGGS: it's degenerate case of < foo bar giz >
aka alternation, right?
moritz correct 16:17
FROGGS n: say "hello" ~~ / <hello> / 16:18
p6eval niecza v24-18-gaf64300: OUTPUT«Unhandled exception: Unable to resolve method hello in type Cursor␤ at /tmp/ChmLXj7jTI line 1 (ANON @ 3) ␤ at /home/p6eval/niecza/lib/CORE.setting line 2901 (Regex.ACCEPTS @ 10) ␤ at /tmp/ChmLXj7jTI line 1 (mainline @ 3) ␤ at /home/p6eval/niecza/lib/CO…
FROGGS n: say "hello" ~~ / < hello > /
p6eval niecza v24-18-gaf64300: OUTPUT«#<match from(0) to(5) text(hello) pos([].list) named({}.hash)>␤»
FROGGS k
looks like we are missing a test case 16:19
timotimo hurm. i think my additions to the optimiser that i just plopped into rakudo have made it impossible (or impossibly slow?) to compile the core setting :( 16:20
how am i supposed to decide if it's just slow or broken?
jnthn It's probably broken.
timotimo it would be nice if it threw an exception, though :(
jnthn Tip: diddle your makefile to pass --optimize=off or so when compiling CORE.setting 16:21
timotimo ah, so i can do lightweight tests with my optimizer?
swarley r: say "00001_2422" ~~ /[0]* [ <.digit>+ ]+ % '_'/ 16:22
p6eval rakudo 1553b1: OUTPUT«「00001_2422」␤␤»
jnthn timotimo: yeah
swarley r: say "00001_2422" ~~ /0* [ <.digit>+ ]+ % '_'/
p6eval rakudo 1553b1: OUTPUT«「00001_2422」␤␤»
swarley r: say "00001_2422" ~~ /0* <.digit>+ % '_'/
p6eval rakudo 1553b1: OUTPUT«「00001_2」␤␤»
swarley k
r: say "00001_2422" ~~ /0* <.digit>+? % '_'/
p6eval rakudo 1553b1: OUTPUT«「00001」␤␤» 16:23
swarley Hm. So I had it the first time.
jnthn r: say < hello >.perl
p6eval rakudo 1553b1: OUTPUT«"hello"␤»
jnthn r: say < hello >.WHAT
p6eval rakudo 1553b1: OUTPUT«Str()␤»
jnthn ah
flussence swarley: the outermost + is the thing that has the % applied to it, if that helps to make sense of it
swarley Oh, yes that makes more sense 16:24
r: say "00001_2422" ~~ /0* [+<.digit>+]+ % _/ 16:25
p6eval rakudo 1553b1: OUTPUT«===SORRY!===␤Quantifier quantifies nothing␤at /tmp/wIUzIqF8qP:1␤------> say "00001_2422" ~~ /0* [+⏏<.digit>+]+ % _/␤ expecting any of:␤ postfix␤ infix or meta-infix␤ infix stopper␤ prefix or term␤ …
swarley err
r: say "00001_2422" ~~ /0* [<.digit>+]+ % _/
p6eval rakudo 1553b1: OUTPUT«「00001_2422」␤␤»
timotimo i think something else must be wrong.
even with --optimize=0 it takes much longer than it usually does
jnthn You can also try --optimize=off 16:26
0 means "do the analysis but don't optimize"
off means "don't run the optimizer at all"
timotimo ah, ok
jnthn Note this means you should pick a level for your optimization too :)
timotimo good idea. 16:27
what do you reckon, is this a level 3 optimisation? or just level 2?
16:27 hash_table joined
jnthn timotimo: 2 is the default 16:28
timotimo: the idea is that we gradually move things that we consider stable and important downwards.
timotimo good idea, so i'll put it in ... 4:) 16:29
16:29 spider-mario joined
jnthn well, 3 is the limit so far :) 16:29
1 = very safe things
2 = default
3 = include experimentals
timotimo well, this goes to 4 16:30
jnthn The setting is compiled with the maximum optimization level, because if we can't trust an optimization enough to work on something as well tested as the setting then we probably shouldn't trust it at all
Feel free to put it at 4 during your development though :) 16:31
swarley So, looking at proto tokens, could I do something like, proto token integer-literal:sym { [ <sym>+ ]+ % _ } ?
timotimo hey, it seems to work after the setting is through
whoops, there's a silly mistake in there somewhere. 16:32
swarley So that I could do something like token integer-literal:<<[0..9]>> 16:33
jnthn Got a fix for the / < hello > / thing...spectesting it.
dalek kudo/nom: c356d8e | jnthn++ | src/Perl6/Actions.pm:
Fix degenerate /< hello >/.
16:38
ast: 645eda3 | jnthn++ | S05-metasyntax/angle-brackets.t:
Test /< hello >/.
16:41
timotimo er, what's this? QAST::Op(p6mdthunk) - QAST::Var(lexical &infix:<==>) 16:45
where'd that come from? that confuses my optimiser very much 16:46
jnthn timotimo: Comes from the optimizer
timotimo: It's the thing I talked about last night.
swarley r: say "00.352" ~~ /[0 | <!before 0> [<digit>+]+ % _] '.' [<digit>+]+/
p6eval rakudo 1553b1: OUTPUT«「0.352」␤ digit => 「3」␤ digit => 「5」␤ digit => 「2」␤␤»
jnthn Why your opt should come first.
timotimo ah
it should come very first?
arnsholt jnthn: Did you have any clues as to what bit of code tries to nqp::composetype a P6int REPR, BTW?
timotimo moves
jnthn in visit_op
timotimo how early exactly? 16:47
before the self.visit_children($op)?
swarley r: say "00.352" ~~ /[0 | { fail if $0 ~~ /^0/ } [<digit>+]+ % _] '.' [<digit>+]+ % _/
p6eval rakudo 1553b1: OUTPUT«use of uninitialized value of type Any in string context in any at src/gen/BOOTSTRAP.pm:99␤␤「00.352」␤ digit => 「0」␤ digit => 「0」␤ digit => 「3」␤ digit => 「5」␤ digit => 「2」␤␤»
swarley r: say "00.352" ~~ /[0 | <{ fail if $0 ~~ /^0/ }> [<digit>+]+ % _] '.' [<digit>+]+ % _/
p6eval rakudo 1553b1: OUTPUT«use of uninitialized value of type Any in string context in any at src/gen/BOOTSTRAP.pm:99␤␤Unexpected named parameter 'value' passed␤ in sub infix:<does> at src/gen/CORE.setting:12450␤ in sub MAKE_REGEX at src/gen/CORE.setting:10713␤ in regex at /tmp/Te6vpLc…
jnthn timotimo: Yes, because if you visit_children you'll transform the ==
swarley r: say "00.352" ~~ /[0 | <{ fail if '0' }> [<digit>+]+ % _] '.' [<digit>+]+ % _/ 16:48
timotimo OK.
p6eval rakudo 1553b1: OUTPUT«Unexpected named parameter 'value' passed␤ in sub infix:<does> at src/gen/CORE.setting:12450␤ in sub MAKE_REGEX at src/gen/CORE.setting:10713␤ in regex at /tmp/_O6Qs7IT5a:1␤ in method ACCEPTS at src/gen/CORE.setting:10738␤ in block at /tmp/_O6Qs7IT5a:1␤␤»…
swarley blah
jnthn timotimo: I think you should construct your new QAST tree, then do a return.
timotimo i call visit_op on the new-built qast
hoping to get more optimisations in, too
swarley r: say "hello" ~~ /<{ say $_ }>hello/
p6eval rakudo 1553b1: OUTPUT«hello␤hello␤hello␤hello␤hello␤hello␤#<failed match>␤»
swarley r: say "00.352" ~~ /[0 | <{ fail if $_ =~ /^0/ }> [<digit>+]+ % _] '.' [<digit>+]+ % _/
p6eval rakudo 1553b1: OUTPUT«===SORRY!===␤Unsupported use of =~ to do pattern matching; in Perl 6 please use ~~␤at /tmp/DHeMlZwxYx:1␤------> say "00.352" ~~ /[0 | <{ fail if $_ =~⏏ /^0/ }> [<digit>+]+ % _] '.' [<digit>+]␤»
swarley r: say "00.352" ~~ /[0 | <{ fail if $_ ~~ /^0/ }> [<digit>+]+ % _] '.' [<digit>+]+ % _/ 16:49
p6eval rakudo 1553b1: OUTPUT«␤ in method gist at src/gen/CORE.setting:10505␤ in sub say at src/gen/CORE.setting:7590␤ in block at /tmp/kcMWhCMYqL:1␤␤»
swarley o-o
moritz swarley: don't ues fail() in a regex
jnthn Right, but if you have it in a QAST::Stmts then it's not visit_op
swarley Oh
moritz it doesn't do what you think it would
swarley 27<212326Ayiko27> or 'b' ~~ / b { fail if 'c'; } /
moritz in fact, nobody knows for sure what exactly it should do
swarley I thought it would based on that
r: say "00.352" ~~ /[0 | <!before ^0>[<digit>+]+ % _] '.' [<digit>+]+ % _/ 16:50
p6eval rakudo 1553b1: OUTPUT«「0.352」␤ digit => 「3」␤ digit => 「5」␤ digit => 「2」␤␤»
swarley hm..
timotimo yes, that seems to work very much better 16:51
jnthn: i ended up not putting it into a Stmts, because i wanted the short-circuiting nature of the || to still come through
jnthn timotimo: That doesn't make sense
timotimo: The Stmts is there so you can put a bind in place
Granted you could do it without I guess... 16:52
timotimo i can show how what the tree looks like right now
swarley r: say "00.352" ~~ /[0 | <!before 0+> [<digit>+]+ % _] '.' [<digit>+]+ % _/
p6eval rakudo 1553b1: OUTPUT«「0.352」␤ digit => 「3」␤ digit => 「5」␤ digit => 「2」␤␤»
nwc10 Happy birthday jnthn (I gather) 16:53
swarley r: say "00.352" ~~ /[0 | <!after 0> [<digit>+]+ % _] '.' [<digit>+]+ % _/
p6eval rakudo 1553b1: OUTPUT«「00.352」␤ digit => 「0」␤ digit => 「0」␤ digit => 「3」␤ digit => 「5」␤ digit => 「2」␤␤»
swarley whatever, i'll just use the long version
timotimo i can't create gists any more?!
masak how should we know? 16:54
"try it and see"
timotimo jnthn: paste.ee/p/nGrXk
masak timotimo: maybe you've fallen victim to the weird "can't create a gist of just one file" bug.
jnthn masak: "try it *to* see" :P
masak jnthn: :P 16:55
timotimo: solution: create a second file, create the gist, then remove the file.
timotimo that's weird indeed!
thanks for the hint
jnthn timotimo: oh, you've done that trick
timotimo: OK, then you don't need the stmts. :) 16:56
timotimo "that" trick!? :)
jnthn timotimo: The "bind on first use then mention next time" rather than pulling the bind out into a previous statement :)
I've used it in a few places too :)
nwc10: Thanks. Yes, it's birthday day :) 16:57
timotimo yeah, it was even two times simpler to create than what i had before where i pushed all values into a stmts
jnthn :)
It looks good.
timotimo:
nwc10 jnthn: are you having the approriate amount of fun^Wbeer?
jnthn timotimo++ # hacking the optimizer 16:58
nwc10: Am heading out for Indian food followed by an appropriate amount of beer shortly :)
masak is going, too! o/
nwc10 are "Indians" there pretty much indistinguisable from "Indians" back home? They seem to be here
masak I feel there's a difference. 16:59
from my admittedly small experience of British ones, that is.
nwc10 actually, not sure if they have Cobra or Kingfisher here.
That's no great loss
jnthn masak: Masala Zone is not quite typical, fwiw. :)
nwc10 but something new popped up just before I left, called IIRC "Mongoose" and it was actually rather nice.
timotimo yeah, my optimisation made it faster but wronger, just like you suspected :) 17:01
masak jnthn: I wasn't thinking of Masala Zone (which is *awesome*)
jnthn: I was thinking of the other one we went to.
or was it two of them? 17:02
there's something about Indian restaurants in .uk that feels more... qualitative/genuine.
here in .se the things in the menu has the right names, but somehow it doesn't get all the way there. 17:03
jnthn I think that's the whole "going to the Indian" thing is just much more integrated into the UK way of life than it is into the Swedish one 17:04
s/that's/that/ 17:05
masak yeah, that's probably it.
here it feels more "ethnic". there, it feels more like an everyday thing.
timotimo jnthn: could you review my before/after AST and tell me what's going wrong? :|
jnthn timotimo: your || has too many children. 17:06
timotimo sprunge.us/CDhO - as you can easily see from the code, the result should be 9 ($x and $y are fed from (-20..20)X(-20..20)
jnthn It can only have two 17:07
Then you need to nest them
timotimo this && doesn't
17:07 PacoAir joined
jnthn I think the QAST::Op if is the wrong thing 17:08
timotimo maybe i am not allowed to bind the right-hand-junction and reuse it?
jnthn Try 2 == 1|2|3|4
timotimo right-hand junction expanding seems to be nonfunctioning at the moment 17:09
jnthn ok, then 1|2|3|4 == 2
you probably will get an error
timotimo you're right, i'm getting "Operation 'if' needs either 2 or 3 operands"
i was certain i had written code to handle this case. thanks! 17:10
i had deleted it in the mean time, i guess
jnthn ok, going out for birthday :) 17:13
bbl o/
timotimo have a nice birthday! 17:15
aaw, jnthn told me QAST::Op if is the wrong thing, but not what the right thing might be :| 17:16
17:19 PacoAir left, PacoAir joined
timotimo tries chain instead of if 17:22
17:22 jerome left 17:23 jerome joined
swarley r: say "h3ll0" ~~ /(<alnum>)+/ 17:24
p6eval rakudo c356d8: OUTPUT«「h3ll0」␤ 0 => 「h」␤ alnum => 「h」␤ 0 => 「3」␤ alnum => 「3」␤ 0 => 「l」␤ alnum => 「l」␤ 0 => 「l」␤ alnum => 「l」␤ 0 => 「0」␤ alnum => 「0」␤␤»
swarley r: say "h3ll0\n" ~~ /(<alnum>+<[\n]>)+/
p6eval rakudo c356d8: OUTPUT«「h3ll0␤」␤ 0 => 「h3ll0␤」␤ alnum => 「h」␤ alnum => 「3」␤ alnum => 「l」␤ alnum => 「l」␤ alnum => 「0」␤␤»
timotimo my silly benchmark goes from 6 seconds to 3.6 seconds with my optimisation \o/
timotimo tries building the setting with the optimisation on and then does a spectest 17:26
doesn't seem like the setting will not go through with my optimisations on :( 17:32
swarley So, not to be a bother but I never got an answer to my earlier question 17:34
Could I use protos in the way that I would do something like proto token foo:arg { <arg> foo } 17:35
and do token foo:bar<baz> to get /baz foo/ in the token?
timotimo tries compiling the first half of the core setting 17:39
17:43 Targen left
swarley r: say "'1'" ~~ /\' ** 2 % 1/ 17:44
p6eval rakudo c356d8: OUTPUT«「'1'」␤␤» 17:45
timotimo oh, that's bass ackwards :D 17:46
swarley yeah, lol. It just looks neat 17:47
arnsholt There's an op for that 17:49
swarley r: my token test($open!, $close=$open) { '%q' $open 'foo' $close }; say "%q/foo/" ~~ /<test '/'>/
p6eval rakudo c356d8: OUTPUT«Unmarshallable foreign language value passed for parameter '$i'␤ in method INTERPOLATE at src/gen/CORE.setting:10679␤ in regex at /tmp/KL4fhQqUus:1␤ in method ACCEPTS at src/gen/CORE.setting:10738␤ in block at /tmp/KL4fhQqUus:1␤␤»
arnsholt swarley: The ~ operator is for surrounding stuff with other stuff
swarley n: my token test($open!, $close=$open) { '%q' $open 'foo' $close }; say "%q/foo/" ~~ /<test '/'>/
p6eval niecza v24-18-gaf64300: OUTPUT«#<match from(0) to(7) text(%q/foo/) pos([].list) named({"test" => #<match from(0) to(7) text(%q/foo/) pos([].list) named({}.hash)>}.hash)>␤»
swarley oh. Nifty 17:50
arnsholt r: say "(foo)" ~~ /\( ~ \) "foo"/ # I think
p6eval rakudo c356d8: OUTPUT«「(foo)」␤␤»
timotimo yes, indeed.
arnsholt Note that you'll have to group the stuff inside if it's more than a simple thing
swarley yeah
n: my token test($open!, $close=$open) { '%q' [ $open ~ $close foo ]}; say "%q<foo>" ~~ /<test('<','>')>/ 17:52
p6eval niecza v24-18-gaf64300: OUTPUT«===SORRY!===␤␤Non-literal closers for ~ NYI at /tmp/hgbyc6HsPT line 1:␤------> $close=$open) { '%q' [ $open ~ $close f⏏oo ]}; say "%q<foo>" ~~ /<test('<','>')>␤␤Variable %q is not predeclared at /tmp/hgbyc6HsPT line 1:… 17:53
swarley n: my token test($open!, $close=$open) { '%q' $open 'foo' $close }; say "%q<foo>" ~~ /<test('<','>')>/
p6eval niecza v24-18-gaf64300: OUTPUT«===SORRY!===␤␤Variable %q is not predeclared at /tmp/ye5llZfgcm line 1:␤------> open) { '%q' $open 'foo' $close }; say "⏏%q<foo>" ~~ /<test('<','>')>/␤␤Unhandled exception: Check failed␤␤ at /home/p6eval/niecza/boot/li…
swarley hrm
timotimo it seems like nqp::die will just cause the application to hang, not even output the error message :( 17:54
swarley Anyone spot something I'm doig wrong?
17:54 adu joined
swarley n: my token test($open!, $close=$open) { '%q' $open 'foo' $close }; say Q~%q<foo>~ ~~ /<test('<','>')>/ 17:54
p6eval niecza v24-18-gaf64300: OUTPUT«#<match from(0) to(7) text(%q<foo>) pos([].list) named({"test" => #<match from(0) to(7) text(%q<foo>) pos([].list) named({}.hash)>}.hash)>␤»
swarley Ah, "" issue again
timotimo nope, there's something really weird going on
swarley n: my token test($open!, $close=$open) { '%q' $open 'foo' $close }; say Q~%q<foo>~ ~~ /<test '<' '>'>/
p6eval niecza v24-18-gaf64300: OUTPUT«Match()␤» 17:55
swarley as I expected. 17:56
timotimo how do i compare two objects in nqp for being the same thing? 17:57
eq seems to break in this little case. or maybe ... something ... don't really know :( 17:58
moritz timotimo: try ===
timotimo thanks
swarley n: my token test($open!, $close=$open) { '%q' $open 'foo' $close }; say Q~%q>foo>~ ~~ /<test '>'>/
p6eval niecza v24-18-gaf64300: OUTPUT«#<match from(0) to(7) text(%q>foo>) pos([].list) named({"test" => #<match from(0) to(7) text(%q>foo>) pos([].list) named({}.hash)>}.hash)>␤»
timotimo nope, that causes the blockoid to fail parsing
likewise for eqv 17:59
FROGGS what about =:= ?
moritz you can use =:=, though it's a bit cheaty, iirc
timotimo huh?
17:59 nyuszika7h left
moritz it's meant for container equality testing in Perl 6 17:59
timotimo OK
moritz but it's sometimes abused for === testing in nqp 18:00
nqp: say(nqp::which(123))
p6eval nqp: OUTPUT«Error while compiling block : Error while compiling op call: Error while compiling op which: No registered operation handler for 'which'␤current instr.: '' pc 46272 (src/stage2/QAST.pir:16100) (src/stage2/QAST.nqp:2434)␤»
swarley So, can anyone tell me if there is a way to reduce the writing i'm doing here? Since I'm basically repeating myself over and over again for nothing
pastebin.com/UQvZZY78
timotimo i am trying to use this to test if the &infix:<|> i got came from the CORE or not 18:01
=:= seems to work!
yes, indeed it does!
18:01 nyuszika7h joined
timotimo FROGGS, thank you! 18:01
FROGGS swarley: you can use a character class and have just one token quoted-non-expanded-literal-string:sym 18:02
timotimo: pleasure ;o)
timotimo does nqp have state variables?
moritz we're always happy to help with nqp if there's the possiblity that it results in rakudo patches :-) 18:03
swarley oh, really?
It will expand to all of them?
moritz timotimo: doesn't look like
timotimo i don't have to look through all blocks every time i see an infix:<|> or <&> to check where the CORE is
moritz timotimo: just store it once in an outer lexical
timotimo sure. 18:04
er, nqp::defined will tell me if $!core_block has been set already, right?
arnsholt crosses his fingers
With a bit of luck I'm making progress on sized ints =D
FROGGS swarley: token things { <[%-<>]> }; token quoted-non-expanded-literal-string:sym<things> { <qlit <things>> }
arnsholt But now I'm off to dinner with friends
swarley Will it iterate?
18:04 hash_table left
timotimo arnsholt: that sounds great! :) 18:04
swarley Because %q/bnub~ shouldn't work 18:05
FROGGS swarley: it match whatever <things> is, can be a character class or something else 18:06
what is %q/bnub~ ?
moritz FROGGS: but qlit, as written rigth now, expects a string as argument
swarley Normal syntax would be either %q~foo~ or %q/foo/ 18:07
FROGGS ahh, I see what you mean
timotimo it seems the setting has gotten a tiny improvement itself from my optimisation 18:08
swarley could I so something like
timotimo runs a spectest to get some timing information
and goes get some food :) 18:09
(and hopes nothing broke)
swarley token foo { (<[~/]>) <string-content> <{ case $1 ... }> } ?
moritz swarley: if it doesn't have to be parametric, you could write token qlit { 'q%' ( <[~/<>]> ) <string-content> $1 }
swarley Well, the issue is that it's supposed to have smart delimiters 18:10
moritz swarley: and then a second rule for when the opening and closing delimiter are different
swarley %q<foo>
oh
Yeah that could work
Thank you
timotimo oh no, one subtest failed in the angle brackets metasyntax test suite :| 18:11
is that my fault? o_O
FROGGS think so, yesterday at that time everything was fine on current nqp/master + rakudo/nom 18:12
moritz what's the failing test?
timotimo moritz: i'll know soon. also, the people here are urging me to get going ;) 18:13
more failures :(
socket-inet takes so darned long :( 18:14
FROGGS it does, ya
:(
timotimo paste.ee/p/vcSjQ - here's the preliminary results 18:15
could it be they are fixed in nom already and i just need to rebase?
anyway, i'll get going
FROGGS timotimo: you need to pull, the calender stuff is already fixed by masak 18:16
and the date thingeny too
not sure about angle-brackets though
moritz that's what jnthn++ fixed half an hour earlier 18:25
and added the new test for
swarley || forces it to work in order of left to right, correct? 18:26
moritz right 18:27
swarley { '(' <nes> ')' || '[' <nes> ']' || '{' <nes> '}' || '<' <nes> '>' || [<source-character>-<alnum>] <nes> $1 } would work then yes?
hm. I guess I should still subtract them out 18:28
moritz [] doesn't capture 18:29
so $1 will be empty
swarley oh, right
swarley fixes
moritz and <source-character>-<alnum> also looks vaguely wrong 18:30
swarley r: say "hello world" ~~ /<[ \x0000 .. \xFFFF ]>-<alnum>/ 18:35
p6eval rakudo c356d8: OUTPUT«===SORRY!===␤Invalid character for UTF-8 encoding␤␤»
swarley r: say "hello world" ~~ /<[ \x0005 .. \xFFFF ]>-<alnum>/
p6eval rakudo c356d8: OUTPUT«===SORRY!===␤Invalid character for UTF-8 encoding␤␤»
swarley r: say "hello world" ~~ /<[ \x0005 .. \xAE43 ]>-<alnum>/
p6eval rakudo c356d8: OUTPUT«===SORRY!===␤Unrecognized regex metacharacter - (must be quoted to match literally)␤at /tmp/3A8gLkq3ru:1␤------> "hello world" ~~ /<[ \x0005 .. \xAE43 ]>⏏-<alnum>/␤Unable to parse regex; couldn't find final '/'␤at /tmp/3A8gLkq3r…
moritz note that the - must be inside the <[ ... ]>
so
swarley r: say "hello world" ~~ /<[\x0005..\xAE43]-<alnum>>/ 18:36
moritz r: say "hello world" ~~ /<[ \x0005 .. \xAE43 ]-<alnum>]>/
p6eval rakudo c356d8: OUTPUT«===SORRY!===␤regex assertion not terminated by angle bracket␤at /tmp/seKfmexjfm:1␤------> say "hello world" ~~ /<[\x0005..\xAE43]-⏏<alnum>>/␤ expecting any of:␤ postfix␤ infix or meta-infix␤ infix stopper…
rakudo c356d8: OUTPUT«===SORRY!===␤regex assertion not terminated by angle bracket␤at /tmp/YQB43KhUUt:1␤------> "hello world" ~~ /<[ \x0005 .. \xAE43 ]-⏏<alnum>]>/␤ expecting any of:␤ postfix␤ infix or meta-infix␤ infix stoppe…
swarley r: say "hello world" ~~ /<alnum>-<digit>/
p6eval rakudo c356d8: OUTPUT«===SORRY!===␤Unrecognized regex metacharacter - (must be quoted to match literally)␤at /tmp/EYGFCQGubk:1␤------> say "hello world" ~~ /<alnum>⏏-<digit>/␤Unable to parse regex; couldn't find final '/'␤at /tmp/EYGFCQGubk:1␤------>…
swarley n: say "hello world" ~~ /<alnum>-<digit>/
p6eval niecza v24-18-gaf64300: OUTPUT«===SORRY!===␤␤Unrecognized regex metacharacter - (must be quoted to match literally) at /tmp/xgaQCwIxSP line 1:␤------> say "hello world" ~~ /<alnum>-⏏<digit>/␤␤Unable to parse regex; couldn't find final '/' at /tmp/xga…
moritz r: say "hello world" ~~ /<[ \x0005 .. \xAE43 ]-[\w]>/
p6eval rakudo c356d8: OUTPUT«===SORRY!===␤Error while compiling block : Error while compiling op call: Error while compiling block : Error while compiling block : Unrecognized subtype 'zerowidth' in QAST::Regex cclass␤»
moritz now that surely is a rakudo bug :-) 18:37
r: say 'hello world' ~~ / <+alnum-digit> /
p6eval rakudo c356d8: OUTPUT«「h」␤␤»
moritz r: say 'hello world' ~~ / <+alnum-digit>+ /
p6eval rakudo c356d8: OUTPUT«「hello」␤␤»
swarley wait, +?
moritz to indicate it's a charclass, not a normal subroutine call 18:38
r: say "hello world" ~~ /<[ \x0005 .. \xAE43 ]-alnum>/
p6eval rakudo c356d8: OUTPUT«「 」␤␤»
swarley So, what do I do about my token having [] in it?
moritz this seems to be what you wanted :-)
swarley errr
-
moritz r: say 'a- ' ~~ /<[ \x0005 .. \xAE43 ]-alnum-[\-]>/ 18:39
p6eval rakudo c356d8: OUTPUT«「a-」␤␤»
moritz huh.
swarley n: say "hello world" ~~ /<alnum - digit>/
p6eval niecza v24-18-gaf64300: OUTPUT«===SORRY!===␤␤Unrecognized regex metacharacter - (must be quoted to match literally) at /tmp/FKdUT0RkQO line 1:␤------> say "hello world" ~~ /<alnum -⏏ digit>/␤␤Unhandled exception: Unable to resolve method ast in type …
FROGGS swarley: you might wanna use a named capture, instead of referring to $1
swarley n: say "hello world" ~~ /<+alnum - digit>/
p6eval niecza v24-18-gaf64300: OUTPUT«#<match from(0) to(1) text(h) pos([].list) named({}.hash)>␤»
swarley Okay, that's better 18:40
what if I want a variable to go down a few levels of token calls?
18:40 adu left
swarley Would I just assert it and then call it up in the later token? 18:41
<{ my $foo = 'bar' }> ?
r: my token first { $letter }; my token proxy { <{ my $letter = 'f'; }> <first> }; say "foo" ~~ /<proxy>/ 18:45
p6eval rakudo c356d8: OUTPUT«===SORRY!===␤Variable '$letter' is not declared␤at /tmp/MN7J0eSPj3:1␤------> my token first { $letter⏏ }; my token proxy { <{ my $letter = 'f'␤»
swarley r: my token first { $letter }; my token proxy { <{ our $letter = 'f'; }> <first> }; say "foo" ~~ /<proxy>/
p6eval rakudo c356d8: OUTPUT«===SORRY!===␤Variable '$letter' is not declared␤at /tmp/H5RiWnYwv8:1␤------> my token first { $letter⏏ }; my token proxy { <{ our $letter = 'f␤» 18:46
swarley r: my token first { $<x> }; my token proxy { $<x>=. <first> }; say "foo" ~~ /<proxy>/ 19:04
p6eval rakudo c356d8: OUTPUT«#<failed match>␤»
swarley r: my token first { <{ say $<x> }> }; my token proxy { $<x>=. <first> }; say "foo" ~~ /<proxy>/
p6eval rakudo c356d8: OUTPUT«Any()␤Any()␤Any()␤#<failed match>␤»
timotimo i'm still failing datetime and calendar tests :( 19:05
swarley r: my token first { $<x> }; my token proxy { $<x>='o' <first> }; say "foo" ~~ /<proxy>/
p6eval rakudo c356d8: OUTPUT«#<failed match>␤»
timotimo i wonder if it's my afult
swarley r: my token first { <{ say 'o' eq $<x> }> }; my token proxy { $<x>='o' <first> }; say "foo" ~~ /<proxy>/
p6eval rakudo c356d8: OUTPUT«use of uninitialized value of type Any in string context in regex first at /tmp/42ZbTt1iuQ:1␤␤False␤use of uninitialized value of type Any in string context in regex first at /tmp/42ZbTt1iuQ:1␤␤False␤#<failed match>␤»
swarley r: my token first { <{ say 'o' eq $<x> }> }; my token proxy { $<x>=<[o]> <first> }; say "foo" ~~ /<proxy>/
p6eval rakudo c356d8: OUTPUT«use of uninitialized value of type Any in string context in regex first at /tmp/CEMaE94Pd6:1␤␤False␤use of uninitialized value of type Any in string context in regex first at /tmp/CEMaE94Pd6:1␤␤False␤#<failed match>␤»
swarley r: my token first { <{ say $<x> }> }; my token proxy { $<x>=<[o]> <first> }; say "foo" ~~ /<proxy>/ 19:06
p6eval rakudo c356d8: OUTPUT«Any()␤Any()␤#<failed match>␤»
19:06 arlinius joined
swarley r: say "foo" ~~ /$x=. $x/ 19:06
p6eval rakudo c356d8: OUTPUT«===SORRY!===␤Variable '$x' is not declared␤at /tmp/bzAZvnJzqa:1␤------> say "foo" ~~ /$x⏏=. $x/␤»
swarley r: say "foo" ~~ /$x=<.> $x/ 19:07
p6eval rakudo c356d8: OUTPUT«===SORRY!===␤Variable '$x' is not declared␤at /tmp/B9yivKFWlA:1␤------> say "foo" ~~ /$x⏏=<.> $x/␤»
swarley r: say "foo" ~~ /$0=<.> $0/
p6eval rakudo c356d8: OUTPUT«===SORRY!===␤Unrecognized regex metacharacter = (must be quoted to match literally)␤at /tmp/Jl8q_uZDS0:1␤------> say "foo" ~~ /$0=<.⏏> $0/␤Unable to parse regex; couldn't find final '/'␤at /tmp/Jl8q_uZDS0:1␤------> say "foo…
FROGGS r: say "foo" ~~ /$<x>=<.> $<x>/
p6eval rakudo c356d8: OUTPUT«===SORRY!===␤Unrecognized regex metacharacter = (must be quoted to match literally)␤at /tmp/g73MUOFTIY:1␤------> say "foo" ~~ /$<x>=<.⏏> $<x>/␤Unable to parse regex; couldn't find final '/'␤at /tmp/g73MUOFTIY:1␤------> say …
swarley r: say "foo" ~~ /$0=<(.)> $0/
p6eval rakudo c356d8: OUTPUT«#<failed match>␤»
FROGGS r: say "foo" ~~ /$<x>=[.] $<x>/
p6eval rakudo c356d8: OUTPUT«「oo」␤ x => 「o」␤␤» 19:08
swarley Oh, will that persist multiple levels of tokens?
FROGGS no idea
swarley r: my token first { $<x> }; my token proxy { $<x>=[.] <first> }; say "foo" ~~ /<proxy>/
p6eval rakudo c356d8: OUTPUT«#<failed match>␤»
swarley r: my token first { <{say $<x>}>}; my token proxy { $<x>=[.] <first> }; say "foo" ~~ /<proxy>/ 19:09
p6eval rakudo c356d8: OUTPUT«Any()␤Any()␤Any()␤#<failed match>␤»
swarley grr
FROGGS r: my $X; my token first { <{say $X}> }; my token proxy { $<x>=[.] { $X = $<x> } <first> }; say "foo" ~~ /<proxy>/ 19:10
p6eval rakudo c356d8: OUTPUT«「f」␤␤「o」␤␤「o」␤␤#<failed match>␤»
timotimo runs a spectest without his optimisations for comparison
FROGGS r: my $X; my token first { <{say $X}> <{$X}> }; my token proxy { $<x>=[.] { $X = $<x> } <first> }; say "foo" ~~ /<proxy>/
p6eval rakudo c356d8: OUTPUT«「f」␤␤「o」␤␤「o」␤␤#<failed match>␤»
timotimo i'm expecting the startup time due to optimisations will make the tests pass slower, because junctions aren't used very often 19:11
FROGGS r: my $X; my token first { <{say $X}> <{$X}> }; my token proxy { $<x>=[.] { $X = $<x> unless $X } <first> }; say "foo" ~~ /<proxy>/
timotimo but who knows?
p6eval rakudo c356d8: OUTPUT«「f」␤␤「f」␤␤「f」␤␤#<failed match>␤»
FROGGS r: my $X; my token first { <{say $X}> <{~$X}> }; my token proxy { $<x>=[.] { $X = $<x> unless $X } <first> }; say "foo" ~~ /<proxy>/
p6eval rakudo c356d8: OUTPUT«「f」␤␤「f」␤␤「f」␤␤#<failed match>␤»
19:12 Exodist left
FROGGS r: my $X; my token first { <{say $X}> <{~$X}> }; my token proxy { $<x>=[.] { $X = $<x> } <first> }; say "foo" ~~ /<proxy>/ 19:12
p6eval rakudo c356d8: OUTPUT«「f」␤␤「o」␤␤「o」␤␤#<failed match>␤»
FROGGS bah
timotimo: do you know how long the testsuite takes, so you can compare? 19:14
timotimo yes
Files=722, Tests=26726, 1099 wallclock secs ( 4.20 usr 1.24 sys + 868.91 cusr 74.60 csys = 948.95 CPU)
takes quite a while :(
FROGGS at work I could do TEST_JOBS=16, but I've got no rakudo there :/ 19:17
timotimo i chose to use only 1 of 4
may have been a bad idea
19:20 SunilJoshi left
timotimo without the optimisation: Files=722, Tests=26726, 1098 wallclock secs ( 4.32 usr 1.16 sys + 868.31 cusr 73.53 csys = 947.32 CPU) 19:31
about 0.1% impact when not really used 19:32
that seems decent.
wait what. i'm confuse. 19:39
19:39 SamuraiJack left
timotimo perl6 junction_benchmark.p6 5.10s user 0.10s system 99% cpu 5.213 total (unoptimised) vs perl6 --optimize=3 junction_benchmark.p6 3.06s user 0.14s system 99% cpu 3.217 total 19:39
that seems like a decent win in a junction-heavy benchmark
FROGGS ohh, ya 19:45
20:01 tadzik left 20:02 Util left, Juerd left 20:04 Juerd joined, hugme left, Util joined 20:05 [Coke] left, [Coke] joined, hugme joined, ChanServ sets mode: +v hugme
timotimo maybe i can encourage perl6ers to use more junctions 20:18
20:26 b1rkh0ff joined 20:29 tadzik joined
timotimo jnthn: i'd be interested to know how we could turn junctions into junction objects at optimizer time. could you explain that when you come back? maybe i can even implement it 20:33
20:39 zby_home left
timotimo also, my optimisation didn't bail out when faced with a custom infix:<|>. apparently my checks were not helpful :( 20:44
moritz you call infix:<|> 20:45
timotimo i did what?
moritz you didn't. But that's how you'd create a Junction object 20:46
timotimo ok, and then? can i just put it into the ast? just like that? or maybe in a QAST::Var? 20:47
moritz you do $*W.add_object($junction)
and then QAST::WVal(:value($junction))
timotimo that seems remarkably simple 20:48
moritz timotimo: also of interest might be Perl6::World.compile_time_evaluate
timotimo first, i need to figure out why it's nonfunctional at the moment :( 20:51
paste.ee/p/zrKEL - can you see why it doesn't say woop? 20:56
when i put 1 | 2 == 1 instead, it does
that's what confuses me profoundly
moritz what is this 'chain' thingy? 21:00
timotimo er, i glomped it from context :| 21:03
moritz timotimo: can you please nopaste the code that generated it?
timotimo sure
is a diff against current nom okay, too?
moritz yes, that's what I wanted :-) 21:04
timotimo sprunge.us/EDIZ 21:05
moritz timotimo: do you know what :op<chain> does? 21:10
because I suspect it's something AND-like 21:11
but a |-Junction needs something OR-like
timotimo i'm afraid not. but :op($juncop> seems to have been wrong 21:12
moritz I'd try to compile 1 | 2 == $thing to a chain of 'unless' ops 21:14
and & to a chain of 'if' ops
21:16 pupoque joined
timotimo trying it now 21:16
21:19 grondilu left
timotimo yes, that works. great! 21:22
moritz: can you tell why my "is_from_core" doesn't work properly? :( 21:23
when i define a sub infix:<&>($a, $b) { say "$a, $b"; all($a, $b) } and do if 2 & 2 == 2 { say "woop" } i get "woop", but not "$a, $b" 21:24
unless i turn off my optimization :|
moritz takes a look
21:25 preflex joined
moritz timotimo: where exactly is CORE_MARKER installed? 21:25
timotimo allegedly in the block that contains all the things from CORE.setting
moritz ok, two things 21:26
the first problem is that if you define your own infix:<|>, then it'll first find this one
then the code walks to the outer blocks too
und then finds the one from CORE, and returns 1
timotimo wait, i had a return 0 there! where did it go?! 21:27
i put it into the wrong function >_<
i should not be surprised.
moritz and secondly, shouldn't you be looking for !CORE_MARKER in $block instead of %sym? 21:29
timotimo allegedly it's a lexical in the block
moritz that's why I think it should be in $block, not in %sym 21:30
timotimo before i had is_from_core like find_lexical, only that it returned the block instead of a lexical and then i compared the CORE::infix:<&> with the one find_lexical found
moritz that would have been my approach too
timotimo yaaaay, it works now/again 21:34
moritz \o/
timotimo i felt this approach would be more performant. also it's how jnthn suggested it at the start
i should come up with a test suite that checks many different cases properly 21:35
about the only place that uses junctions, ever, is masaks time code :) 21:36
when second | seconds etc etc
moritz timotimo: note that &infix:<|> and &any are basically the same thing 21:38
and that both can take more than two args
timotimo yes. what exactly is this important for? 21:40
do you think i should do the exact same with any, too?
moritz yes
oh, and you should only do the transformation in boolean context 21:41
timotimo i only do it if there's an if or unless directly outside
so i already got that covered, i think
21:41 quester joined
moritz ah great 21:42
timotimo actually, it seems to fire on "when", too, without me having to do anything special
21:42 kaare_ left
moritz a 'when' compiles to an 'if' (plus a bit stuff) 21:42
oh, and a 'while' or 'until' on the outside would als be OK 21:43
timotimo i'll quickly check if that already happens
doesn't seem so 21:44
i'll try to remember that as a todo item
is there a third junction that i can turn into a simpler logical thing? i don't think so 21:45
moritz none() 21:46
is a negated all()
so you can do the same as for &, but switch the branches of the 'if' 21:47
(I think)
timotimo ah, neat.
so turn the if into an unless?
moritz no, then you have the | 21:48
timotimo oh, indeed
what do you mean switch the branches for if?
21:48 pupoque left
moritz QAST::Var.new(:op<if>, $a, $b) -> QAST::Var.new(:op<if>, $b, $a) 21:49
21:49 pupoque joined
timotimo wait, no, that's not right 21:49
moritz erm wait
timotimo $a, Nil, $b 21:50
er, no still different
moritz watches a movie at the same time, so his brain is only half there
timotimo $a, $b, $c turns into $a, $c, $b
and if $c doesn't exist, what do i do then?
moritz none($a, $b, $c) == 3 is the same as prefix:<!>( all($a, $b, $c) == 3 )
timotimo i can do that, too, sure 21:51
moritz erm, still wrong
none = ! any
so s/all/any/ in the previous line
erm not quite previous
I hope you know what I mean :-) 21:52
timotimo er, yes
i do
21:54 PacoAir left
timotimo GlitchMr: you missed a few places where suggestions happen 21:57
21:58 MayDaniel left
timotimo namely in my *HERE* $foo; 22:02
and, er, i think another place, too
swarley Well.. Now that I have 330 lines of tokens
timotimo but thanks for mentioning those things :) 22:03
swarley I have no idea how to start working on the grammar
timotimo hah :) 22:04
well, you start with a TOP rule ;)
swarley alright.. I suppose that's more than i had planned already
swarley is not even sure what would make up a program body in terms of grammar 22:05
I guess. <statement>* ?
moritz swarley: what are you trying to parse? 22:06
swarley Ruby, I've been working on the grammar for about two weeks now. I don't like the cardinal implementation so much
timotimo are you implementing a ruby compiler in nqp? 22:07
that will target QAST?
swarley I'm using PCT
timotimo maybe your implementation will get more popular than JRuby :)
Perl6 Compiler Toolkit?
swarley yes
swarley sighs 22:08
I've always had trouble with grammars
Lexing is alright
But grammars will be the death of me
timotimo perl6 compiler toolkit is a thing?
moritz don't worry, you'll get used to it :-)
timotimo ah, parrot compiler toolkit, duh 22:09
swarley whoops, I misread what you said
I didn't read closely enough
moritz timotimo: it's the predecessor of NQP + QAST compiler
swarley I'm behind again already? :(
Is there something new that I should be looking into using instead?
timotimo swarley: yeah, parrot is being deprecated
:P
swarley asdfghjkl; 22:10
timotimo well, maybe not yet
swarley Alright, link me
moritz swarley: nqp
github.com/perl6/nqp/
swarley Ah. do they have a mk_language_shell.pl equiv?
moritz I don't think so :(
timotimo moritz: oh my, it seems like using any isn't quite as easy as just saying "do the stuff for any, too!"
moritz timotimo: :( 22:11
moritz needs to get some sleep now
ciao
timotimo because it has a Stmts with infix:<,> in it
bye morits, and thanks for all the help!
swarley Alright.. Well then, I'm going to need even more help, or some pointers to documentation on how I would go about this in NQP instead.
swarley clones
I thought reading the rakudo grammar would help. Nope :p still huge and beyond me 22:12
timotimo heh 22:13
the nqp grammar is a bit smaller
22:13 pupoque left
swarley Well, that may help then 22:13
Reading the cardinal grammar is just.. Not helpful at all really
timotimo hehe :) 22:14
swarley plus it's in perl-grammar
I'm not exactly sure how the whole proto 'infix:/' is equiv('infix:*') { ... } 22:15
works
Is that precendence at work?
colomon yes 22:16
swarley looking at the cardinal source though, I'm doing much more work than I need to
colomon it's saying / has the same precedence as * 22:17
swarley oh, okay, well what is the { ... } ?
Is that just a void block?
colomon exactly
swarley Alright then
I know I seem rather unqualified to be attempting this, but I promise I'll be more independent once I get out of the parsing stage >.>, it just seems like I'm learning 3 new languages to get this done. 22:20
timotimo swarley: i'm doing the same thing, constantly asking dumb questions, but i'm slowly improving 22:22
flussence if you've got this far, there are no dumb questions 22:26
swarley waits for rakudo to finish building 22:38
that "Stage start : 0.000" is mocking me silently, I just know it
timotimo :)) 22:39
swarley blah. Maybe I should go make a sandwich or something lol. 22:40
I wish I could see progress :( 22:42
It's just a lonely blinking prompt staring into my soul
flussence `watch cat /proc/$(pidof parrot)/status` :D 22:43
swarley welp, `ps aux | grep parrot' seems to have slowed down my machine a good amount 22:45
22:45 aindilis left
timotimo are you swapping massively? 22:46
swarley 512mb swap
timotimo is doing all his rakudo coding on his desktop via SSH, because the desktop is almost 2x as fast when building rakudo
swarley I'm doing it in a VM of gentoo
timotimo oh, good idea, gentoo is very fast! 22:47
swarley That was my though when I set it up.
I only planned on using the VM for ruby and perl6
So I wanted the speed more than anything
timotimo not actually serious about that. i set up a vm with linux mint and saw it's nice, so now i've got a vm with mint and mint natively, too 22:50
swarley I've got mint as my main OS on this computer 22:52
I'm in windows because I've been having to do some skype calls and I've been playing games with friends 22:53
Otherwise, I wouldn't be able to stand it
swarley hopes the build finishes within 10 minute 22:55
s
timotimo what exactly are you building? 23:04
swarley So, for the protos, i.e
proto token infix { <...> }
proto token prefix { <...> }
Do they just group names?
I just ran `make install` in rakudo/rakudo 23:05
timotimo that takes 10 minutes?!
you are on nom/ right?
swarley Yes
It's not done yet
timotimo wat.
tadzik it may take time on slow machines
timotimo takes only 2 minutes on my desktop, 4 minutes on my laptop 23:06
swarley ** WinSys ** Client: HexChat 2.9.1 (x64) ** OS: Microsoft Windows 7 Ultimate ** CPU: AMD Phenom(tm) II P650 Dual-Core Processor (2.00 GHz) ** RAM: 3834 MB Total (1822 MB Free) ** VGA: ATI Mobility Radeon HD 4200 ** Uptime: 2.35 Hours **
timotimo well, the build only uses one core anyway, so ... 23:07
Intel(R) Core(TM)2 Duo CPU L9400 @ 1.86GHz
are you sure you're not running out of RAM in your virtual machine?
swarley Pretty sure
It's allowed to use all of it
let me check
timotimo and you turned on hardware virtualisation in your BIOS? 23:08
i'm surprised. on your machine it should really not take that long
swarley 4mb free 23:09
in ram
Tons of free swap
timotimo wow, how can that be right?
swarley No idea
timotimo are you looking at free -m?
swarley It did this when I tried to compile it natively too
yes
When I compiled it in mint it crashed my computer the first time 23:10
timotimo you know you have to look into the line starting with "+/- cache/buffers"?
swarley Yes
timotimo that's weird :)
swarley Yeah, when I tried to run it under mint natively it locked my computer up 23:11
I had to restart and try again
timotimo maybe it hit some memory limit and died. the last time it called die during the CORE.setting compilation it just stopped executing, but did 100% cpu usage
swarley 88% cpu usage when I just killed it 23:12
timotimo unfortunately you can't see where it stopped when you killed it 23:13
or even cause it to emit a stack trace at some point
swarley :(
timotimo i would love that feature :(
swarley Yeah, I'm really not wanting to sit here all day and wait for this..
I'll just build NQP and play with that for now since it's all I really need 23:15
I'll get back to rakudo later
But yeah, what is the real purpose of proto?
It seems like a namespace as far as I can tell 23:16
timotimo doesn't really know either
swarley I can't tell if infix:sym<blah> does magic or anything..
timotimo i think the magic is that you can use <sym> to match "blah" in that token there 23:26
23:36 spider-mario left
swarley Like, what does this represent? 23:41
token infix:sym<**> { <sym> <O('%exponentiation')> }
23:45 quester left
timotimo that means it matches a ** as an infix (like the proto prescribes) and creates a %exponentiation Op QAST node 23:49
(at least i think it does!) 23:50
the O is probably defined in one of the Action perl modules
23:52 wrc joined
wrc game pre pc 23:52
game per pc
23:53 wrc left 23:57 quester joined 23:59 quester left