<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>rns</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/rns/" />
    <link rel="self" type="application/atom+xml" href="http://blogs.perl.org/users/rns/atom.xml" />
    <id>tag:blogs.perl.org,2009-11-03:/users/rns//933</id>
    <updated>2012-11-09T14:30:36Z</updated>
    <subtitle>Confessions of a Marpa Toolsmith</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type Pro 4.38</generator>

<entry>
    <title>Windows port of Marpa::R2</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/rns/2012/11/windows-port-of-marpar2.html" />
    <id>tag:blogs.perl.org,2012:/users/rns//933.4033</id>

    <published>2012-11-09T14:24:41Z</published>
    <updated>2012-11-09T14:30:36Z</updated>

    <summary>A very good thing indeed. Can&apos;t wait to get my hand on it....</summary>
    <author>
        <name>rns</name>
        <uri>https://github.com/rns</uri>
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/rns/">
        <![CDATA[<p>A <a href="https://groups.google.com/forum/#!topic/marpa-parser/_LAiwDVW1gU">very good</a> thing <a href="https://rt.cpan.org/Ticket/Display.html?id=81057">indeed</a>. Can't wait to get my hand on it. </p>
]]>
        

    </content>
</entry>

<entry>
    <title>A Parser for Marpa::R2</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/rns/2012/11/a-parser-for-marpar2.html" />
    <id>tag:blogs.perl.org,2012:/users/rns//933.4032</id>

    <published>2012-11-09T11:44:23Z</published>
    <updated>2012-11-09T14:40:32Z</updated>

    <summary>This proof-of-concept (test, module) parser takes input, invokes lexer as needed, evaluates parse tree(s) and returns the value....</summary>
    <author>
        <name>rns</name>
        <uri>https://github.com/rns</uri>
    </author>
    
    <category term="default_action" label="default_action" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="evaluation" label="evaluation" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="input" label="input" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="lexer" label="lexer" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="marpa" label="Marpa" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="parsetree" label="parse tree" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="parser" label="parser" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="parsing" label="parsing" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="recognizer" label="recognizer" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/rns/">
        <![CDATA[<p>This proof-of-concept (<a href="https://github.com/rns/MarpaX-Parse/blob/refactor-rule-transforms-out/t/04_parsing_on_default_action.t">test</a>, <a href="https://github.com/rns/MarpaX-Parse/blob/refactor-rule-transforms-out/lib/MarpaX/Parse/Parser.pm">module</a>) parser takes input, invokes <a href="http://blogs.perl.org/users/rns/2012/11/a-lexer-for-marpar2.html">lexer</a> as needed, evaluates parse tree(s) and returns the value.</p>
]]>
        <![CDATA[<p>The goals include (0) to enable automagic invoking of the lexer and alternate()/end_input() for ambiguous tokens, (1) to hide the recognizer set up and parse tree(s) evaluation while keeping the ability to <a href="https://metacpan.org/module/Marpa::R2::Recognizer#Named-arguments">customize Marpa::R2::Recognizer with named arguments</a>, (2) to provide a method for arbitrary parse tree construction and (3) to facilitate specific methods of lexing the input and <code>read()</code>ing the tokens for specific applications, e.g., natural language parsing (NLP).</p>

<p>P.S. This behavior is provided by passing <code>default_action</code> to the parser that will be set to the grammar and used to determine the type (if known) and thus construct the parse tree or anything that <code>default_action</code> is set about to.</p>
]]>
    </content>
</entry>

