<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>asyacc &#8211; Alessandro Crugnola &#8211; sephiroth.it</title>
	<atom:link href="https://blog.sephiroth.it/tag/asyacc/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.sephiroth.it</link>
	<description>programmer by pure chance</description>
	<lastBuildDate>Mon, 21 Jun 2010 20:33:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://blog.sephiroth.it/wp-content/uploads/2019/03/cropped-sepy-big-32x32.png</url>
	<title>asyacc &#8211; Alessandro Crugnola &#8211; sephiroth.it</title>
	<link>https://blog.sephiroth.it</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>AsYacc &#8211; first alpha release</title>
		<link>https://blog.sephiroth.it/2009/01/15/asyacc-first-alpha-release/</link>
					<comments>https://blog.sephiroth.it/2009/01/15/asyacc-first-alpha-release/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Thu, 15 Jan 2009 15:35:48 +0000</pubDate>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[asyacc]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[gnu flex]]></category>
		<category><![CDATA[lexer]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[regular expression]]></category>
		<category><![CDATA[yacc]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=271</guid>

					<description><![CDATA[Before going further with discussing how to add runtime scripting support to a Flash applications, I&#8217;d like to share with you the source code of a porting of Yacc I did a while ago. I did some simple modification to make Yacc able to generate ActionScript 3.0 source code instead of C. It works quite &#8230; <a href="https://blog.sephiroth.it/2009/01/15/asyacc-first-alpha-release/" class="more-link">Continue reading <span class="screen-reader-text">AsYacc &#8211; first alpha release</span></a>]]></description>
										<content:encoded><![CDATA[<p>Before going further with discussing how to add <a title="Runtime expression evaluation in ActionScript" href="https://blog.sephiroth.it/2008/04/19/runtime-expression-evaluation-in-actionscript/">runtime scripting support to a Flash applications</a>, I&#8217;d like to share with you the source code of a porting of <a href="http://en.wikipedia.org/wiki/Yacc">Yacc</a> I did a while ago. I did some simple modification to make Yacc able to <strong>generate ActionScript 3.0 source code</strong> instead of C. It works quite well and supports a lot standard Yacc features. There might be some issues &#8211; report them to me and I&#8217;ll try to fix them 🙂</p>
<p>You can easilly find documentation about Yacc searching Google (you can start <a href="http://dinosaur.compilertools.net/">here</a> for example).</p>
<p>Usually Yacc is used in conjunction with a <strong>Scanner generator</strong> (like <a href="http://en.wikipedia.org/wiki/Lex_programming_tool">Lex</a>/<a href="http://en.wikipedia.org/wiki/Flex_lexical_analyserx">Flex</a>), but I didn&#8217;t to any porting of commonly used Scanner generators yet.</p>
<p><a href="/wp-content/uploads/2009/01/AsYacc.zip">Here you can download the sources</a>. The <strong>source code should be portable</strong> and compilable on all the most common platform, but I didn&#8217;t tested it on Windows yet. To compile the source code on Mac or Linux, <em>cd</em> to the source code directory and type use:</p>
<pre>gcc *.c -o AsYacc</pre>
<p>Once you have the compiled binary file, you can run the Parser generator using:</p>
<pre>./AsYacc -Hpackage=it.sephiroth.test grammar.y</pre>
<p>Where <em>grammar.y</em> is a text file that contains the grammar of a language defined using the proper syntax (see the docs online for all the detailed information you may need).</p>
<p><a href="https://blog.sephiroth.it/wp-content/uploads/2009/01/TestAsYacc.zip">Here you can download a simple calculator example</a> that uses the RegexLexer <a title="Scripting Flash apps: scanning the input file" href="https://blog.sephiroth.it/2008/12/16/scripting-flash-apps-scanning-the-input-file/">described previously</a> to implement the Scanner. For the ones who might be interested, here is the grammar used:<br />
<code>/* Infix notation calculator. */<br />
%{<br />
%}<br />
%token NUM<br />
%left '-' '+'<br />
%left '*' '/'<br />
%left NEG<br />
%right '^' /* exponentiation */<br />
%%<br />
input:<br />
exp			{ trace( $1 ); }<br />
;<br />
exp:<br />
NUM 			{ $$ = $1; }<br />
| exp '+' exp 		{ $$ = $1 + $3; }<br />
| exp '-' exp 		{ $$ = $1 - $3; }<br />
| exp '*' exp 		{ $$ = $1 * $3; }<br />
| exp '/' exp 		{ $$ = $1 / $3; }<br />
| '-' exp %prec NEG 	{ $$ = -$2; }<br />
| exp '^' exp 		{ $$ = Math.pow( $1, $3 ); }<br />
| '(' exp ')' 		{ $$ = $2; }<br />
;<br />
%%</code></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2009/01/15/asyacc-first-alpha-release/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
