Perl 6 - the future is here, just unevenly distributed

IRC log for #marpa, 2014-01-15

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

All times shown according to UTC.

Time Nick Message
23:04 lucs Is it correct to call L0 rules "lexical rules"? (like G1 rules are "structural rules")
23:13 lucs (Oh good, found the term "lexical rules" in the docs."
23:48 jeffreykegler joined #marpa
23:50 jeffreykegler lucs: implementation is cleaner without pseudo-characters, though the user can concoct them at a higher level.
23:51 jeffreykegler Currently there is work on a couple of SLIF alternatives/replacements and their authors will get to redecide all this.
23:58 lucs jeffreykegler: Okay, thanks.
00:08 ronsavage joined #marpa
01:01 lucs Um, THIF designates the thin interface, right?
01:01 jeffreykegler lucs: yes
01:01 lucs Okie doke
01:08 lucs Am I correct in saying that in the SLIF, long lines can be split on any whitespace, as long as the continuation lines are (arbitrarily?) indented relative to the first one?
01:08 jeffreykegler lucs: That's something I've been thinking of blogging
01:09 jeffreykegler In the SLIF newlines do not matter -- they are just like other whitespace
01:09 lucs Indentation doesn't count?
01:09 jeffreykegler Marpa is smart enough to tell where statements begin and end without assistance from newlines
01:09 jeffreykegler Indentation is not noticed
01:09 lucs Hmm...
01:10 jeffreykegler The indentation you see is for human convenience
01:10 lucs Cool.
01:10 jeffreykegler And newlines are the same as other whitespace
01:11 jeffreykegler A lot of people I think are looking at the SLIF and saying, hey, this parser has only got the same power as the Python parser, or whatever ...
01:11 jeffreykegler But rearrange the lines and the difference comes out
01:12 jeffreykegler You can turn convert your SLIF DSL so that it has random newlines and it will still parse
01:12 lucs Now that I look closely at the examples, I can see that no ambiguities appear if the newlines are removed (comments notwithstanding) -- very nice design :)
01:13 jeffreykegler Actually, not even design, it just falls out from the power of general BNF parsing
01:13 jeffreykegler Look at this way ...
01:13 lucs Really? Wow.
01:14 jeffreykegler If I took a bunch of Python and rearranged the newlines, you could fix them back, right?
01:14 lucs I don't know Python, sorry :/
01:14 jeffreykegler OK, some newline-sensitive language, then, the one of your choice.  Perhaps Javascript.
01:15 lucs (but I thought it was quite whitespace/indentation sensitive)
01:15 jeffreykegler Right, but if the newlines were disarranged you could manually edit it back into shape, right?
01:15 lucs More or less, I guess.
01:15 jeffreykegler Ok, why can't a computer be that smart?
01:16 jeffreykegler It should be better at figuring out where statements begin and end then you are, right?
01:16 lucs One would hope so :)
01:17 jeffreykegler But pre-Marpa, parsers have not been as smart about parsing as people, right?
01:17 lucs Marpa does appear to be very smart indeed.
01:18 jeffreykegler Anyway, Marpa can find statement beginning and endings, just the way a programmer could, if he had to rearrange the formatting.
01:18 jeffreykegler And what this is, is just general BNF parsing.
01:18 jeffreykegler Like from 1968
01:18 lucs :)
01:18 jeffreykegler Only faster
01:19 jeffreykegler There's a lot Marpa can do that an imaginative person can exploit.
01:21 lucs We're (perl users) lucky you stuck with Perl as the main interface language (although I saw here you want to go beyond that).
01:21 lucs It's a very powerful tool.
01:21 jeffreykegler I stick with Perl because of CPANtesters
01:21 lucs But I don't know how well known it is in the community so far.
01:23 jeffreykegler There are problems with that.  Marpa is very mathematical, and the Perl community (with exceptions) hates math.
01:23 jeffreykegler But no other language has anything like CPANtesters to my knowledge
01:25 lucs The mathematical aspect wouldn't get in the way of basic (and more!) usage, would it?
01:26 jeffreykegler These days BNF is considered math
01:26 lucs Programmers leave the complex theoretical stuff to guys like you, and we profit from the results :)
01:26 jeffreykegler Thanks!
01:26 lucs Most programmers should be able to understand basic BNF, I mean, is it that hard?
01:27 lucs (Well, maybe not "most", but a lot.)
01:27 jeffreykegler Well, for years you couldn't do anything with it except read the appendixes in standards, and waster time trying to make yacc work
01:27 jeffreykegler *waster -> waste
01:28 lucs I've done that a bit in the past, and I know what you mean.
01:28 jeffreykegler So everybody switched to regular expressions, which are in fact harder.
01:29 jeffreykegler But you get continual practice with regexes from editors, so that your fingers know regexes by the time you're done
01:29 jeffreykegler ... and you don't consider it math any more
01:30 jeffreykegler So over the years regexes came to be considered an ordinary programmer skill, and BNF came to be seen as rocket science.
01:30 lucs Oh, my personal feeling was that BNF wasn't powerful enough (I know basically nothing about parsing theory mind you).
01:32 jeffreykegler If yacc was  your only tool for using it, that's what you'd come to think of BNF, yes
01:33 lucs Did you get a chance, or are you planning to, speak at YAPC or some Perl conference?
01:33 jeffreykegler I've been self-funded on this, I do not have a travel budget.
01:34 lucs Ah.
01:37 lucs Back to studying -- I'll probably be back with more questions soon :)
01:38 jeffreykegler Later!
01:40 lucs Oh, here's one already (I had in my notes): In the SLIF DSL, the discussion about 'symbols': are such symbols used for things other than rule names?
01:41 jeffreykegler Not sure what the question is.  There aren't really any "rule names".
01:41 lucs Hmm...
01:42 jeffreykegler In Perl 6, the equivalent of a LHS (this is from memory, but I think this is the case) names a "rule" in their sense of the term.
01:43 lucs I think I see what you mean -- I call 'Expression' the rule name in "Expression ::= Term..."
01:43 jeffreykegler In Marpa, as in traditional BNF, the LHS can occur on the left of many rules.
01:43 lucs Ah, yes, I see.
01:43 jeffreykegler In traditional BNF, <Expression> is not a rule name.
01:44 jeffreykegler I experimented with the idea of using Perl 6 syntax ...
01:44 lucs It's a misunderstanding on my part, thanks for clearing it up.
01:44 jeffreykegler and this difference is one of the factors that made me back off from closely following their grammar/rule syntax.
01:45 jeffreykegler To be sure, informally, one will speak of "the Expression rule", but strictly speaking that's not correct ...
01:45 jeffreykegler and it can be misleading.
01:45 lucs Yep, I misled myself there :)
01:46 jeffreykegler In this Marpa follows yacc, and traditional BNF, and does not follow Perl 6.
01:47 lucs You have a solid historic perspective, which many programmers will lack.
01:48 jeffreykegler Comes from being old.  I was born in 1953 and watched all this happen.
01:55 lucs So does 'symbol' in this usage basically mean "non-terminal"?
01:56 jeffreykegler lucs: Let me look at the DSL POD, but basically symbol means "symbol" in the BNF sense.
01:57 jeffreykegler Because I also have "terminal" symbols in the SLIF.
01:57 lucs Okay. You probably feel it well, but for someone who is not very familiar with BNF, "symbol" sounds a bit generic.
01:58 jeffreykegler One of my defects in explaining things is that I've immersed myself in parsing theory since the early 1970's and think using its terminology.
01:58 lucs By the way, all this machinery, is it considered part of linguistics, computer science, a bit of both, other things?
01:58 jeffreykegler In the meantime, everybody else pretty much forgot it.
01:59 jeffreykegler So the basic idea of the SLIF is BNF -- a rewriting system with an alphabet of terminals, and rules which are composed of symbols.
02:00 jeffreykegler In a context-free grammar every rule has one LHS symbol, and zero or more RHS symbols.
02:00 jeffreykegler Add a special start symbol, and you're ready to rock 'n roll!
02:00 lucs :)
02:01 jeffreykegler As with any practical implementation, the SLIF adds a few wrinkles to the theoretical idea of "rule" and "symbol"
02:02 jeffreykegler For example the character classes, things like '[abc]', are kind of a hack to the theory, ...
02:03 jeffreykegler but my basic idea of the words "symbol" and "rule" comes out of the parsing theory texts.
02:04 lucs I guess I kind of took the word 'symbol' for granted when reading the text, and forgot that it has a precise meaning in the context of parsing and BNFs.
02:05 jeffreykegler I too take it for granted, but my "granted" can be a bit different from other people's.
02:05 lucs :)
02:06 jeffreykegler Anyway, all this is why I am very grateful for folks like ronsavage, who re-explains Marpa.
06:33 ilbot3 joined #marpa
06:33 Topic for #marpa is now Current release: https://metacpan.org/pod/Marpa::R2   Source: https://github.com/jeffreykegler/Marpa--R2   public logs at http://irclog.perlgeek.de/marpa/today
12:14 jeffreykegler joined #marpa
12:33 jeffreykegler left #marpa
13:36 lucs In the SLIF DSL pod, in the paragraph beginning with "Within an alternative, symbols may be enclosed in parentheses. ...", shouldn't it be  s/symbol/primary/ ?
15:38 lucs Just to confirm: adverbs are associated to a RHS as a whole, not to each of its alternatives, right?
15:39 lucs That is, you couldn't specify something like:  ... ::= foo action => ... | bar action => ...
15:42 lucs And having  ... ::= foo | bar action => ...  will associate the action to both foo and bar.
15:46 LWA joined #marpa
16:50 jeffreykegler joined #marpa
16:52 jeffreykegler lucs: adverbs are associated to alternatives and (if there are multiple alternatives in a rule) not the rule.
16:53 lucs Aha. Got it.
16:55 lucs (just to confirm) So in  ... ::= foo | bar action => ...  foo will be subject to the default action, right?
17:11 lucs (Okay, got it, it is now clear to me that that is correct.)
17:12 jeffreykegler lucs: right!
19:04 lucs jeffreykegler: Did you catch my earlier question about  s/symbol/primary ?
19:04 jeffreykegler Oh.  I thought it might be part of another question.  sorry.
19:05 jeffreykegler Parentheses can group symbols (include char classes and single-quoted strings) on a RHS
19:05 lucs Isn't that the definition of a primary?
19:05 jeffreykegler More than one can be inside a single pair or parens
19:06 jeffreykegler Do I define primary anywhere?
19:06 lucs I think so, hang on...
19:06 lucs Yes, in the preceding paragraph.
19:06 jdurand joined #marpa
19:06 * jeffreykegler is reading the doc
19:08 jeffreykegler lucs: OK, you're right.  s/symbol/primary/
19:08 lucs I believe that that whole second paragraph in the "RHS alternative" section means "primary" when it says "symbol".
19:08 jeffreykegler lucs: is it convenient for you to submit a github pull request
19:08 lucs Ah, thanks.
19:08 lucs Yes, I will.
19:08 jeffreykegler Or just an issue, though of course the pull request is easy
19:09 lucs Yep.
19:09 jeffreykegler lucs: and congratulations.  You now know the doc better than I do. :-)
19:09 lucs I wouldn't go that far :)
19:10 lucs Another question.
19:10 lucs The :lexeme pseudo-rule: Can it make a lexeme out of something that wasn't one already?
19:12 jeffreykegler lucs: No.  It catches all the many mis-combinations and fatals.
19:12 jeffreykegler The lexeme pseudo-rule "declares" in the narrow sense -- if the lexeme is not a lexeme, it will not help make it one.
19:14 lucs Okay. In other words, it musn't introduce contradictions, but if used correctly, it was already apparent that the lexeme whose adverbs it modifies was indeed a lexeme.
19:15 jeffreykegler Yes.  I think the docs somewhere say that one possible use to make sure that something you think is a lexeme, that Marpa thinks so too.  Because otherwise Marpa will dispel your illusions with a fatal error.
19:15 lucs I think it's the "declares [it] to be a lexeme" that confused me.
19:15 lucs Ah :) I haven't seen that part yet.
19:15 * jdurand is thinking to MarpaX::Languages::ASM namespace
19:17 jeffreykegler Don't know of a better word.  In C, some declarations work the same way -- a function prototype does *not* bring the function into being, and neither does an "extern" declaration of a variable.
19:18 lucs Maybe that advice about how to make sure a lexeme is a lexeme by using that pseudo-rule could appear in that section.
19:18 lucs That seems to be the rationale for that declaration explanation.
19:19 lucs (Well, part of it.)
19:21 lucs If you don't mind, I will try rewording it, and submit a pull request (which you may of course feel totally free to reject if it's not up to par).
19:22 jeffreykegler Don't mind at all. I appreciate it.
19:22 lucs Okay, thanks.
19:22 jeffreykegler lucs: One thing to note -- because of my work on the Marpa parse engine rewrite, I am letting pull requests and issues pile up for the next few days
19:23 lucs Hey, no problem, quite understandable.
19:23 jeffreykegler So my apologies if it does not get prompt attention.  An advantage of github is that its tracking is good.
19:23 lucs You bet.
20:32 jeffreykegler left #marpa
21:21 lucs Does it sound right if I call the '+' in  Term ::= Factor | Term '+' Term  an "anonymous lexeme"?
21:23 LWA sounds ok-ish. I'd rather refer to it as a "token literal" or "literal string"
21:24 lucs Hmm... I guess it's those too, but I want to point out (in my notes) that it is also a lexeme.
21:24 lucs I was wondering if "anonymous" was an appropriate designation.
21:25 lucs (or if perhaps there was a better term)
21:27 lucs But ok-ish will do :)
21:27 lucs Thanks.
22:01 jeffreykegler joined #marpa
22:04 jeffreykegler left #marpa

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