Perl 6 - the future is here, just unevenly distributed

IRC log for #marpa, 2015-08-28

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

All times shown according to UTC.

Time Nick Message
00:04 idiosyncrat_ joined #marpa
00:04 idiosyncrat_ rns: Thanks for doing that.
00:08 idiosyncrat_ It looks like the conclusion is that, yes, sequences are an optimization, but not any big deal.
00:11 idiosyncrat_ I'd be interested in seeing the results for shorter sequences -- I think your shortest is 5000 items.
00:11 idiosyncrat_ Interesting would be results for 3, 30, 300, 3000 and 30000 items
00:12 idiosyncrat_ The numbers are useful at the point, because I'm just heading into writing the Kollos evaluator.
00:18 ceridwen joined #marpa
00:26 idiosyncrat_ OK I tried it
00:27 idiosyncrat_ The result is that sequences are measurably faster at every scale, but only just barely.
00:28 idiosyncrat_ The result are so close that for some individual tests, sequences come in as very slightly counter-productive.
00:29 idiosyncrat_ The lesson for the SLIF seems to be:
00:29 idiosyncrat_ 1.)  use sequences for convenience and clarity, but not optimization -- your optimization time is better spent elsewhere.
00:30 idiosyncrat_ 2.) If you do recode a sequence as a recursion, use a left recursion (if it's naturally a right recursion, it should not have been coded as a sequence rule in the first place).
01:48 ilbot3 joined #marpa
01:48 Topic for #marpa is now Start here: http://savage.net.au/Marpa.html - Pastebin: http://scsys.co.uk:8002/marpa - Jeffrey's Marpa site: http://jeffreykegler.github.io/Marpa-web-site/ - IRC log: http://irclog.perlgeek.de/marpa/today
03:05 CQ_ joined #marpa
03:35 sadmac joined #marpa
03:47 koo7 joined #marpa
03:57 mauke_ joined #marpa
04:12 rns idiosyncrat: re sequences vs. left recursion -- perhaps the results can be different when there are many sequences.
04:12 rns I noticed that MarpaX::Languages::Lua::AST, which uses left recursion, is slower than MarpaX::Languages::Lua::Parser, which uses sequences.
04:14 rns MarpaX::Languages::Lua::AST also uses external lexing -- I'm profiling it any way so I'll try to find out if the number of sequence rules in the grammar affects the SEQ vs LR bencmark
04:45 rns Correction: actually, MarpaX::Languages::Lua::Parser does not use sequences, so the difference in speed is due to external lexing -- regcomp opcode is used many times in Lua::AST.
04:47 rns So, your conclusions above apply.
04:58 CQ rns want something to look at? I have a parser that with one item as a [\w]* works, and with a [\w\W]* just drops out in the middle of parsing without any error and I have no clue why
04:58 CQ good morning by teh way :)
04:59 rns CQ: :)) good morning. Yes, can take a look.
05:00 CQ whats the best way to get you two files, pastebin?
05:02 CQ wait, found something...
05:05 CQ ah, got it. I have \w and \W ... :)
05:05 CQ ...and you can guess the rest...
05:06 rns CQ: yes, pastebin and ... yes, I can. :-)
05:07 CQ this is coding before coffee ;)
05:07 rns :)))
05:14 idiosyncrat_ joined #marpa
05:15 idiosyncrat_ good night!
05:38 CQ groan. how can I catch all combonations of newlines as one newline? \r, \n, \n\r, ... ?
05:39 CQ is there an easy way, or just define the three separately and then combine?
05:41 CQ ok, better; I have gone from n*2 lines to n-1, now to find the missing line :)
05:51 CQ ah, line continuation \
05:51 ronsavage joined #marpa
06:02 CQ I think I have a working parser! :)
06:05 CQ That deserves breakfast...
06:59 pczarn joined #marpa
07:04 koo7 joined #marpa
07:38 pczarn joined #marpa
08:40 pczarn joined #marpa
09:18 koo7 joined #marpa
10:04 rns CQ: Indeed. :)
10:04 rns re newlines -- in general, its complicated, see "newline sequence as defined in the Unicode Specification 4.0.0, Section 5.8." -- https://metacpan.org/pod/distribution/M​arpa-R2/pod/Scanless/R.pod#line_column
10:16 rns On a brighter side, all those Unicode newline chars can be put in a SLIF character class as you'd do in Perl’s.
10:29 djns joined #marpa
10:29 sadmac joined #marpa
10:29 hobbs joined #marpa
10:32 sadmac joined #marpa
10:32 hobbs joined #marpa
10:52 pczarn joined #marpa
11:26 koo7 joined #marpa
13:39 CQ is there a way to get a EOF call or something similar? I need something that is called in case the last line doesn't end in \r\n or similar
13:40 CQ ...or at the end of input, or whatever
13:41 CQ I parse into something that collects info until the end of line (or continued lines) and that gets grabbed at a newline...
13:41 CQ so right now the last line without a \r\n is a problem
13:47 CQ ...and do I need to reinitialize the parser every time I want to read something? I do a $r->read(\$input); ... and when I try to do it again with a different input I get an error
13:48 CQ Multiple read()'s tried on a scannerless recognizer ...   Currently the string cannot be changed once set
13:48 rns IIRC, you need to create a new recognizer for each new input.
13:48 rns re "EOF call or something similar" -- it looks procedural and everything procedural is via events.
13:49 CQ I would like to do an end_of_input action=> d_o_finalize or something similar
13:49 rns However, off the top of my head, you can just append \r\n to the last line if it's not there?
13:49 CQ probably easiest... true...
15:47 idiosyncrat_ joined #marpa
16:41 purmou joined #marpa
16:55 koo7 joined #marpa
17:14 pczarn joined #marpa
18:02 idiosyncrat_ Maxim Vuets Marpa/Tokipona talk is tomorrow 9:30 at Swiss Perl Workshop 2015
18:02 idiosyncrat_ http://act.perl-workshop.ch/spw2015/talk/6355
18:02 idiosyncrat_ Be there or be square!
18:02 mauke but I'm already going to spain for yapc!
18:04 idiosyncrat_ Actually I'm in California, so I'll miss it myself
18:04 idiosyncrat_ But if I was in Olten, I'd certainly be there. :-)
18:06 idiosyncrat_ And I hope there will be video.
18:17 CQ https://en.wikipedia.org/wiki/Toki_Pona ... ah.
18:20 CQ rns solved it even simpler: a flush at the end when the parsing is done. Got me to clean up some code and write some initialization routines too...
18:46 idiosyncrat_ Thanks, rns!
18:54 roxfan left #marpa
19:08 CQ idiosyncrat_: no, I meant rns: I solved it ... : )
19:09 CQ ...but he helped me a lot with other stuff... I have about 20 quoted comment lines from him in the code :)
19:18 idiosyncrat_ Oh, OK.
19:20 idiosyncrat_ I wondered since I didn't see anything about end-of-input in the backlog of your exchange.
19:20 lwa joined #marpa
19:27 CQ idiosyncrat_: question for you though: why do I need to initialize a new barser before giving it more input? I figured I could just give it input and read it's tree with line after line...
19:27 CQ see my comment at 15:47 my time (gmt+2)
19:30 idiosyncrat_ Yes.
19:30 pczarn joined #marpa
19:30 idiosyncrat_ New input means new recognizer.
19:30 idiosyncrat_ You can reuse the grammar, however.
19:31 CQ yes, that's what I'm doing
19:31 idiosyncrat_ An advanced trick allows you to reset the parser, but *not* change the input.
19:32 CQ but logically I would assume the parser to be an object and the data to be the input, hence reusable...
19:32 CQ I was thinking obj data separatiob
19:32 CQ separation
19:34 idiosyncrat_ The recognizer stores the tables for the recognized data and does not allow it to be changed.
19:34 idiosyncrat_ Perhaps from an OO standpoint, you might ask yourself what the difference is between a reuseable recognizer and a grammar object ..
19:35 idiosyncrat_ which you already have and which is reuseable.
19:41 idiosyncrat_ AFK
20:34 koo7 joined #marpa
20:46 lwa rns: RE http://irclog.perlgeek.de/m​arpa/2015-08-27#i_11121563 adding \include "file" to my Preprocessor: what semantics would you propose? Textual inclusion does not seem overly attractive.
20:46 lwa I'd anticipate problems because SLIF grammars are not composable (unless they avoid :discard, use rules from the same Perl namespace, and use lexemes of a similar granularity), so an included file could only contain a subroutine-like grammar fragment, not a complete, reusable grammar of its own. Do your grammars get complex enough that they should be split into multiple files?
22:29 ronsavage joined #marpa
22:38 ronsavage CW: Re http://irclog.perlgeek.de/m​arpa/2015-08-28#i_11132433. Consider $recce->exhausted(). Start here: https://metacpan.org/pod/distribution/​Marpa-R2/pod/Scanless/R.pod#exhaustion
23:22 koo7 joined #marpa
23:59 idiosyncrat_ joined #marpa

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