<?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>ply &#8211; Alessandro Crugnola &#8211; sephiroth.it</title>
	<atom:link href="https://blog.sephiroth.it/tag/ply/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.sephiroth.it</link>
	<description>programmer by pure chance</description>
	<lastBuildDate>Sat, 19 Jun 2010 16:05:22 +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>ply &#8211; Alessandro Crugnola &#8211; sephiroth.it</title>
	<link>https://blog.sephiroth.it</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Actionscript parsing experiences: PyBison &#038; PLY</title>
		<link>https://blog.sephiroth.it/2007/01/16/actionscript-parsing-experiences-pybison-ply/</link>
					<comments>https://blog.sephiroth.it/2007/01/16/actionscript-parsing-experiences-pybison-ply/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Tue, 16 Jan 2007 21:35:45 +0000</pubDate>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[antlr]]></category>
		<category><![CDATA[ast]]></category>
		<category><![CDATA[bison]]></category>
		<category><![CDATA[e4x]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[ply]]></category>
		<category><![CDATA[pybison]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=195</guid>

					<description><![CDATA[My experiments with actionscript text-parsing continue, This time I tested two bison python implementations: pybison and ply.<br />
]]></description>
										<content:encoded><![CDATA[<p>My experiments with text-parsing continue..</p>
<p><span style="font-weight: bold;">PyBison</span><br />
Last day I founded a python library <a title="pybison" href="http://www.freenet.org.nz/python/pybison/" target="_blank">(pybison</a>) which runs the generated python parser at near the speed of C-based parsers, due to direct hooks into bison-generated C code.<br />
Cool, unfortunately I couldn&#8217;t compiled it for Windows and so I made my test on Ubuntu only. What I did was just to export the already written lexer/grammar using bison2py (boundled with pybison) and run it.</p>
<p>If you want to take a look at the python parser try it by downloading the source code here.<br />
The run.py file accept these parameters:<br />
<code>usage: run.py [options]<br />
options:<br />
-h, --help            show this help message and exit<br />
-v, --verbose         Turn on verbose mode<br />
-o OUTPUT_FILE, --output=OUTPUT_FILE<br />
Don't print to stdout but to the output file<br />
-i INPUT_FILE, --input=INPUT_FILE<br />
Input file to be parsed<br />
-x, --to-xml          Returns a human-readable xml representation of the<br />
parse tree<br />
-b, --bison-debug     Print the Bison/Flex debug</code><br />
You can download the source code <a title="pybison code source code" href="https://blog.sephiroth.it/wp-content/uploads/2007/01/pybison.tar.gz">here</a></p>
<p><span style="font-weight: bold;">PLY</span><br />
The second test I did was using <a href="http://www.dabeaz.com/ply/" target="_blank">PLY</a>, an implementation of  lex and yacc parsing tools for Python. Being implemented entirely in python it should be much more slower that pybison, but I didn&#8217;t find any difference with the pybison parser version. In fact PLY , like the traditional bison, creates tables starting from the grammar syntax.<br />
Ok, Both of the implementations are slower that the pure C parser, but extremely faster that <span style="font-weight: bold;">antlr</span>!<br />
(They took more or less 0.02 to 0.5 secs for parsing and generating the AST.)<br />
Unlike pybison PLY is still mantained and offers more features and a better error handling.. even if the whole grammar has to be rewritten in python, and it can be compiled in Windows too.</p>
<p>To run the test just write:<br />
<code>python run.py {filename}</code><br />
<span style="font-weight: bold;">P.S.</span> Unfortunately the yacc parser isn&#8217;t yet complete because I still need to find a way for parsing correctly E4X and XML syntax..</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2007/01/16/actionscript-parsing-experiences-pybison-ply/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
