Perl 6 - the future is here, just unevenly distributed

IRC log for #marpa, 2017-07-14

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

All times shown according to UTC.

Time Nick Message
00:14 idiosyncrat joined #marpa
00:18 idiosyncrat cheako: re https://irclog.perlgeek.de/marpa/2017-07-13#i_14868272 -- I've only skimmed, but the problem may be that you intend <Comment> as a discard symbol, but are treating (or are trying to treat it) as a normal lexeme.
00:19 idiosyncrat The usual way to deal with comments is to treat them as discard-able -- a sort of complex whitespace.
00:21 idiosyncrat ronsavage: Thanks!
00:32 cheako idiosyncrat: For this project(code beautifier) I'll need to keep comments and *whitespace to some extent.  * I think I'm able to query the column the object starts and that should satisfy the need to keep whitespace.
00:38 idiosyncrat cheako: of course -- I forgot that you're doing a beautifier.
00:38 idiosyncrat Btw, you might find https://michaeldadams.org/papers/layout_parsing/LayoutParsing.pdf and
00:38 idiosyncrat https://michaeldadams.org/papers/layout_parsing/
00:38 idiosyncrat interesting.  I never read them carefully, but they looked interesting.
00:50 cheako Thank you, I can't seem to find enough about BNF to read.
01:07 cheako ~ is the operator for L0 and is interpreted from the bottom up with no chance of collision/override/alternate meaning/choice?
01:08 idiosyncrat You mean in the SLIF DSL?
01:08 cheako Right
01:09 idiosyncrat 1.) Yes, '~' indicates an L0 production.  IIRC that's it's only function as an operator.
01:10 idiosyncrat 2.) The SLIF DSL is actually lightly ambiguous.  If your DSL parses ambiguously, it's a fatal error, and the error message points to the ambiguity.  Which means that a silent override, collision, etc. is impossible.
01:11 idiosyncrat I don't think any ambiguities involve "~", but the nice thing about using Marpa is that if you arrange to catch ambiguities, you don't have to worry about whether your grammar is ambiguous or not.
01:12 idiosyncrat In case this sounds like a wierd way to design a language, recall that English and other "natural" languages work this way.
01:15 cheako That's a relief.  It means I can have G1 sort out witch L0 RHS should match.
01:17 idiosyncrat Absolutely.  The only possible downside is that, if a grammar is *too* ambiguous, it can be inefficient to parse.  But you're safe as long as
01:17 idiosyncrat 1.) The number of possibilities is always less than a manageable constant -- in other words, at most you have N choices, where N is something like 7.
01:18 idiosyncrat 2.) The ambiguitites don't involve right recursion.  Marpa handles both left- and right-recursion in linear time, but ambiguous right recursions break the wizardry Marpa uses to keep them linear.
01:30 cheako Looks like using - is not a good idea, thanks ronsavage. https://travis-ci.org/cheako/MarpaX-Languages-Bash-AST/builds/253444803#L131
01:37 cheako Well, that broke base functionality.  https://travis-ci.org/cheako/MarpaX-Languages-Bash-AST/builds/253445463#L198   https://github.com/cheako/MarpaX-Languages-Bash-AST/blob/d78b474a3bfc507f9b0a13b8752fb7b514977e94/lib/MarpaX/Languages/Bash/AST.pm#L67
02:30 cheako joined #marpa
02:49 cheako One resource that's missing is a Glossary, there are a few dozen new terms I've encountered and had to google often not finding an explanation that explained the relation to Marpa.  For example lexeme is not understood until after one also reads up on Lexical and Headword, the latter of witch may have nothing at all to do with Marpa.  I still don't get what this error is driving at, but I think it's indicating that it can't find Term '*'
02:49 cheako Factor or perhaps it's not even considering 42 to be a Term...  Should have discovered this from Factor and number.
02:51 cheako Well, it's late here so time to sleep.  I'll read the weblogs so go ahead and reply to me in the mean time.
04:03 idiosyncrat ronsavage: I was going to refer cheako to FAQ's 2 and 3 re lexemes, but on reading them, I thought they weren't as clear as I'd like.
04:05 idiosyncrat I've submitted a pull request: https://github.com/ronsavage/marpa.faq/pull/6/commits/d0de810f8ca1378de1ec963cb78fe7ea9bd46561
04:10 cheako joined #marpa
05:36 cheako joined #marpa
05:50 perlbot cheako pasted a new file at https://perlbot.pl/p/ox9nmb - Test script for extending DSL example.
05:51 ronsavage joined #marpa
05:56 perlbot cheako pasted a new file at https://perlbot.pl/p/5wsc73 - That was easy, now do the shabang.
06:12 cheako idiosyncrat:  Thanks I'll keep faq 2 in mind, it didn't make any sense to me b4 the edit.
06:32 ronsavage cheako: I see you're using common::sense. I strongly suggest you switch to use strict and warnings. I used common::sense for a while, but there turned out to be various msgs it suppresses which I needed to see, so I wiped it out everywhere. A pain but knowing I was seeing vital msgs eased my mind considerably.
06:32 ronsavage Jeffrey's pull request to fix the FAQ's Q2 has been applied and uploaded.
07:04 ronsavage joined #marpa
07:13 ronsavage cheako: The problem is in:
07:13 ronsavage warn Dumper \($value_ref = $grammar->parse( \(<<'EOI'), 'Actions' ));
07:13 ronsavage 42 * 1 + 7
07:13 ronsavage 42 * 1 + 7
07:13 ronsavage EOI
07:14 ronsavage There is no operator between the 1st 7 and the 2nd 42. Image putting those 2 lines on 1 line, with 1 space between. How would you expect any parser to handle it?
10:53 ronsavage joined #marpa
11:53 cheako joined #marpa
11:56 cheako ronsavage: bc does it, so does bash.  For them using space instead of new-line indeed does not work as space separates words, but in this instance it should be do-able...
11:58 cheako "Number + Number" is addition, "Number * Number" is multiplication, while "Number Number" is two different "sentences".
12:12 cheako Indeed implementing this was more straightforward!  Changing "Calculator ::= Expression action => ::first" to "Calculator ::= Expression+ action => ::array" is a voodooish method that accomplishes this.
12:34 cheako That brings to me to an interesting point, I did it wrong.  For my project I need to break sentences on [\n;] AND the end of input.  To add even more fuel to the fire escaping either with '\' causes the sentence to continue.  i_diosyncrat did say this would be vary vary difficult, so for now I think it's ok to ignore these advanced semantics.  Though having them in mind going forward may help to avoid massive reworking later on.
12:43 cheako I'm so proud, I was able to implement sentences without help.  https://perlbot.pl/p/y93u82
12:54 perlbot cheako pasted a new file at https://perlbot.pl/p/wfqx3n - Rejected lexeme #0: rest_of_line; [16]
13:29 cheako What I think is hanging me up the most is that I've yet to see a good document teaching BNF, making my attempts at DSL brute-forceish.
13:32 cheako Like r_onsavage comments the other day https://irclog.perlgeek.de/marpa/2017-07-13#i_14869033 that I keep referring back too, "You need to use more rules." he said.  I remember at the time thinking, how am I to know when more rules need to be added?  What does that do?
15:16 cheako joined #marpa
15:23 cheako I found http://blogs.perl.org/users/jeffrey_kegler/2012/10/a-marpa-dsl-tutorial-error-reporting-made-easy.html  It helped me to identify that perhaps I'm dealing with an parser rejects a token.  This contradicts an earlier discussion i_diosyncrat and I had https://irclog.perlgeek.de/marpa/2017-07-14#i_14869255
16:35 cheako I think that tut from 2012 is too old to be accurate.
16:39 cheako I've went and wrote a handful of tests, some are vary ambitious.  https://github.com/cheako/MarpaX-Languages-Bash-AST/commit/1e0accae7a955eec4faff573194ef3288afa5ce7
16:39 cheako The 100% do not work/pass.
16:40 cheako s/The/They/
17:08 cheako I got the next part working.
17:16 cheako Here it is: https://perlbot.pl/p/siytc8
17:16 cheako The big problem was a missing pre-amble.
17:16 cheako "lexeme default = latm => 1"
17:19 sivoais joined #marpa
18:05 idiosyncrat cheako: There's an annoated index to my blog posts.  It lists the tutorials that I still consider worth looking at, and separates out the ones which are up to date from those which have good ideas, but use obsolete interfaces: http://jeffreykegler.github.io/Ocean-of-Awareness-blog/metapages/annotated.html
18:05 idiosyncrat left #marpa
18:44 cheako A good stab at processing comments.  https://perlbot.pl/p/s6kevq
19:54 cheako https://perlbot.pl/p/xzpjv4  Plain text asking a question about doubling up on a ::= or using alternatives?

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