Perl 6 - the future is here, just unevenly distributed

IRC log for #marpa, 2015-08-19

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

All times shown according to UTC.

Time Nick Message
00:28 idiosyncrat_ joined #marpa
01:18 koo7 joined #marpa
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
02:58 koo7 joined #marpa
03:12 ronsavage joined #marpa
03:29 mauke_ joined #marpa
06:29 ronsavage joined #marpa
08:12 koo7 joined #marpa
12:19 koo7 joined #marpa
12:30 koo7 joined #marpa
13:40 koo7 joined #marpa
14:07 koo7 joined #marpa
14:26 koo7 joined #marpa
14:59 idiosyncrat_ joined #marpa
15:00 mauke_ joined #marpa
15:00 idiosyncrat__ Saturday after next at the Swiss Perl Workshop, a talk on parsing Toki Pona with Marpa: http://act.perl-workshop.ch/spw2015/talk/6355
15:01 idiosyncrat__ Be there or be square!
15:38 CQ joined #marpa
16:19 djns joined #marpa
18:12 koo7 joined #marpa
18:41 idiosyncrat_ joined #marpa
18:58 idiosyncrat__ https://www.reddit.com/r/programming/comments​/3h8dsn/marpa_is_a_parsing_algorithm/cu7b96z
18:58 idiosyncrat__ Loup Vaillant makes an interesting comment about Marpa on reddit: that I "did too much too soon"
18:59 idiosyncrat__ When I first put Marpa out years ago, I waited for the reaction, and to fill the time, I tried to see what else I could do ...
18:59 idiosyncrat__ and ended up adding even more features and finding even more techniques and applications.
19:00 idiosyncrat__ All of which of course made the Marpa story as a whole, more complicated
19:00 idiosyncrat__ Loup thinks this actually may have delayed Marpa acceptance.
19:18 mauke can marpa parse here-documents?
19:28 idiosyncrat__ Using thye SLIF, you parse here-documents by pausing and resuming the parse at the desired locations.\
19:28 idiosyncrat__ s/thye/the/
19:30 idiosyncrat__ See http://peterstuifzand.nl/2013/04/1​9/parse-a-heredoc-with-marpa.html
19:32 idiosyncrat__ http://jeffreykegler.github.io/Ocean-of-Aware​ness-blog/individual/2013/04/procedural.html and
19:32 mauke ah, thanks
19:32 idiosyncrat__ https://gist.github.com/jeffreykegler/5431739
19:33 idiosyncrat__ There may be more recent and better tutorials on the technique, but that should get you started, I hope
19:44 purmou joined #marpa
19:48 mauke that code is broken in interesting ways
19:50 mauke my ($heredoc_body) = ( $input =~ m/\G(.*)^$terminator\n/gmsc );  raises a few red flags
19:51 mauke why use /gc? if you want the position of the end of the match, that's simply $+[0]
19:51 mauke on the other hand, why use \G? you don't want to anchor the match, given that you have .* there
19:52 mauke I believe this code will find the *last* instance of "\n$terminator\n" in the document, not the first
19:53 mauke oh, and $terminator should morally be \Q$terminator\E even if it's guaranteed to be \w+ in the current grammar
19:58 idiosyncrat__ joined #marpa
20:02 mauke untested patch: https://gist.github.com/mauke/f8749​ca2245d3bbbbc2f#file-heredoc-t-L160
20:04 idiosyncrat__ Thanks!
20:04 idiosyncrat__ How about testing it? :-)
20:04 mauke give me a sec :-)
20:05 mauke Can't locate GetOpt/Long.pm in @INC ...
20:05 mauke right back atcha
20:05 mauke oh, and now I need to install Marpa
20:08 idiosyncrat__ mauke: the bug was deliberate -- it was all a complex plot to get you to install Marpa. :-)
20:09 idiosyncrat__ Does $+ work under 5.10.  IIRC correctly some useful things I had to avoid in order to keep 5.10 compatibility.
20:11 koo7 joined #marpa
20:15 mauke tested version at https://gist.github.com/mauke/f8749ca2245d3bbbbc2f ... which seems to be the same url
20:16 mauke @+ was introduced in 1998
20:17 mauke 5.004 :-)
20:17 mauke except I'm using @- but same thing
20:18 mauke I changed GetOpt::Long to Getopt::Long, but then I removed it completely because it doesn't really do anything here
20:18 mauke except pull in English, which is an abomination
20:19 idiosyncrat__ Now that you mention it, I should rethink the use of the English module.
20:20 idiosyncrat__ My style was influenced by Damian's guide and IIRC at one time at least he was big on "English"
20:20 mauke I believe English makes code less readable
20:21 mauke hmm, this thing is less convenient than it seems
20:21 mauke now the grammar has explicit 'newline' tokens everywhere
20:22 mauke which completely defeats the point of discard
20:22 idiosyncrat__ and I'm told English is very inefficient unless you include " qw( -no_match_vars )"
20:22 mauke English itself is fine, but it would slow down every single regex match in your program
20:22 idiosyncrat__ Get one character wrong in that name and the result is that you get the inefficiency anyway, and there is no warning message
20:22 mauke at least in older perls; maybe COW fixes this
20:24 mauke can I pause at every discard?
20:27 idiosyncrat__ Yes, but pause'ing is relatively expensive.
20:27 idiosyncrat__ That means for every discard you go back and forth between the C code and Perl.
20:28 mauke sure, but how else are you going to handle a potential heredoc at every newline?
20:28 idiosyncrat__ The only newlines that can start heredoc's are at the end of a line with a '<<' operator?
20:28 idiosyncrat__ Or did I miss your polint?
20:30 mauke true, but how does that help me parse it?
20:31 mauke currently <<FOO peeks ahead in the input and returns a synthetic string token while setting up a teleport at the next newline
20:31 mauke and every newline checks whether it should teleport ahead in the input
20:32 mauke oh, can I do this? :discard ::= ws | newline
20:33 idiosyncrat__ If not you can certainly do
20:33 idiosyncrat__ :discard ::= ws
20:33 idiosyncrat__ :discard ::= newline
20:34 mauke wow, I didn't see any examples in the docs that either 1) provided two definitions of the same symbol or 2) used ::= with :discard
20:35 idiosyncrat__ Oops!
20:35 idiosyncrat__ :discard ~ ws
20:35 idiosyncrat__ :discard ~ newline
20:37 mauke Symbol <newline> is declared as a lexeme, but it is not used as one.
20:38 idiosyncrat__ Is that the error message?
20:40 mauke yes
20:41 idiosyncrat__ You have to use <newline> as a lexeme in both G1 and L0, and technically a discarded symbol is not a lexeme
20:44 idiosyncrat__ That is to say, if G1 is looking for a <newline> as a lexeme, but L0 discards them, then I believe that yes the SLIF will complain.
20:44 mauke then I don't see how to support here-docs without getting rid of :discard and sprinkling explicit ws rules everywhere
20:45 idiosyncrat__ I may look at this later if you're tired of working on it.
20:45 idiosyncrat__ Thanks for catching that bug.
20:45 mauke well, I'm tired in general. it's 22:45 here :-)
20:46 idiosyncrat__ If you work in the morning, you might well decide it's not worth it at this point. :-)
20:46 koo7 joined #marpa
20:46 mauke indeed
22:02 ronsavage joined #marpa
23:30 idiosyncrat_ joined #marpa

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