<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: ANTLR By Example: Part 4: Tree Parsing</title>
	<atom:link href="http://www.alittlemadness.com/2006/07/06/antlr-by-example-part-4-tree-parsing/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alittlemadness.com/2006/07/06/antlr-by-example-part-4-tree-parsing/</link>
	<description>A man needs a little madness, or else he never dares cut the rope and be free. -Nikos Kazantzakis</description>
	<lastBuildDate>Fri, 03 Feb 2012 00:04:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: espinete</title>
		<link>http://www.alittlemadness.com/2006/07/06/antlr-by-example-part-4-tree-parsing/comment-page-1/#comment-236148</link>
		<dc:creator>espinete</dc:creator>
		<pubDate>Tue, 24 Aug 2010 12:19:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.alittlemadness.com/?p=30#comment-236148</guid>
		<description>Any Tree Parsing for C# ? any sample code ?? please</description>
		<content:encoded><![CDATA[<p>Any Tree Parsing for C# ? any sample code ?? please</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy McMullan</title>
		<link>http://www.alittlemadness.com/2006/07/06/antlr-by-example-part-4-tree-parsing/comment-page-1/#comment-198670</link>
		<dc:creator>Andy McMullan</dc:creator>
		<pubDate>Wed, 23 Dec 2009 10:59:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.alittlemadness.com/?p=30#comment-198670</guid>
		<description>Just wanted to say thanks for this great series - it&#039;s by far the best tutorial for ANTLR that I&#039;ve come across.</description>
		<content:encoded><![CDATA[<p>Just wanted to say thanks for this great series &#8211; it&#8217;s by far the best tutorial for ANTLR that I&#8217;ve come across.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason</title>
		<link>http://www.alittlemadness.com/2006/07/06/antlr-by-example-part-4-tree-parsing/comment-page-1/#comment-897</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Tue, 08 Aug 2006 11:30:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.alittlemadness.com/?p=30#comment-897</guid>
		<description>Designker,

The factory is not defined in the grammar files: it is a manually created class in our application.  The factory has a method:

NotifyCondition createCondition(String condition)

which creates a notify condition object based on the condition string (e.g. &quot;success&quot; creates a SuccessNotifyCondition object).  These *NotifyCondition classes are also a manually-created part of our application.  You will need to adapt the example to suit you application!</description>
		<content:encoded><![CDATA[<p>Designker,</p>
<p>The factory is not defined in the grammar files: it is a manually created class in our application.  The factory has a method:</p>
<p>NotifyCondition createCondition(String condition)</p>
<p>which creates a notify condition object based on the condition string (e.g. &#8220;success&#8221; creates a SuccessNotifyCondition object).  These *NotifyCondition classes are also a manually-created part of our application.  You will need to adapt the example to suit you application!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Designker</title>
		<link>http://www.alittlemadness.com/2006/07/06/antlr-by-example-part-4-tree-parsing/comment-page-1/#comment-849</link>
		<dc:creator>Designker</dc:creator>
		<pubDate>Sun, 06 Aug 2006 20:53:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.alittlemadness.com/?p=30#comment-849</guid>
		<description>Following the instructions fails to create 10 files. Instead 8 are created and there are errors due to unresolvable type &quot;NotifyConditionFactory&quot;. Where in the grammar file should the details be for creating the NotifyConditionFactory class?

NotifyConditionTreeParserTokenTypes.java
NotifyConditionTreeParserTokenTypes.txt are the files that it fails to create. The entire G file from the ttorial is

header {
    
}


class NotifyConditionLexer extends Lexer;

// Words, which include our operators
WORD: (&#039;a&#039;..&#039;z&#039; &#124; &#039;A&#039;..&#039;Z&#039; &#124; &#039;.&#039;)+ ;

// Grouping
LEFT_PAREN: &#039;(&#039;;
RIGHT_PAREN: &#039;)&#039;;

WHITESPACE
    : (&#039; &#039;) { $setType(Token.SKIP); }
    ;
    
class NotifyConditionParser extends Parser;

options {
        buildAST=true;
}

orexpression
    :   andexpression (&quot;or&quot;^ andexpression)*
    ;

andexpression
    : notexpression (&quot;and&quot;^ notexpression)*
    ;

notexpression
    : (&quot;not&quot;^)? atom
    ;

atom
    : condition
    &#124; LEFT_PAREN! orexpression RIGHT_PAREN!
    ;

condition
    : &quot;true&quot;
    &#124; &quot;false&quot;
    &#124; &quot;success&quot;
    &#124; &quot;failure&quot;
    &#124; &quot;error&quot;
    &#124; &quot;changed&quot;
    &#124; &quot;changed.by.me&quot;
    &#124; &quot;state.change&quot;
    ;
    

class NotifyConditionTreeParser extends TreeParser;
{
    private NotifyConditionFactory factory;

    public void setNotifyConditionFactory(NotifyConditionFactory factory)
    {
        this.factory = factory;
    }
}

cond
    : #(&quot;and&quot; cond cond)
    &#124; #(&quot;or&quot; cond cond)
    &#124; #(&quot;not&quot; cond)
    &#124; condition
    ;

condition
    : &quot;true&quot;
    &#124; &quot;false&quot;
    &#124; &quot;success&quot;
    &#124; &quot;failure&quot;
    &#124; &quot;error&quot;
    &#124; &quot;changed&quot;
    &#124; &quot;changed.by.me&quot;
    &#124; &quot;state.change&quot;
    ;</description>
		<content:encoded><![CDATA[<p>Following the instructions fails to create 10 files. Instead 8 are created and there are errors due to unresolvable type &#8220;NotifyConditionFactory&#8221;. Where in the grammar file should the details be for creating the NotifyConditionFactory class?</p>
<p>NotifyConditionTreeParserTokenTypes.java<br />
NotifyConditionTreeParserTokenTypes.txt are the files that it fails to create. The entire G file from the ttorial is</p>
<p>header {</p>
<p>}</p>
<p>class NotifyConditionLexer extends Lexer;</p>
<p>// Words, which include our operators<br />
WORD: (&#8216;a&#8217;..&#8217;z&#8217; | &#8216;A&#8217;..&#8217;Z&#8217; | &#8216;.&#8217;)+ ;</p>
<p>// Grouping<br />
LEFT_PAREN: &#8216;(&#8216;;<br />
RIGHT_PAREN: &#8216;)&#8217;;</p>
<p>WHITESPACE<br />
    : (&#8216; &#8216;) { $setType(Token.SKIP); }<br />
    ;</p>
<p>class NotifyConditionParser extends Parser;</p>
<p>options {<br />
        buildAST=true;<br />
}</p>
<p>orexpression<br />
    :   andexpression (&#8220;or&#8221;^ andexpression)*<br />
    ;</p>
<p>andexpression<br />
    : notexpression (&#8220;and&#8221;^ notexpression)*<br />
    ;</p>
<p>notexpression<br />
    : (&#8220;not&#8221;^)? atom<br />
    ;</p>
<p>atom<br />
    : condition<br />
    | LEFT_PAREN! orexpression RIGHT_PAREN!<br />
    ;</p>
<p>condition<br />
    : &#8220;true&#8221;<br />
    | &#8220;false&#8221;<br />
    | &#8220;success&#8221;<br />
    | &#8220;failure&#8221;<br />
    | &#8220;error&#8221;<br />
    | &#8220;changed&#8221;<br />
    | &#8220;changed.by.me&#8221;<br />
    | &#8220;state.change&#8221;<br />
    ;</p>
<p>class NotifyConditionTreeParser extends TreeParser;<br />
{<br />
    private NotifyConditionFactory factory;</p>
<p>    public void setNotifyConditionFactory(NotifyConditionFactory factory)<br />
    {<br />
        this.factory = factory;<br />
    }<br />
}</p>
<p>cond<br />
    : #(&#8220;and&#8221; cond cond)<br />
    | #(&#8220;or&#8221; cond cond)<br />
    | #(&#8220;not&#8221; cond)<br />
    | condition<br />
    ;</p>
<p>condition<br />
    : &#8220;true&#8221;<br />
    | &#8220;false&#8221;<br />
    | &#8220;success&#8221;<br />
    | &#8220;failure&#8221;<br />
    | &#8220;error&#8221;<br />
    | &#8220;changed&#8221;<br />
    | &#8220;changed.by.me&#8221;<br />
    | &#8220;state.change&#8221;<br />
    ;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

