# IRC log for #marpa, 2014-12-15

All times shown according to UTC.

Time Nick Message
00:09 jeffreykegler joined #marpa
00:10 jeffreykegler Aria: predictions are done last and are special ...
00:11 jeffreykegler An Earley item is a triple: rule, dot position and origin (= Earley set where rule starts)
00:11 Aria Right.
00:12 jeffreykegler In a prediction, dot location is always zero and origin is always the current Earley set, so the only real variable is the rule.
00:12 jeffreykegler Of course, for evaluation, I also keep links for the Earley items, but ...
00:12 jeffreykegler I don't need them for predictions.
00:12 flaviu joined #marpa
00:13 jeffreykegler So the set of predictions for an Earley set, therefore, is simply a list of rules,
00:13 jeffreykegler and can be kept in a bit vector, which in fact is the case in Libmarpa.
00:14 * jeffreykegler is speaking off the top of his head without looking back at the code
00:14 Aria That makes sense.
00:14 Aria I'm just getting tripped up in terms -- scan, predict, complete. I get the idea of prediction and completion. But scanning looks like it's used interchangeably with prediction.
00:15 jeffreykegler Tokens are scanned.
00:15 jeffreykegler Predictions are always the result of other Earley items, except in Earley set 0.
00:17 jeffreykegler Those concepts are present in the traditional Earley algorithm, so just run through tutorials and examples of the construction of traditional Earley sets ...
00:17 jeffreykegler until you're comfortable with the ideas.
00:18 Aria Oh, right! Working with a tokenizer. Derp.
00:18 jeffreykegler An advantage of ripping out the special Aycock&Horspool LR(0) based items is that Marpa went back to traditional Earley items --
00:19 jeffreykegler Marpa's Earley items are basically those of Earley's 1968 paper, except ...
00:19 jeffreykegler for Leo memoizations, which are special cases for right recursion only, ...
00:19 jeffreykegler and that bit vector trick for predictions, which I just described.
00:20 jeffreykegler Aria: you mentioned cweave yesterday --
00:20 jeffreykegler are you reading the Libmarpa code in that format?
00:22 Aria Yeah. Both the output and .w.
00:23 Aria So it's that there's a tokenizer that I was missing. I've worked with scannerless parsers for so long!
00:24 jeffreykegler Aria: FWIW I hacked Knuth's TeX macros -- I use different fonts.
00:24 jeffreykegler Knuth bold-faced language keywords, which to my mind is exactly 180 degrees wrong.
00:25 jeffreykegler I changed it so that variable names are bold-faced.
00:25 Aria Yeah. Yours makes sense.
00:25 jeffreykegler I did some other minor stuff as well.
00:26 Aria I've been thinking about non-monospace presentations for source code for a long time.
00:57 jeffreykegler jdurand: FYI on your priorities -- I am currently doing a "sort of" Marpa wrapper inside Kollos, but I'm proceeding slowly, and the result will probably need additional "factoring" to be un-entangled from Kollos.
00:58 jeffreykegler But I am tackling various issues like error handling, and what I'm doing may be of interest.
01:45 flaviu joined #marpa
04:52 ronsavage joined #marpa
04:54 jeffreykegler joined #marpa
05:18 ronsavage Is Kollos ready to go in the Marpa FAQ (http://savage.net.au/Perl-modules/html/marpa.papers/chapter3.html). I think so.
05:52 jdurand joined #marpa
05:54 jdurand jeffreykegler: Re http://irclog.perlgeek.de/marpa/2014-12-15#i_9806282 - definitely of interest, I am thinking to functions and/or macros doing bindings functionalities, regardless of the w/w behind - you'll give a pointer OOTD then -; ! Thx.
05:55 jdurand "s/w" - morning here in France - coffee effect hot yet showing up
05:55 jdurand "not yet" grrrr
05:57 jeffreykegler ronsavage: re Kollos, no I don't think Kollos is ready for the FAQ.
05:58 jeffreykegler ronsavage: while you're looking at it, though, the FAQ really could use an index at this point -- it is getting long!
06:00 jeffreykegler Good night, all!
06:17 ronsavage Yes, I've long realized the FAQ needs an index. I don't think Markdown supports a within-page index, does it? I'll re-investigate.
06:18 ronsavage On a related matter, in the FAQ http://savage.net.au/Perl-modules/html/marpa.papers/chapter3.html I've added a section titled "Can I switch grammars during a parse?". Please proof-read it. TIA!
06:50 ronsavage I've added an index, but there are no links to the questions :-(.
06:52 jdurand joined #marpa
06:53 jdurand ronsavage: Re http://irclog.perlgeek.de/marpa/2014-12-15#i_9806824 - well-writen - short but very self-explanatory - perfect for an FAQ: thx
06:54 ronsavage jdurand: Thanx for the feedback.
06:55 jdurand AFK - business day in the horizon -;
06:56 ronsavage jdurand: Hint: '/On/ the horizon'.
07:19 jluis joined #marpa
08:19 slothmachine joined #marpa
11:39 flaviu joined #marpa
12:15 lwa joined #marpa
12:54 slothmachine joined #marpa
12:56 s joined #marpa
14:47 jluis joined #marpa
14:51 Aria Made some pleasant progress on a mini-marpa in JS last night. Didn't build on nearley, since I was playing with using bit vectors for the implementation and it was going to be invasive.
14:51 Aria Might use nearley to build leo on though, see how hard it is to implement there.
18:09 jeffreykegler joined #marpa
18:26 slothmachine joined #marpa
18:50 jeffreykegler ronsavage: re "Can I switch grammars during a parse?" -- no typos as such
18:52 jeffreykegler but I think a reader might wonder about how the semantics are handled.  That is, if you use two recognizers, you semantics are in two different places.  How do you deal with this?
18:53 jeffreykegler In Jean-Damien's subgrammar technique, as I understand it, he takes the result of the subgrammar and uses it as a token value.
18:54 jeffreykegler Also, I'm thinking up a preamble -- in cases where a beginner is thinking of two grammars, it's often not necessary -- if there are not lexer-boundary issues involved, you can just combine the two.
18:55 jeffreykegler If there are, it can be deal with as a matter of switching lexers, instead of switching grammars.
19:02 jdurand joined #marpa
19:03 jdurand Re http://irclog.perlgeek.de/marpa/2014-12-15#i_9809866 - true, and this is because I imposed myself to use the parse() method - then no procedural statement is possible until the method evaluates the parse tree AFAIK
19:04 jdurand Though, using a second lexer during the pause is a priori recommended - i.e. staying in the lexing phase
19:32 jeffreykegler http://loup-vaillant.fr/tutorials/earley-parsing/empty-rules
19:33 jeffreykegler Loup has added a discussion of the handling of nullable symbols, which is the link just above
19:33 Aria Oh excellent.
19:33 jeffreykegler It close with an Lua algorithm, including one for finding the nullables.
19:34 jeffreykegler I believe the one in Libmarpa is faster ...
19:34 jeffreykegler it's called a "RHS closure" ...
19:35 jeffreykegler because the same idea works for finding nullables and productive symbols.
19:37 jeffreykegler In this copy of the cweave output https://drive.google.com/open?id=0B9_mR_M2zOc4NHVuLWxtSm84V0U&amp;authuser=0  ...
19:45 jeffreykegler it is pages 294-296
19:45 jeffreykegler sections 1121-1125
19:46 jeffreykegler I'm going to need to translate this logic to Lua for Kollos -- if someone wants to anticipate me, that'd be great ...
19:46 jeffreykegler and we can compare with Loup's implementation.