<?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: when a token is not a token</title>
	<atom:link href="http://blog.excastle.com/2006/04/28/antlr-when-a-token-is-not-a-token/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.excastle.com/2006/04/28/antlr-when-a-token-is-not-a-token/</link>
	<description>Life, .NET, and Cats</description>
	<lastBuildDate>Tue, 31 Aug 2010 13:47:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Nguyen Minh Hai</title>
		<link>http://blog.excastle.com/2006/04/28/antlr-when-a-token-is-not-a-token/comment-page-1/#comment-33174</link>
		<dc:creator>Nguyen Minh Hai</dc:creator>
		<pubDate>Sat, 18 Oct 2008 22:14:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.excastle.com/2006/04/28/antlr-when-a-token-is-not-a-token/#comment-33174</guid>
		<description>Hi. I&#039;m using ANTLR 3.0. I have two grammars:

(1)
grammar Expr;

stat	:	expr SEMI;
expr	:	multExpr (PLUS multExpr &#124; MINUS multExpr)*;
multExpr:	atom (MUL multExpr &#124; DIV multExpr)*;
atom	:	INT &#124; &#039;(&#039; expr &#039;)&#039;;

INT	:	&#039;0&#039;..&#039;9&#039;+ ;
PLUS	:	&#039;+&#039;;
MINUS	:	&#039;-&#039;;
MUL	:	&#039;*&#039;;
DIV	:	&#039;/&#039;;
SEMI	:	&#039;;&#039;;

(2)
grammar Expr;

stat	:	expr SEMI;
expr	:	multExpr ((PLUS multExpr &#124; MINUS multExpr)+ &#124; );
multExpr:	atom ((MUL multExpr &#124; DIV multExpr)+ &#124; );
atom	:	INT &#124; &#039;(&#039; expr &#039;)&#039;;

INT	:	&#039;0&#039;..&#039;9&#039;+ ;
PLUS	:	&#039;+&#039;;
MINUS	:	&#039;-&#039;;
MUL	:	&#039;*&#039;;
DIV	:	&#039;/&#039;;
SEMI	:	&#039;;&#039;;

As far as I know, (2) works well, but (1) gets stuck if MINUS or DIV is the very first operator, for example, &quot;1-2+3&quot;, &quot;1/2+3&quot;, etc. and I can not figure out what the reason is. I hope you can help me. Thanks in advance :D.</description>
		<content:encoded><![CDATA[<p>Hi. I&#8217;m using ANTLR 3.0. I have two grammars:</p>
<p>(1)<br />
grammar Expr;</p>
<p>stat	:	expr SEMI;<br />
expr	:	multExpr (PLUS multExpr | MINUS multExpr)*;<br />
multExpr:	atom (MUL multExpr | DIV multExpr)*;<br />
atom	:	INT | &#8216;(&#8216; expr &#8216;)&#8217;;</p>
<p>INT	:	&#8216;0&#8242;..&#8217;9&#8242;+ ;<br />
PLUS	:	&#8216;+&#8217;;<br />
MINUS	:	&#8216;-&#8217;;<br />
MUL	:	&#8216;*&#8217;;<br />
DIV	:	&#8216;/&#8217;;<br />
SEMI	:	&#8216;;&#8217;;</p>
<p>(2)<br />
grammar Expr;</p>
<p>stat	:	expr SEMI;<br />
expr	:	multExpr ((PLUS multExpr | MINUS multExpr)+ | );<br />
multExpr:	atom ((MUL multExpr | DIV multExpr)+ | );<br />
atom	:	INT | &#8216;(&#8216; expr &#8216;)&#8217;;</p>
<p>INT	:	&#8216;0&#8242;..&#8217;9&#8242;+ ;<br />
PLUS	:	&#8216;+&#8217;;<br />
MINUS	:	&#8216;-&#8217;;<br />
MUL	:	&#8216;*&#8217;;<br />
DIV	:	&#8216;/&#8217;;<br />
SEMI	:	&#8216;;&#8217;;</p>
<p>As far as I know, (2) works well, but (1) gets stuck if MINUS or DIV is the very first operator, for example, &#8220;1-2+3&#8243;, &#8220;1/2+3&#8243;, etc. and I can not figure out what the reason is. I hope you can help me. Thanks in advance <img src='http://blog.excastle.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe White's Blog</title>
		<link>http://blog.excastle.com/2006/04/28/antlr-when-a-token-is-not-a-token/comment-page-1/#comment-5571</link>
		<dc:creator>Joe White's Blog</dc:creator>
		<pubDate>Mon, 08 May 2006 01:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.excastle.com/2006/04/28/antlr-when-a-token-is-not-a-token/#comment-5571</guid>
		<description>&lt;strong&gt;What to do when ANTLR moves your variables out of scope&lt;/strong&gt;


</description>
		<content:encoded><![CDATA[<p><strong>What to do when ANTLR moves your variables out of scope</strong></p>
]]></content:encoded>
	</item>
</channel>
</rss>
