{"id":322,"date":"2015-03-25T20:03:52","date_gmt":"2015-03-26T01:03:52","guid":{"rendered":"http:\/\/huewhite.com\/umb\/?p=322"},"modified":"2015-03-25T23:40:13","modified_gmt":"2015-03-26T04:40:13","slug":"current-project","status":"publish","type":"post","link":"https:\/\/huewhite.com\/umb\/2015\/03\/25\/current-project\/","title":{"rendered":"Current Project"},"content":{"rendered":"<p>My current free time project is the implementation of an XML SAX-like parser (much like that offered by <a href=\"http:\/\/xerces.apache.org\/xerces-c\/\" target=\"_blank\">Apache<\/a>), but written in (and for) Mythryl, a functional language heavily derived from SML\/NJ; the goal of the folks working on <a href=\"http:\/\/mythryl.org\" target=\"_blank\">Mythryl<\/a> is to transform SML\/NJ from an academic language mainly used for doing PhD work into a production level language usable by commercial entities.\u00a0 I&#8217;m doing this for these reasons:<\/p>\n<ol>\n<li>Mythryl doesn&#8217;t have such an XML parser;<\/li>\n<li>I&#8217;m doing it using a <a href=\"http:\/\/en.wikipedia.org\/wiki\/Recursive_descent_parser\" target=\"_blank\">recursive descent parser<\/a> engine;<\/li>\n<li>And I&#8217;m doing it using the EBNF definition of XML<\/li>\n<\/ol>\n<p>The latter two reasons can be best illustrated from an example.\u00a0 From the <a href=\"http:\/\/www.w3.org\/TR\/REC-xml\/\" target=\"_blank\">definition of XML<\/a> comes this specification:<\/p>\n<blockquote><p>prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?<\/p><\/blockquote>\n<p>The &#8216;?&#8217; means optional, and the &#8216;*&#8217; means the element may appear 0 or more times.\u00a0 This is an ordered set of instructions, as in &#8220;first this and then this and then this &#8230;.&#8221; other statements can also include &#8220;or&#8221; statements.\u00a0 The words themselves refer to other specifications; eventually, those specifications will actually mention characters in specific formats.<\/p>\n<p>In Mythryl I can write, given sufficient preparation,<\/p>\n<blockquote><p>prolog = |xml_decl| &amp; &lt;misc&gt; &amp; |(doctypedecl &amp; &lt;misc&gt; )| ;<\/p><\/blockquote>\n<p>Here, the |xyz| means xyz is optional, the &lt;xyz&gt; means xyz may apply 0 or more times, and the &#8216;a &amp; b&#8217; means &#8216;a and then b&#8217;, as discussed above &#8211; i.e, the ordering mechanism. \u00a0 Given a little leeway for capitalization conventions and symbol changes, and the Mythryl code assumes an amazing resemblance to the EBNF &#8211; which means I can copy the EBNF from the document, make a couple of changes, and all of a sudden I have a parser to handle the syntax; a little more meddling and I have semantic support.\u00a0 And the semantic can be added as I have time; the parsing works on any valid XML doc, and I can slowly add in the other details, such as detecting problems with well-formedness, etc.<\/p>\n<p>I&#8217;m interested in just how close I can come to using the EBNF, how quickly I can go from copying to full-blown functionality, and the post-development maintenance aspects &#8211; if any, of course.\u00a0 One of the interesting facets of using Mythryl is that about half the time, once you get it to compile something (and that can be a challenge, even for an experienced programmer, for someone new to Mythryl), it Just Works &#8211; a phrase that the developer of Mythryl has been using.\u00a0 No further debug &#8230;<\/p>\n<p>That hasn&#8217;t applied to the parsing engine, as shoving large amounts of data at it had a performance impact; I may have gotten around that with an optimization; generally, though, functional programmers are encouraged to design a good solution without worrying about performance &#8211; let the compiler do it.\u00a0 One estimate of its garbage collection is that it&#8217;s 10 times faster than Java.<\/p>\n<p>As a quick PS, <del>this<\/del> the recursive descent parser isn&#8217;t built into Mythryl; it&#8217;s a part of a small library I developed using a Mythryl <a href=\"http:\/\/mythryl.org\/my-Mythryl_Functions__Parsing_Combinators_I.html\" target=\"_blank\">tutorial<\/a> as a starting point.\u00a0 Operator overloads and currying are very interesting after decades of programming in C and some OO languages.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My current free time project is the implementation of an XML SAX-like parser (much like that offered by Apache), but written in (and for) Mythryl, a functional language heavily derived from SML\/NJ; the goal of the folks working on Mythryl is to transform SML\/NJ from an academic language mainly used \u2026 <a class=\"continue-reading-link\" href=\"https:\/\/huewhite.com\/umb\/2015\/03\/25\/current-project\/\"> Continue reading <span class=\"meta-nav\">&rarr; <\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-322","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/huewhite.com\/umb\/wp-json\/wp\/v2\/posts\/322","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/huewhite.com\/umb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/huewhite.com\/umb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/huewhite.com\/umb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/huewhite.com\/umb\/wp-json\/wp\/v2\/comments?post=322"}],"version-history":[{"count":2,"href":"https:\/\/huewhite.com\/umb\/wp-json\/wp\/v2\/posts\/322\/revisions"}],"predecessor-version":[{"id":331,"href":"https:\/\/huewhite.com\/umb\/wp-json\/wp\/v2\/posts\/322\/revisions\/331"}],"wp:attachment":[{"href":"https:\/\/huewhite.com\/umb\/wp-json\/wp\/v2\/media?parent=322"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/huewhite.com\/umb\/wp-json\/wp\/v2\/categories?post=322"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/huewhite.com\/umb\/wp-json\/wp\/v2\/tags?post=322"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}