Perl 6 - the future is here, just unevenly distributed

IRC log for #marpa, 2014-02-11

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

All times shown according to UTC.

Time Nick Message
03:06 ilbot3 joined #marpa
03:06 Topic for #marpa is now Logs: http://irclog.perlgeek.de/marpa/today Nopaste: http://scsys.co.uk:8002/marpa Stable release: https://metacpan.org/pod/Marpa::R2 Developer release: https://metacpan.org/releas​e/JKEGL/Marpa-R2-2.079_014 Source: https://github.com/jeffreykegler/Marpa--R2
07:33 ronsavage joined #marpa
16:52 jeffreykegler joined #marpa
17:07 lucs Suppose we have two alternatives in a prioritized rule, separated by the loosen operator (||).
17:07 lucs If both alternatives happen to match some source, it appears that that will give us two parse trees, in the same way as if t
17:07 lucs he alternatives had been separated by the alternation operator (|).
17:07 lucs I thought that since the loosen operator favored the first alternative, the second one could not match.
17:07 lucs So, my thought was wrong, right?
17:08 jeffreykegler lucs: non-deterministic -- Marpa is non-deterministic, unlike traditional parsers
17:08 jeffreykegler Marpa tries everything, all at once.
17:08 jeffreykegler That's why it can parse such a wide class of grammars.
17:08 lucs Okay, it makes sense, I just wanted to confirm (I thought that the higher priority alternative would eliminate the other one).
17:10 jeffreykegler lucs: My feeling is that the non-determinism takes some getting used to by modern programmers.
17:11 jeffreykegler It's almost as if, with determinism, they feel that having restricted choices gives them a feeling that the parse is under control.
17:12 lucs I realize that allowing non-deterministic parses is a powerful feature of Marpa, but yeah, it needs some getting used to I suppose.
17:13 jeffreykegler lucs: my belief it that is it actually easier, but it's different from just about every other parser in use ...
17:14 jeffreykegler and in the short term what you've grown accustomed to feels easier.
17:14 lucs Another question: I built a grammar that has a whitespace discarding rule, and accidentally had a lexeme containing spaces. Is that a recipe for disaster?
17:15 jeffreykegler lucs: not necessarily.
17:15 lucs Hmm...
17:15 jeffreykegler You  just have to look at the LTM discipline and make sure that you'll get want you want in every case.
17:16 lucs LTM?
17:16 jeffreykegler Longest-token-match.
17:16 lucs Oh, right.
17:17 * jeffreykegler assumes the lucs is not using the forgiving adverb and LATM
17:17 jeffreykegler * the -> that
17:17 lucs I'm not :)
17:18 lucs Is the 'forgiving' adverb (is that what you mean?) part of the SLIF?
17:18 jeffreykegler Yes, but I'm not sure if it's in an official release yet.
17:18 jeffreykegler * official -> indexed
17:19 lucs I'm using the developer release, but I may not have reread the relevant doc yet.
17:19 lucs Oh, look at that! There it is, in the DSL POD :)
17:19 jeffreykegler I don't expect people will reread the docs with every release -- I certainly do not.
17:51 shadowpaste "lucs" at 70.81.138.180 pasted "Please confirm my understanding." (53 lines) at http://scsys.co.uk:8002/303743
17:53 jeffreykegler lucs: That's right.  The SLIF's parsing should be thought of as two stages.  The lexer looks at everything first, and G1 only sees what the lexer tells it about.
17:54 lucs Okay, thanks.
17:54 jeffreykegler This is, in fact, the traditional way of doing parsing -- lex first, then do structural parsing.  Yacc, as one of many examples, works this way, as does bison.
17:57 lucs For some reason, I imagined Marpa was combining the phases somehow, eh.
17:57 jeffreykegler lucs: Marpa could, and it has been suggested.  But initially I decided to follow tradition ...
17:58 lucs I guess that with named events, something like that could happen (note that I haven't tried anything with those yet).
17:58 jeffreykegler in part because it was slightly more convenient to implement, and in part hoping a more traditional approach would be easier to understand.
18:06 lucs jeffreykegler: Could my example nopaste example be fixed with a 'forgiving'? (I can't figure out how)
18:06 lucs s/example//
18:09 jeffreykegler lucs: Possibly.  Note that forgiving can create efficiency issues -- in a long parse you might repeatedly look for very long tokens, only to reject them in favor of shorter ones.  This could result in a long scan of the input for every token.  So you have to watch out for that.
18:09 lucs Yep, I just read about that :)
18:11 lucs But what can I have like ":lexeme ... forgiving => 1" to make it work (just curious).
18:11 lucs ?
18:12 jeffreykegler lucs: Looks OK, but I haven't worked out the full combined LTM/LATM discipline.
18:53 jeffreykegler lucs: I looked at it a little.  It's tricky, but I think it'd work with the forgiving adverb.  The key is that you cannot have a space in a <word>, while 'MEEP MOOP' requires one, so my guess is things would work.
18:57 jeffreykegler lucs: Perhaps this is an exercise, but if it were a real-life DSL I were writing ...
18:58 jeffreykegler I'd be tempted to make 'MEEP' and 'MOOP' separate lexemes, and use lexeme priorities (http://search.cpan.org/dist/Marpa​-R2/pod/Scanless/DSL.pod#priority) to make sure they are not treated as <word>'s
19:30 jdurand joined #marpa
20:02 jeffreykegler left #marpa
21:03 ronsavage LATM?
21:04 ronsavage I'm copy-and-pasting parts of this discussion into the Marpa Papers. News at 11.
21:05 jdurand ronsavage: LATM = Longest Acceptable Tokens Matching
21:06 jdurand C.f. this post on marpa-parser where Jeffrey explained his roadmap: https://groups.google.com/forum/#!msg/​marpa-parser/nmXMqSpaGaA/ktaRlmeVwbcJ
21:07 ronsavage jdurand: Ahh, thanx.
21:30 ronsavage http://savage.net.au/Perl-modules​/html/marpa.papers/chapter3.html
21:31 ronsavage Also, a little bit has been added to both Chapters 1 and 2 regarding non-determinism (chapter 2) and G1 and L0 (chapter 3)
21:33 jeffreykegler joined #marpa
21:34 jeffreykegler ronsavage: re http://irclog.perlgeek.de/​marpa/2014-02-11#i_8269276 -- Thanks for doing this.
21:34 jeffreykegler A few things.  First the segway from non-determinism into forgiving was relevant for lucs example.  However they are not in general really connected.
21:35 jeffreykegler Second, I hope shortly (and at last!) to get zero-width assertions far enough along to support "cheap forgiveness", and that changes the whole lexing picture ...
21:36 jeffreykegler in a way I find hard to predict because I am not sure whether Marpa's users will find LATM so attractive they abandon LTM, or whether LTM remains popular, and if so how popular.
21:38 jeffreykegler I would suggest eliminating everything in the new entry, at and after the paragraph which begins: "You'll probably need to adopt the 'forgiving' adverb ..."
21:38 jeffreykegler All that material on forgiveness is not strongly connected to the topic question, and subject to change in the very short run.
21:41 jeffreykegler ronsavage: Again, many, many thanks!
21:52 ronsavage Edited as suggested.

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