tag:blogger.com,1999:blog-8643857899806162280.post8044888701551165295..comments2024-02-25T06:15:55.318-03:00Comments on Bug squash: Parsing with applicative functors in F#Mauricio Schefferhttp://www.blogger.com/profile/15247972578064164206noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-8643857899806162280.post-51676459063208937402012-05-08T12:27:28.454-03:002012-05-08T12:27:28.454-03:00@Denys : That's interesting, thanks for the po...@Denys : That's interesting, thanks for the pointer. So that disproves Leijen/Meijer's assertion (just re-read the paper, it doesn't really prove that proposition formally).Mauricio Schefferhttps://www.blogger.com/profile/15247972578064164206noreply@blogger.comtag:blogger.com,1999:blog-8643857899806162280.post-52551327407835100702012-05-08T07:20:15.901-03:002012-05-08T07:20:15.901-03:00"In the particular case of parsers, it means ..."In the particular case of parsers, it means that monadic parsers are able to parse context-sensitive grammars, while applicative parsers can only parse context-free grammars"<br /><br />Here (http://byorgey.wordpress.com/2012/01/05/parsing-context-sensitive-languages-with-applicative/) is said that applicative parsers can parse context-sensitive grammars.Anonymoushttps://www.blogger.com/profile/01027445565168748925noreply@blogger.comtag:blogger.com,1999:blog-8643857899806162280.post-56474788599839763492012-05-08T07:14:22.806-03:002012-05-08T07:14:22.806-03:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/01027445565168748925noreply@blogger.comtag:blogger.com,1999:blog-8643857899806162280.post-38766888441651405152011-02-01T07:05:06.771-03:002011-02-01T07:05:06.771-03:00Yeah, that's what I was missing. I didn't ...Yeah, that's what I was missing. I didn't know this precedence is counted in case of custom operator functions. It seems like quite hidden feature to me...<br /><br />Cheerstomas.Knoreply@blogger.comtag:blogger.com,1999:blog-8643857899806162280.post-80629315004136854882011-01-31T20:41:37.698-03:002011-01-31T20:41:37.698-03:00@tomas.K: There is a strictly defined operator pre...@tomas.K: There is a strictly defined operator precedence in the spec, and '*' has a higher precedence than '<', so '*>' has a higher precedence than '< ! >'Mauricio Schefferhttps://www.blogger.com/profile/15247972578064164206noreply@blogger.comtag:blogger.com,1999:blog-8643857899806162280.post-36400444969138727502011-01-31T17:35:26.320-03:002011-01-31T17:35:26.320-03:00Yes, this is what I tried. It seemed to me that th...Yes, this is what I tried. It seemed to me that the a_hex3 won't compile, but is ok. I thought there is a strict rule of associativity of function evaluation, which is same in a_hex2 as in a_hex3, but there is not. F# is enough clever to choose different evaluation order. So my rather study question is what rule is driving this evaluation order differences?tomas.Knoreply@blogger.comtag:blogger.com,1999:blog-8643857899806162280.post-72661519226589647772011-01-31T11:23:04.673-03:002011-01-31T11:23:04.673-03:00If you try to force a_hex3 into the same evaluatio...If you try to force a_hex3 into the same evaluation order of a_hex2 (by using parens) you'll see that this doesn't type:<br />((fun hex1result hex2result -> readHex hex1result hex2result) < ! > skipChar '%') *> hex <*> hex<br />because the pure function expects a char, but skipChar produces unit.<br /><br />Still, generally, since we can't define operator precedence in F# as you can in Haskell, sometimes you'll have to use parens to force the evaluation order, where in the equivalent Haskell code the defined operator precedence takes care of that.Mauricio Schefferhttps://www.blogger.com/profile/15247972578064164206noreply@blogger.comtag:blogger.com,1999:blog-8643857899806162280.post-89640679831550917872011-01-31T07:30:06.608-03:002011-01-31T07:30:06.608-03:00Hi,
I stuck on different evaluation order of a_h...Hi, <br /><br />I stuck on different evaluation order of a_hex2 and a_hex3. In a_hex2 it first evaluates: <br />((fun skipCharResult hex1result hex2result -> readHex hex1result hex2result) < ! > skipChar '%')<br /><br />but in a_hex3 it first evaluates:<br />(skipChar '%' *> hex)<br /><br />So I see different associativity, so how this work in F# ?<br /><br />Thank youtomas.Knoreply@blogger.comtag:blogger.com,1999:blog-8643857899806162280.post-43355414589633500272011-01-03T08:38:04.116-03:002011-01-03T08:38:04.116-03:00Nice post, looking forward to next!Nice post, looking forward to next!tomas.Knoreply@blogger.com