<entry>
    <title>Algebra of Grammars?</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/rns/2012/11/algebra-of-grammars.html" />
    <id>tag:blogs.perl.org,2012:/users/rns//933.4031</id>

    <published>2012-11-09T10:52:52Z</published>
    <updated>2012-11-09T11:32:02Z</updated>

    <summary>As in &quot;I can parse integers and F can parse floats so I + F must parse integers and floats&quot;. Not sure what I *F must do though. :) Akin to parser combinators, perhaps. Executable notation with Marpa just as...</summary>
    <author>
        <name>rns</name>
        <uri>https://github.com/rns</uri>
    </author>
    
    <category term="algebra" label="algebra" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="grammar" label="grammar" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="parseable" label="parseable" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="set" label="set" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/rns/">
        <![CDATA[<p>As in "<em>I</em> can parse integers and <em>F</em> can parse floats so <em>I</em> + <em>F</em> must parse integers <em>and</em> floats". </p>

<p>Not sure what <em>I</em> <strong><em></strong> *F</em> must do though. :)</p>

<p>Akin to <a href="http://en.wikipedia.org/wiki/Parser_combinator#The_combinators">parser combinators</a>, perhaps.</p>

<p>Executable notation with Marpa just as the relational algebra is executable with SQL.</p>

<p>Looks like an algebra of grammars be defined in terms of their parseable sets (<a href="http://en.wikipedia.org/wiki/Algebra_of_sets">Algebra of Sets</a>). Then <em>I</em> <strong><em></strong> *F</em> must parse only integers (intersection).</p>

<p>And then, if a problem domain can be reduced to an algebra of parseable entities, it must be parsed by an algebra of grammars with all benefits of mixing, matching, and reusing grammars at will.</p>

<p>That's all probably looks too trivial or too vague, but it starts making much more sense (to me at least) when doing general practical BNF parsing with <a href="https://metacpan.org/module/Marpa::R2">Marpa::R2</a> now that grammars like <a href="http://blogs.perl.org/users/jeffrey_kegler/2012/11/a-grammar-that-exemplifies-describes-and-parses-itself.html">this</a> see the light of day.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>A Lexer for Marpa::R2</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/rns/2012/11/a-lexer-for-marpar2.html" />
    <id>tag:blogs.perl.org,2012:/users/rns//933.4030</id>

    <published>2012-11-09T10:02:47Z</published>
    <updated>2012-11-09T10:49:44Z</updated>

    <summary>This proof-of-concept lexer (module, test) extracts literals (and other terminals) from a Marpa::R2::Grammar and turns them to regexes to tokenize string input for Marpa::R2::Recognizer....</summary>
    <author>
        <name>rns</name>
        <uri>https://github.com/rns</uri>
    </author>
    
    <category term="grammar" label="grammar" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="input" label="input" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="lexer" label="lexer" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="literals" label="literals" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="marpa" label="Marpa" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="splitting" label="splitting" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="terminals" label="terminals" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="tokenizing" label="tokenizing" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="tokens" label="tokens" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/rns/">
        <![CDATA[<p>This proof-of-concept lexer (<a href="https://github.com/rns/MarpaX-Parse/blob/refactor-rule-transforms-out/lib/MarpaX/Parse/Lexer.pm">module</a>, <a href="https://github.com/rns/MarpaX-Parse/blob/refactor-rule-transforms-out/t/04_lexing_on_terminal_literals.t">test</a>) extracts literals (and other terminals) from a <a href="https://metacpan.org/module/Marpa::R2::Grammar">Marpa::R2::Grammar</a> and turns them to regexes to tokenize string input for <a href="https://metacpan.org/module/Marpa::R2::Recognizer">Marpa::R2::Recognizer</a>.</p>
]]>
        <![CDATA[<p><p>It is made possible by <a href="https://metacpan.org/module/Marpa::R2::Grammar#Accessors"><code>check_terminal()</code>, <code>rule_ids()</code>, and <code>rule()</code></a> accessors provided by Marpa::R2::Grammar.</p>

<p>It works because token names to be <code>read()</code> by Marpa::R2::Recognizer must be terminal symbols of Marpa::R2::Grammar.</p>

<p>A literal (and terminal, in some cases) fits the definition of a token perfectly, so tokenizing input by (pre-)splitting on literals (terminals) looks obvious, but I was unable to find definitive links and so feel a bit uneasy as to whether or not this would work in general. </p>

<p>But more testing will show the truth, I think. :)</p>
]]>
    </content>
</entry>

</feed>
