Perl 6 - the future is here, just unevenly distributed

IRC log for #marpa, 2015-09-11

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

All times shown according to UTC.

Time Nick Message
00:26 idiosyncrat joined #marpa
00:30 idiosyncrat spacebat: parentheses make things disappear from the point of view of the semantics:
00:31 idiosyncrat for example:
00:31 idiosyncrat rule ::= cmd_type user_list (eol)
00:31 idiosyncrat My usual warning: this is off the top of my head and untested.
00:32 idiosyncrat Re the bushiness of the initial parse tree -- yes, they always start out annoyingly bushy, because that's how to be most general.
00:32 idiosyncrat You get it to the point that looks like it might be correct, and then prune.
01:01 ronsavage spacebat: Many of my modules contain a function/method to unravel deeply nested data structures as returned by Marpa. It's always called decode_result(). Warning: Not all copies are the same. See https://metacpan.org/release/MarpaX-Demo-SampleScripts (in scripts/*.pl), https://metacpan.org/release/MarpaX-Languages-SVG-Parser,
01:02 ronsavage https://metacpan.org/release/GraphViz2-Marpa, https://metacpan.org/release/X500-DN-Marpa. That should get you started.
04:04 rns spacebat: re eol -- you can also use as rule sequence separator as in https://gist.github.com/rns/b6ef47b37c5d65e23a25/revisions
05:08 rns spacebat: you'd also add :lexeme ~ all priority => 1 to avoid ambiguous lexing, because
05:08 rns username   ~ [\w]+ and
05:08 rns all        ~ 'all' | 'everybody'
05:09 rns would lex 'all' in the input as either username or all.
05:10 rns setting higher lexeme priority for all will disambiguate it for you.
05:35 pczarn joined #marpa
05:46 idiosyncrat Good night!
05:52 ronsavage joined #marpa
06:45 CQ joined #marpa
08:54 spacebat idiosyncrat: you're right about parens, its strange, when i tried them before the grammar no longer matched the input - must have been associated thrashing on my part that caused that
08:55 spacebat rns: you mentioned parens the other day, that's when it didn't work for me - thanks again for advice that if followed sanely would have solved this problem
09:11 pczarn joined #marpa
09:15 spacebat idiosyncrat: you're right about parens, its strange, when i tried them before the grammar no longer matched the input - must have been associated thrashing on my part that caused that
09:16 spacebat d'oh retypo
09:17 spacebat figuring that I could flatten the tree in part by constructing objects in the actions; having the constructor decode just the part of the result it needs
09:18 spacebat I got my ast nodes blessed into packages, but it is literally blessing - I have some Moo objects that are suprised to find that their guts are nested arrays :)
09:19 spacebat is there something like a build action that will pass the value to a constructor instead?
09:39 rns spacebat: there is per-parse_constructor -- http://search.cpan.org/dist/Marpa-R2/pod/Semantics.pod#The_per-parse_constructor -- where you can do the setup for processing the parse values, which will be passed to semantic package's methods.
09:41 rns values are not passed to that constructor -- they are passed to methods after the call to the constructor.
09:42 rns that's because when the per-parse constructor is called (Parse Tree Setup) parse values are not available yet.
09:44 rns https://metacpan.org/source/RSAVAGE/X500-DN-Marpa-0.81/lib/X500/DN/Marpa.pm shows a nice example of using Moo to write semantic actions.
10:09 spacebat thanks again rns :)
12:38 pczarn joined #marpa
14:50 rns spacebat: :)) absolutely welcome.
14:50 rns BTW, re http://irclog.perlgeek.de/marpa/2015-09-11#i_11201673 -- I edited your script to use parens to hide eol's from semantics -- https://gist.github.com/rns/5da061c82ed8c9cd8b05 -- you can check if it does the right thing.
14:51 rns However, version with eol as separator look cleaner to me still.
17:07 idiosyncrat A bit of history
17:09 idiosyncrat Leo in his 1991 paper mentions that his result seems to have been conjectured by Earley in his 1968 PhD thesis (page 60)
17:10 idiosyncrat I looked back and, lo!, there is Leo's result -- linear time for all LR(k) grammars -- more or less exactly stated -- though with not the slightest hint as to how it might be done.
17:13 idiosyncrat I asked Leo, and he says he lighted on the possibility before noticing Earley's conjecture -- that is, in the course of working up his idea, Leo noticed that Earley seems to have found it back in 1968.
17:14 idiosyncrat The reason, I suspect, that Earley did not follow up on this conjecture is that he switched fields (to Psych) almost immediately and left CS.
17:19 idiosyncrat Btw, in my rewrite of the Marpa paper, I am deriving almost all the result from basic principles of parsing theory --
17:19 idiosyncrat in its current revision, the Marpa paper relies a lot on results in other papers.
17:20 idiosyncrat As part of the new paper, I'll create a new presentation of Leo's algorithm, which I hope will do a lot to make it less mysterious.
18:09 pczarn joined #marpa
23:48 idiosyncrat joined #marpa

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