Welcome the channel on the development of Cro, a set of libraries for building reactive distributed systems, lovingly crafted to take advantage of all the Raku Programming Language has to offer (cro.services). This channel is being logged for historical purposes.
Set by lizmat on 24 May 2021.
06:35 Altai-man joined 06:36 Altai-man left 06:39 Altai-man joined 09:22 lizmat left 09:23 lizmat joined, TempIRCLogger__ joined 09:25 TempIRCLogger left 10:17 Xliff joined
Xliff \o 10:17
jnthnwrthngtn: Good morning. Have a question about RakuAST, but you aren't in the Raku channels at the moment. Mind if I ask this, here? 10:20
Well, I deciced to gist it: gist.github.com/Xliff/bc5f7277d0fe...7649d1ce76 10:25
lizmat interesting question :-) 10:28
Xliff Yep. Was actually pretty fun to write, once I figured out a few things. 10:30
Still, large scale RakuAST would be better if I had the raku to start with and could then parse it down into RakuAST, somehow. 10:31
Almost wonder if I could pull the grammar from the MAIN language braid and use that. 10:32
lizmat Xliff: if you look at the test files, I think you will find examples of source being converted to ASTs ?
in fact, it is part of the Deparse tests, to see whether they roundtrip 10:33
Xliff Would those be found in t/12-rakuast? 10:36
lizmat: Actually, those tests originate from the RakuAST representation, not Raku. 10:38
lizmat hmmm... 10:39
but isn't that what EVAL returns if you switch on the RakuAST grammar ? 10:40
the tests should work either way, no ?
jnthnwrthngtn Xliff: I'm trying to work out which of two questions you're asking, but then realized you may not be sure :D 10:42
Anyway, there's two things
Xliff OK 10:43
jnthnwrthngtn 1. Yes, it'd be desirable if there's an API in Raku where you give it source code and it gives you back RakuAST. I didn't really design this yet, but agree it should exist.
2. I don't think that's actually what you want, though, because then you'd have strings of Raku code. I think quasi quotes are more what you're looking for. 10:44
Xliff Was looking for #1, but would be interested to hear about #2
jnthnwrthngtn A quasi is a way to quote a bit of Raku code such that you get back the AST fo it 10:45
*of it
So instead of RakuAST::IntLiteral.new(42), you would write `quasi { 42 }`
There are also unquotes, so if you had $ast-a and $ast-b, you could instead of `RakuAST::ApplyInfix.new(infix => RakuAST::Infix.new('+'), left => $ast-a, right => $ast-b)` write `quasi { {{{$ast-a}}} + {{{$ast-b}}} }` 10:47
Xliff OK! I like that.
jnthnwrthngtn In general: while quasis have been talked about primarily in the context of macros, with RakuAST they're useful outside of them too.
Xliff I'm interested in RakuAST to provide a more maintainable way to hande a lot of existing code in my GLib projects 10:48
That bit in the gist is a part of that work.
jnthnwrthngtn My expectation is that folks writing parsers that compile stuff into RakuAST might find the OO API (constructing AST objects) more comfortable, but folks doing stuff along the lines of what you showed will find quasi quoting far more convenient. 10:49
Xliff So it looks like role composition is still unaddressed, so I
I've gone as far as is supported.
And I may just find quasi blocks very useful in that. 10:50
jnthnwrthngtn I'll get back to RakuAST stuff once new-disp is landed :)
Xliff Fair enough. I expected no less. Your new-disp stuff has been fascinating.
At any rate, thanks for the answers!
jnthnwrthngtn Welcome :)
Also I think I owe you at least one PR review on cro-webapp 10:51
Xliff Yeah. I had to pull a fix. Come to think of it... I might want to get back on that! LOL!
jnthnwrthngtn: Consider the this jsFiddle -- jsfiddle.net/rzaceg8v/ 11:02
Having the trailing 'Z' at the end cause the second field to not work.
The first works fine with the trailing 'Z' removed.
*sigh* proper fiddle is here: jsfiddle.net/mwku48o2/ 11:04
18:08 patrickb joined 19:16 patrickb left 19:43 Xliff left