Perl 6 - the future is here, just unevenly distributed

IRC log for #marpa, 2017-12-13

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

All times shown according to UTC.

Time Nick Message
03:00 ilbot3 joined #marpa
03:00 Topic for #marpa is now Start here: http://savage.net.au/Marpa.html - Code paste/run: https://f.perlbot.pl/#marpa - Jeffrey's Marpa site: http://jeffreykegler.github.io/Marpa-web-site/ - IRC log: http://irclog.perlgeek.de/marpa/today - Youtube channel: https://www.youtube.com/channel/UCYKVfGBtfTqbs1JdYq-dc5g
05:46 idiosyncrat joined #marpa
05:46 idiosyncrat Demat!
05:46 idiosyncrat left #marpa
14:07 koom joined #marpa
16:59 ernimril joined #marpa
17:30 Cheery joined #marpa
20:02 amon_ joined #marpa
20:12 amon_ Hello :) I'm currently rewriting parts of an ad-hoc parser with Marpa::R2. Marpa handles small document fragments in my input stream. These fragments are independent of each other.
20:13 amon_ For each fragment, I create a new recognizer. This works well, but my application spends more than 50% of its time in registration_init(), which performs initialization and semantics resolution for "$recce->value()".
20:13 amon_ Question: Is there a way to reuse a recognizer to avoid repeated initialization?
20:13 amon_ After all, I'm staying in the same input string and want to keep using the same semantics.
20:13 amon_ I looked at $recce->series_restart(), but found the docs somewhat unclear.
20:14 amon_ Do I understand correctly that this does not allow a new parse to start, but can only continue the previous parse or re-evaluate the same parse with different semantics?
20:23 amon_ Hmm, I found a workaround where I change the top rule of my grammar to "Top ::= (Top SKIP_TO_NEXT_PARSE) Top", and lexeme_read() the skip before I resume.
20:27 amon_ Nope, didn't work – still the same number of registration_init() calls :(
20:29 amon_ I'll be reading the backlog during the next few days, and would welcome any pointers or ideas. Quite likely someone has already done the same thing, and I just didn't find it.
20:30 Cheery hello
20:31 Cheery amon_: there probably is, if not, then it should be made
20:32 Cheery the pre-initialization step, I mean.
20:33 Cheery Jeffrey's algorithm does NNF decomposition & right recursion detection at least.. Those things produce a grammar that should be perfectly reusable among many parses.
20:34 Cheery amon_: for your own entertainment, you should perhaps look into the headers and see what's in the $recce
20:34 Cheery I mean.. Maybe you'd be able to duplicate it by copying or something.
20:35 Cheery It's odd thing though.. amon_ let me check out into the code.. while at it I also teach you a little bit
20:36 amon_ Yes, and the Marpa::R2::Scanless::G grammar object _is_ reused. The parse is breezing fast, whereas computing a value for the parse tree takes very long – longer than my hand-written parser built from regexes.
20:37 Cheery ok.. it seems like the registration_init is exactly doing the grammar rewriting and maybe other preparations it has to do.
20:42 Cheery I'm not sure about this now though.. When I implemented marpa, I did separate these steps
20:43 Cheery (I re-implemented marpa algorithm in my own language, rather than using this code)
20:44 Cheery and it makes sense the init + start parsing is separated here as well.
20:44 Cheery amon_: hang around, the guy probably reads this backlog and helps you himself.
20:46 amon_ Probably unlike your parser, Marpa has the difficulty that the semantics may depend on the per-parse argument that's passed to $recce->value(). So resolved semantics cannot be reused in the general case. But in my specific case I use a `semantics_package`, so this lack of reuse is quite unfortunate.
21:28 amon_ left #marpa

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