Time |
Nick |
Message |
00:42 |
jeffreykegler |
ronsavage1: My apologies re http://irclog.perlgeek.de/marpa/2014-08-30#i_9273196 |
00:43 |
jeffreykegler |
I missed this when backlogging -- that's why I did not respond. |
01:34 |
|
jeffreykegler joined #marpa |
01:36 |
shadowpaste |
"jeffreykegler" at 162.232.214.245 pasted "An ambiguous marked middle recursion that runs in linear time" (55 lines) at http://scsys.co.uk:8002/420820 |
01:37 |
jeffreykegler |
I ran a check on Marpa's handling of marked middle recursions, which I've just pasted. |
01:38 |
jeffreykegler |
It's this grammar S ::= a S a S ::= a a x a |
01:38 |
jeffreykegler |
It obviously a middle recursion, but it's marked -- only a middle can contain a 'x' |
01:39 |
jeffreykegler |
It's also ambiguous. Until you see an 'x', after initial couple of 'a' |
01:39 |
jeffreykegler |
... couple of "a"'s, |
01:44 |
jeffreykegler |
every 'a' can be either a first 'a' in the rule S ::= a S a, or one of the first two in S ::= a a x a |
01:45 |
jeffreykegler |
And it's linear, as you can see by varying the length of the input string. The Earley sets keep track of all three possibilities, until they see an 'x'. No Earley table contains more than 5 entries, so the cost of tracking this is low. |
01:45 |
jeffreykegler |
It's all little abstract I admit, but if you're trying to figure our what's efficient in Marpa, and how it works, it is a very instructive, very short example. |
01:46 |
* jeffreykegler |
is having Internet troubles again. Apparently this stuff bores the gremlins who control his Internet connection. :-) |
01:52 |
Aria |
Good explanation! |
04:23 |
|
jeffreykegler joined #marpa |
04:24 |
jeffreykegler |
New blog post, announcing Ron's web site: http://jeffreykegler.github.io/Ocean-of-Awareness-blog/individual/2014/09/website.html |
04:25 |
jeffreykegler |
You may notice it has Yet Another Rewrite of the "about the Marpa algorithm" language. |
04:26 |
jeffreykegler |
Ron: you might want to wait until it settles, has typos removed, etc., before updating your page. |
05:12 |
|
ronsavage joined #marpa |
07:56 |
|
ronsavage1 joined #marpa |
07:58 |
ronsavage1 |
Waiting for the gremlin dust to settle..................................... |
15:33 |
|
MintberryCruNCH joined #marpa |
15:34 |
MintberryCruNCH |
hey guys, very new to marpa, had an issue id like to discuss, anyone around |
15:36 |
lucs |
MintberryCruNCH: Just post away, the experts (not me! :-) are usually not very far away, and they'll see it on the log (see /topic) anyway. |
15:41 |
MintberryCruNCH |
well i had a small issue, im trying to put G1 rules for parsing hex and binary numbers like so Number ::= '0b' BinDigits action => bin_number | '0x' HexDigits action => hex_number, and then declare the L0 |
15:41 |
MintberryCruNCH |
as HexDigits ~ [\dA-Fa-f]+ \nBinDigits ~ [01]+. Now when i enter say 0b1010, it doesnt get detected in the rule, but gets treated as HexDigits. Is there any way (perhaps a better character class or prioritizing rule over L0 to ensure it hits the rule?) forgive my noob level explanation, but you probably get the idea of it |
15:58 |
|
rns joined #marpa |
15:59 |
rns |
MintberryCruNCH: please check this https://gist.github.com/rns/df918056abc656eb0d01 |
16:01 |
rns |
Basically you need to make (Hex|Bin)Digits G1 rules because G1 is much better at handling ambiguity. |
16:10 |
rns |
topic |
17:22 |
MintberryCruNCH |
Thanks a lot rns!, sorry i was away for dinner, that worked |
20:06 |
|
jdurand joined #marpa |
20:06 |
jdurand |
Re https://gist.github.com/jddurand/59d2f01a62820619d335 - my attempts using L0 is at https://gist.github.com/jddurand/59d2f01a62820619d335 |
20:08 |
jdurand |
rns answer and mine show well the difference between values when things are coded at G1 or L0 level. At G1 level (rns), all characters appears one by one in the AST. IN the L0 level (rns), BinDigits and HexDigits appear as a single block. |
20:09 |
jdurand |
I have posted the output as a comment to both gists, just to make things clear. |
20:12 |
jdurand |
But G1 level also has its very big disadvantage as soon as you have a :discard rule. For example, rns gist will happily parse 0b 0101 |
20:13 |
jdurand |
Re http://irclog.perlgeek.de/marpa/2014-09-02#i_9286672 : should have been read "Re http://irclog.perlgeek.de/marpa/2014-09-02#i_9285615 etc..." ahem |
20:16 |
jdurand |
Errata: In the L0 level (jdd) - sorry |
20:44 |
|
rns joined #marpa |
20:46 |
rns |
MintberryCruNCH: jdd's suggestion is more correct and efficient. You have to use it, I think. |
20:49 |
|
MintBerrryCruNCH joined #marpa |
22:50 |
|
jeffreykegler joined #marpa |