Perl 6 - the future is here, just unevenly distributed

IRC log for #marpa, 2014-10-09

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

All times shown according to UTC.

Time Nick Message
00:45 jeffreykegler joined #marpa
01:12 jeffreykegler I've done an early draft revision of the Glade and ASF docs -- it's at the head of the 'master' branch in Github.
01:12 jeffreykegler (The glade and ASF docs have to do with Marpa's parse forests, a special interface for exploring ambiguous parses.)
01:13 jeffreykegler I redid them at this point because of issues filed against the parse forests -- I found I needed to refresh my knowledge of Marpa's ASF's and in doing so ...
01:14 jeffreykegler found the documents were not everything one could hope for.
01:16 qu1j0t3 flaviu1: hunter2!
01:18 flaviu1 compton isn't my password, it's my desktop compositor. It decided to turn my screen black, so naturally I started a terminal to kill it from, but I messed up focusing on that terminal.
01:34 qu1j0t3 :)
01:37 lucs qu1j0t3: What's "*******!"?
01:37 lucs ;)
01:38 qu1j0t3 good question!
01:39 qu1j0t3 how about quijote in 1337. man it's hard to type without the digits
02:00 ronsavage joined #marpa
03:37 CQ_ joined #marpa
04:17 rns joined #marpa
04:42 rns jeffreykegler: re http://irclog.perlgeek.de/marpa/2014-10-08#i_9477096
04:43 rns http://perl6.org/compilers/ says:
04:43 rns (1) STD is Larry Wall's reference implementation of the Perl 6 grammar.
04:44 rns (2) viv ("vi" to "v", 6 to 5) is a compiler that uses STD as its front-end.
04:45 rns Thera are other compilers too. If there is a Perl6 compiler (most probably viv, but possibly others) that can parse STD.pm,
04:46 rns perhaps i can be hacked into converting STD.pm as BNF, because rewriting it by hand looks like it's take a lot of time and is error-prone.
04:46 rns s/perhaps i can be/perhaps it can be/
04:48 rns s/it's/it'd, sorry not enough caffeine this morning. :)
04:49 rns Wild thought as it is, but perhaps #perl6 folks can be asked and tell if this is possible.
04:49 rns left #marpa
04:50 rns joined #marpa
05:05 ronsavage joined #marpa
05:22 jeffreykegler joined #marpa
05:24 jeffreykegler rns: re http://irclog.perlgeek.de/marpa/2014-10-09#i_9478961 -- I think we'd see more reward from efforts on the LUIF
05:25 jeffreykegler which I think will have the convenience of the SLIF (plus some) plus close to C language speed.
05:25 rns Sure, just needed to brain-dump it somewhere.
05:25 jeffreykegler From there we could turn to other things, including Perl 6, if so desired.
05:26 rns BTW, the more I know about Lua the more I like its extreme minimalism.
05:26 jeffreykegler I don't know why the Perl 6 folks won't produce a BNF-ish description themselves -- it's certainly the 1st thing I'd do ...
05:27 jeffreykegler speaking of which ...
05:27 jeffreykegler I'll be working up BNF for the LUIF, which I hope you'll incorporate in an extended Lua parser.
05:28 jeffreykegler We can get to the point where we are building a tree, and then put a Libmarpa wrapper under it.
05:28 jeffreykegler In the meantime, the BNF will allow people to check out the design, and comment on it.
05:29 rns Sounds good.
05:29 jeffreykegler re http://irclog.perlgeek.de/marpa/2014-10-09#i_9479056 -- yes, Lua's ruthless minimalism is (I think) literally unique.
05:30 jeffreykegler And it's perfect for our purposes.
05:31 jeffreykegler Just to jump ahead, the LUIF will be Lua with BNF statements added.
05:31 jeffreykegler The BNF statement will resemble those in the SLIF, but incorporate the lessons learned ...
05:32 jeffreykegler There'll be more features and some awkwardnesses will be eliminated.
05:33 jeffreykegler And yet another point, there is a Lua community,
05:33 jeffreykegler smaller and with less infrastructure than the Perl community,
05:34 jeffreykegler but once we have something to show, we should start announcing our efforts there, etc., etc.
05:34 rns Makes sense.
05:34 rns Thinking in LUIF terms, we'll extend lua with stats (lua for statements) like
05:35 rns lhs ::= sym1, sym2 ...
05:35 jeffreykegler Right, except (maybe) for the comma
05:36 rns Oh, yes.
05:36 jeffreykegler And right now the SLIF has a very non-orthogonal set of statements, which we can clean up.
05:37 rns Extending a language with grammar rules in BNF form looks (with the huge benefit of hindsight) like Perl6 done right.
05:38 jeffreykegler It's significant to polint out in that context that I did not complete the 1st version of Marpa until after Perl 6 was designed.
05:38 rns re http://irclog.perlgeek.de/marpa/2014-10-09#i_9479092 — sure, like move everything to
05:39 rns lhs ::= sym1 sym2 .., adverb1 => value1 adverb2 => value2
05:39 jeffreykegler So that Perl 6's grammar-driven vision was to be powered by the best parsing technology available -- which had boiled down to left parsing.
05:40 jeffreykegler In the LUIF adverbs in general will be set with Lua table initializers
05:42 jeffreykegler So that each rule alternative is optionally followed by a Lua table initializer, and then optionally a Lua function body.
05:42 jeffreykegler Where the function body will beome the action.
05:43 jeffreykegler All this to be translated by a filter into Pure Lua which will then use Libmarpa wrapper.
05:45 jeffreykegler As for settings of globals, defaults, etc., those will just be pure Lua statements, and will be just passed through by the filter.
05:46 jeffreykegler So that the only thing that the LUIF has that pure Lua does not, will be those BNF statements.
05:46 jeffreykegler Another improvement over the SLIF will be procedural vs. declarative.
05:47 jeffreykegler The BNF tempted me into being declarative (BNF certainly *looks* declarative) so I wound up with a mix of declarative and procedural (order dependent) statements.
05:48 jeffreykegler The LUIF will be 100% procedural -- the BNF statements will simply be translated into procedural Lua code at the point where they appear.
05:48 hobbs the intent is still that all features will be usable from Perl?
05:49 jeffreykegler As much as with the SLIF, yes.
05:49 rns Makes sense. Hacking with a vision of what's ahead is plain great.
05:49 hobbs cool
05:49 jeffreykegler Note that from the point of view of Perl, the LUIF is just an interface like the SLIF.
05:49 rns Ok, now I'd better go back to debug that tricky semicolon case from api.lua. AFK
05:50 hobbs sure
05:50 jeffreykegler It's just we're replacing my ad-hoc virtual machine with Lua.
05:51 jeffreykegler So with the SLIF there already is a mini-language between Perl and Libmarpa ...
05:51 jeffreykegler but one that's under-powered and which suffers from having grown a bit at a time without a clear design visioin.
05:52 hobbs yeah, that makes total sense, just wanted to check whether you had any plans on deleting things like calling out to perl actions or other things that I can't think of because it's nearly 2am
05:52 hobbs because it's easy to say "how many Turing-complete languages do you need under one hood?"
05:53 jeffreykegler We'll have to set up a way to call Perl actions -- they'll be far more expensive than Lua actions, though.
05:53 hobbs understandable
05:54 jeffreykegler Lua is Turing-complete, but it's cheap -- it's minimalism was what made me choose it after a long deliberation.
05:54 hobbs I'm only slightly familiar with Lua, but I used it to some good effect in a project with Redis
05:55 jeffreykegler In fact, Roberto is currently debating *dropping* some features, just for minimalism's sake.
05:56 jeffreykegler In terms of real overhead, Lua has no additional cost over the SLIF -- just more features, and a cleaner design and a better support infrastructure.
05:57 hobbs LuaJIT is a poster child for a brilliantly optimized implementation of a dynamic language
05:57 hobbs that was a badly constructed sentence. I'm off to bed. :)
05:58 jeffreykegler Exactly.
05:58 jeffreykegler So should I be. AFK!
07:24 CQ rns are you awake?
07:25 rns CQ: Yep, but busy a bit.
07:25 CQ two points. one, I found something that probably isn't a bug, but would be worth a note in the documentation
07:25 CQ two: with the lua discussion: what exactly is that for? is it replacing parts of the marpa internals? I only half understand whats going onthere
07:26 rns Great, put it here, jeffrey will see it in the backlogs.
07:26 rns re lua discussion:
07:27 CQ the doc topic: if I get one token I get a variable, if I get two or more tokens I get an array
07:27 CQ foreach ( @{ $chash[0] } ) { print $_." "; } # parses multiple tokens being passed from the parser, but if it gets a single token it chokes nicely
07:28 rns We will write a lua parser which will accept lua extended with BNF statements (with attributes and semantic actions) which will be then translated to pure lua, compiled and executed by lua.
07:28 CQ this is to extend marpa to lua?
07:28 CQ (essentially)
07:29 CQ sorry, if youre busy we can have this discussion later... its not urgent ;)
07:30 rns re http://irclog.perlgeek.de/marpa/2014-10-09#i_9479433 — both — lua syntax is extended with BNF, libmarpa gets a nice extension language to write BNF and semantic actions in.
07:31 rns re http://irclog.perlgeek.de/marpa/2014-10-09#i_9479436 — no prob
07:33 CQ let me know when you want a look at the crash and I'll post code. I'll be on- and offline most of teh day today
07:34 rns please post the minimal code and I'll look into it when time permits.
07:36 CQ http://paste.debian.net/125307/ ...its the full code, just look for the line with BUGME and change the statement below to trigger the crash
07:55 rns CQ: try to change
07:55 rns if ( ref $chash[0] ||1 )
07:55 rns to
07:56 rns if ( ref $chash[0] eq "ARRAY" )
07:56 rns Does that work for you?
07:56 CQ thats just to show the crash... I would have assumed marpa to handle the crash more gracefully.
07:56 CQ what I have there without the ||1 works fine
07:57 CQ but yes, explicitly checking for an array would be better
08:00 rns When it comes to semantic actions (user-supplied code), Marpa has to be strict. IIRC, even warnings are treated as fatals.
08:01 rns Still, "Can't use string ..." is a fatal anyway, IICR.
08:01 rns Glad it worked.
08:01 CQ well, its inconsistent that single tokens and multiple tokens arrive in different structures, that should at least be documented somewhere (it probably is, but I didn't find it ;)
08:04 rns [ value ] is an array descriptor.
08:05 rns "For a rule alternative, the value array item descriptor puts a list of zero or more elements into the array. The list will contain the values of the rule instance's children, in left-to-right order."
08:05 rns https://metacpan.org/pod/Marpa::R2::Semantics#Array-descriptor-actions
08:06 rns So, its always an array, two-element when you right [ name, value ] or more items for [ name, start, length, value ].
08:06 CQ but it seems to me that it doesn't: the values can be an array (if they contain more than one element), or a value (if only one element). That's why comments, continuations, single tags on a line or single words on a line cause the crash
08:07 CQ yes but with $chash[0] I'm dealing with the value part and thats a single variable or an array
08:11 rns if you need scalars, you can write an L0 rule, e.g. slurp_non_new_lines ~ [^\n]+ and gather all non-newline chars in a scalar, which will be put where you write [ ... value ] as action.
08:12 rns But I fiorgot that you use semantic actions.
08:13 rns https://metacpan.org/pod/Marpa::R2::Semantics#Synopsis shows an example:
08:14 rns flattening — @{$self} in My_Nodes::Script::doit
08:14 rns using $_[0]  and $self->[0] in other methods.
08:16 rns :default ::= action => [values] says that semantic actions are passed an array ref, an element of which cana be a scalar (literal) or an arrayref (rule).
08:17 rns So looks like you need to check for both if you don't know dor sure.
08:17 CQ yeah, thats exactly what I ended up doing.
08:17 lwa joined #marpa
08:18 rns Great, synopsis code proved to be very useful to me in the beginning.
09:36 CQ joined #marpa
11:37 rns left #marpa
16:54 jeffreykegler joined #marpa
17:22 jeffreykegler I just wandered over to #perl6 to "borrow" some ideas for the LUIF and came away with some very cool ones.
17:23 jeffreykegler jdurand: While there I let their IRC log know that the Perl 6 BNF grammar effort is postponed indefinitely.
19:06 sivoais joined #marpa
19:18 rns joined #marpa
19:18 rns left #marpa
19:38 flaviu1 joined #marpa
19:51 jdurand_ joined #marpa
19:51 jdurand_ Re http://irclog.perlgeek.de/marpa/2014-10-09#i_9482048 - thanks
22:42 ronsavage joined #marpa

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