Perl 6 - the future is here, just unevenly distributed

IRC log for #marpa, 2016-05-02

| Channels | #marpa index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
01:34 idiosyncrat_ A question about the "semantics package" in Marpa::R3.
01:35 idiosyncrat_ In Marpa::R2 you can specify the "semantics package" as an argument when creating the recognizer, but if you don't, and you supply a blessed per-parse arg to the value() method, then the package into which the per-parse argument is blessed ...
01:35 idiosyncrat_ is taken as the semanitcs package.
01:35 idiosyncrat_ Yes, it's really complicated.
01:35 idiosyncrat_ https://metacpan.org/pod/Ma​rpa::R2::Scanless::R#value
01:35 idiosyncrat_ I'd like to simplify this in Marpa::R3.
01:36 idiosyncrat_ Thoughts?
01:38 idiosyncrat_ I think it'd be best to have the per-parse arg have nothing to do with the semantics package, which can only be specified with the 'semantics_package' named argument:
01:38 idiosyncrat_ https://metacpan.org/pod/Marpa::R​2::Scanless::R#semantics_package
01:38 idiosyncrat_ With this a whole host of confusing special cases disappear.
01:40 idiosyncrat_ Btw, the way things are done in Marpa::R2 arose for historical reasons -- I found new ways to do things, and bugs in old ways, and had to incorporate both while maintaining backward compatibility.
03:03 ronsavage JK: Re http://irclog.perlgeek.de/m​arpa/2016-05-02#i_12419144. Yes, this was always a niggle. But this confuses me: http://irclog.perlgeek.de/m​arpa/2016-05-02#i_12419157.
03:05 ronsavage Clearly a named semantics package indicates in which package the subs are looked for. Are you also saying Marpa::R3 will have to be told which thingy to use as the per-parse argument?
03:06 ronsavage Actually, that would be good in Perl. I'd do my($per_parse) = X::Y -> new and later specify /separately/ 2 params: 'X::Y' if I had action subs, and $per_parse as the thingy to use. Right?
03:07 ronsavage So that for the per-parse arg, I would normally use $per_parse, but I could just do my($hash_ref) = {} and pass that instead.
03:09 ronsavage This in turn means the new code would never call new to create another object which I could not get my hands on! /Now/ you're talking :-))).
03:11 ronsavage Of course some people would not do it my way (tsk, tsk) so in those cases the new code would either use (user's choice) main:: or it's own object. That'd be fine with me.
03:30 idiosyncrat_ ronsavage: not sure I followed you, but I'm thinking of having the per-parse argument no longer has anything to do with where the semantics are found.
03:31 idiosyncrat_ So that is your per-parse argument is blessed in package X::Y, and you want Marpa::R3 to find methods there, you'll also have to specify the 'semantics_package' named argument.
03:33 idiosyncrat_ The real problem was with multiple calls to $recce->value() with different per-parse arguments.  If I take the semantics from them, I either have to require them to all be blessed into the same package, or get into a host of crazy ...
03:34 idiosyncrat_ special cases.
03:34 idiosyncrat_ I want to disentangle the per-parse arguments from the locations of the semantics entirely.
03:35 idiosyncrat_ Similarly, I'd do away with the idea of the per-parse constructor.  That is,
03:36 idiosyncrat_ in Marpa::R2 if your semantics package has a new() method, then it was assumed to be a constructor for your per-parse arguments.
03:37 idiosyncrat_ This kind of looked cool in examples, but folks ran into trouble when they had per-parse arguments which had new() method calls which were for other purposes.
03:39 idiosyncrat_ I thought tying per-parse arguments to the semantics was very OO-ish and cool-looking, and wound up painting myself into several corners ...
03:39 idiosyncrat_ if that works as a metaphor. :-)
03:41 ronsavage So we won't be able to use value() to specify a class name in any way? OK. That's the job of the semantics_package argument. OK.So it people don't specify the semantics_package argument, then the new code does not create an object?
03:43 ronsavage Which means no methods, just subs, as actions. OK. I would say the per-parse argument should be a parameter alongside semantics_package, and not a parameter to value(). Is that what you're thinking?
03:46 ronsavage 'it people' => 'if people'.
04:08 idiosyncrat_ It's useful (I think) to have a different per-parse argument for every parse in an ambiguous series.  That's why specify it with the $recce->value() call.
04:08 idiosyncrat_ There is *always* a per-parse argument.  If no specified, it's an empty hash.
04:08 idiosyncrat_ s/If no/If not/
05:31 idiosyncrat_ In refactoring, I came to an obscure setting: the 'too_many_earley_items' flag, which I'm glad to say most of you will never have heard of.
05:31 idiosyncrat_ Because if you need it, it'd be a problem.
05:32 idiosyncrat_ Marpa will parse any grammar, no matter how ambiguous, but if the grammar is very ambiguous, ...
05:32 idiosyncrat_ it may consume all of virtual memory.
05:33 idiosyncrat_ To prevent this, there's a cort of "circuit breaker", a warning level that, when reached, indicates you probably have a pathologically ambiguous grammar, which you need to rewrite.
05:34 idiosyncrat_ This "too many Earley items" threshold is set automatically to a number computed based on your grammar, using a formula which has been very successful in practice.
05:35 idiosyncrat_ But it *is* possible that, say, you are experimenting with combinatorics using grammars, and really ambiguous grammars are exactly what you're interested in, ....
05:36 idiosyncrat_ so you don't want any "circuit breakers" -- if the parse eats up virtual memory, so be it.
05:36 idiosyncrat_ For this reason there is a "too_many_earley_items" flag which you can use to reset the limit, and get rid of it entirely.
05:37 * idiosyncrat_ is building up to a point, believe it or not
05:37 idiosyncrat_ Anyway, Marpa::R2 didn't have any test of this in its test suite, so I've added two -- one for the L0 grammar, and one for the G1 grammar.
05:38 idiosyncrat_ In the process I cleaned up the warnings:
05:38 idiosyncrat_ Duplicate warnings had occurred at a single location -- I eliminated those.
05:39 idiosyncrat_ And using the 'trace_file_handle' to divert warnings and traces had had no effect on these messages -- now it does.
05:40 ronsavage joined #marpa
05:40 idiosyncrat_ It's unusual to test diagnostics and warnings at all, much less as thoroughly as Marpa does ...
05:40 idiosyncrat_ but I think it should be more common ...
05:40 idiosyncrat_ it pays off in robustness.
05:41 idiosyncrat_ Good night -- will backlog.
05:43 ronsavage OK;
07:31 ronsavage joined #marpa
10:37 lucs joined #marpa
10:51 kaare_ joined #marpa
12:54 rns joined #marpa
12:57 rns idisyncrat, ronsavage: re http://irclog.perlgeek.de/m​arpa/2016-05-02#i_12419157 -- IMHO, semantics_package via recognizer and $slg->parse() and per-parse arg via value() looks like a good balance of features and simplcity.
12:57 rns AFK, will backlog.
12:57 rns left #marpa
14:47 idiosyncrat_ joined #marpa
14:48 idiosyncrat_ Overnight I realized the problem with multiple "Earley item threshold" events really should be seen as a Libmarpa bug, and the Perl/XS fix is just a workaround.
14:48 idiosyncrat_ So today, after a long time away, I'm doing some minor Libmarpa hacking.
14:58 koo7 joined #marpa
15:14 idiosyncrat_ The libmarpa code is scary -- now I understand why the Stanford guys are still teaching 40 year old algorithms. :-)
15:20 iarna_ joined #marpa
15:26 JPGainsborough joined #marpa
16:43 pczarn joined #marpa
17:13 idiosyncrat_ OK.  The "too many YIMs" duplicate warnings problem is not done & tested in Libmarpa; and the Marpa::R3 workaround has been eliminated in favor of the Libmarpa fix.
17:13 idiosyncrat_ s/not done/now done/
17:34 idiosyncrat_ I also elminated a minor documentation bug in Libmarpa: "MARPA_EVENT_SYMBOL_PREDICTED" under "Event Codes" http://jeffreykegler.github.io/Marpa-web-site/li​bmarpa_api/stable/api_one_page.html#Event-codes ...
17:35 idiosyncrat_ referred to the wrong method.
17:37 aredridel joined #marpa
18:26 koo7 joined #marpa
19:25 choroba joined #marpa
19:53 idiosyncrat_ AFK
20:23 beaugunderson_ joined #marpa
22:44 idiosyncrat_ joined #marpa
23:19 koo7 joined #marpa

| Channels | #marpa index | Today | | Search | Google Search | Plain-Text | summary