00:14
jgaz left
00:43
jgaz joined
01:10
jgaz left
02:56
frost joined
06:20
tirnanog joined
|
|||
Anton Antonov | Good to know! | 14:14 | |
I noticed that after studying Raku for a few years it is much easier to advance my learning of otherprogramming languages. | 14:17 | ||
I noticed that after studying Raku for a few years it is much easier to advance my learning of other programming languages. | 14:43 | ||
14:57
frost left
|
|||
Nemokosch | Raku has a very clever built-in collection of data types, for example | 16:10 | |
and very nice meta operators | |||
16:12
razetime joined
17:05
razetime left
19:18
tirnanog left
|
|||
klebs | im seeing a case where a grammar parse ordinarily fails quickly, but then hangs when i try to trace it | 19:28 | |
if i kill the trace, i get an output like this: | |||
looks like some kind of infinite loop | |||
but my question is: why would this only be triggered once i add `use Grammar::Tracer;` | |||
no other changes | |||
``` | 19:42 | ||
#!/usr/bin/env raku | 19:43 | ||
use my-grammar; | |||
my $in = $*IN.slurp.chomp; | |||
grammar T { | |||
token LIT-CHAR { | |||
\' . \' | |||
} | |||
} | |||
say T.parse("'a'", rule => "LIT-CHAR"); | |||
my $parsed = MyGrammar.parse( | |||
$in, | |||
rule => "LIT-CHAR" | |||
); | |||
MyGrammar is, however, a much more substantial grammar with many more rules, but LIT-CHAR is at the leaf position | |||
whoops maybe this shouldn't be in beginner | 19:45 | ||
(this example is with Grammar::Tracer turned *off*, turning it on *hangs* on the second parse) | |||
``` | |||
#!/usr/bin/env raku | |||
use my-grammar; | |||
my $in = $*IN.slurp.chomp; | |||
grammar T { | |||
token LIT-CHAR { | |||
\' . \' | |||
} | |||
} | |||
say T.parse("'a'", rule => "LIT-CHAR"); | |||
MasterDuke | i think it's known that Grammar::Tracer can sometimes interfere with what it's tracing | 19:47 | |
klebs | (this example is with Grammar::Tracer turned *off*, turning it on *hangs* on the second parse) | ||
``` | |||
#!/usr/bin/env raku | |||
use my-grammar; | |||
my $in = "'a'"; | |||
grammar T { | |||
token LIT-CHAR { | |||
\' . \' | |||
} | |||
} | |||
say T.parse($in, rule => "LIT-CHAR"); | |||
my $parsed = MyGrammar.parse( | |||
MasterDuke | i don't know if there's any workaround though | ||
klebs | debugging the debugger 🙂 | 19:48 | |
that may explain the hang, however why do we get a `failed match`? | 19:49 | ||
(when running without Grammar::Tracer) | |||
seems to me like it should succeed because it is the same rule at toplevel | |||
MasterDuke | you're saying you get `「'a'」` but then it fails the second time? | 19:53 | |
klebs | yes | 19:57 | |
one other detail perhaps of note is that this grammar is created by mixing in about 130 different roles | 19:59 | ||
so it is pretty big | |||
meant to parse a full language | |||
but i dont see why that should cause a failed match when i directly specify the rule via the parse method as shown above | |||
MasterDuke | i haven't actually done much with grammars so not sure i can be any more use, but if guifa or codesections can't help you here, i'd recommend asking moritz over in #raku | 20:03 | |
klebs | thanks for the help 🙏 | 20:05 | |
MasterDuke | np | 20:07 | |
klebs | i found a way to drill down and locate the source of the problem | 20:56 | |
basically just binary search commenting and uncommenting batches of tokens | 20:57 | ||
will find it soon | |||
i think there might be some other rule the grammar engine doesn't like | |||
which is causing faulty behavior | |||
that is my best gues | |||
that is my best guess | |||
yep that was the problem | 20:59 | ||
for some reason this was an error: | |||
`token MATCH { match }` | |||
changing to `token MATCH_ { match }` | |||
solved | |||
gfldex | @klebs#2209 I believe you stepped onto: github.com/Raku/nqp/blob/master/sr....nqp#L1101 | 21:04 | |
MasterDuke | ah yes, using names already used in the core can cause odd problems | ||
gfldex | or github.com/rakudo/rakudo/blob/mast...ch.pm6#L40 | 21:05 |