<?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>Hacking so Existing &#187; Compiler</title>
	<atom:link href="http://dev.zhourenjian.com/blog/tag/compiler/feed" rel="self" type="application/rss+xml" />
	<link>http://dev.zhourenjian.com/blog</link>
	<description>Zhou Renjian&#039;s Development Blog</description>
	<lastBuildDate>Fri, 23 Apr 2010 01:54:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>JavaCC</title>
		<link>http://dev.zhourenjian.com/blog/2008/04/23/javacc.html</link>
		<comments>http://dev.zhourenjian.com/blog/2008/04/23/javacc.html#comments</comments>
		<pubDate>Wed, 23 Apr 2008 14:14:39 +0000</pubDate>
		<dc:creator>Zhou Renjian</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Compiler]]></category>
		<category><![CDATA[JavaCC]]></category>

		<guid isPermaLink="false">http://dev.zhourenjian.com/blog/?p=48</guid>
		<description><![CDATA[I learned to use JavaCC these days. And I found that JavaCC is a great toolkit. What is JavaCC? JavaCC is short for Java Compiler Compiler. It is a parser or scanner generator for Java. Java Compiler Compiler [tm] (JavaCC &#8230; <a href="http://dev.zhourenjian.com/blog/2008/04/23/javacc.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I learned to use JavaCC these days. And I found that JavaCC is a great toolkit.</p>
<p>What is JavaCC?</p>
<p><a href="https://javacc.dev.java.net/">JavaCC</a> is short for Java Compiler Compiler. It is a parser or scanner generator for Java.</p>
<blockquote><p>
Java Compiler Compiler [tm] (JavaCC [tm]) is the most popular parser generator for use with Java [tm] applications. A parser generator is a tool that reads a grammar specification and converts it to a Java program that can recognize matches to the grammar. In addition to the parser generator itself, JavaCC provides other standard capabilities related to parser generation such as tree building (via a tool called JJTree included with JavaCC), actions, debugging, etc.</p></blockquote>
<p>You can find <a href="https://javacc.dev.java.net/servlets/ProjectDocumentList?folderID=110">a lot of language grammar and AST</a> on its site too. I see that C++ and Java 1.5 grammar are there. JavaScript isn&#8217;t there. But I find out that Dojo toolkit&#8217;s JSLinker provides an <a href="http://svn.dojotoolkit.org/src/trunk/tools/jslinker/src/org/dojo/jsl/parser/EcmaScript.jjt">ECMAScript 262 one</a>. That is to say, you can create parser and parse C++, Java or JavaScript sources into your AST for any uses. Lots of great features can be imagined.</p>
<p>I spent about a week learning and using JavaCC. I completed a parser for an IDL language named CAR. I also built an Eclipse editor using the generated AST parser. Bang, all things seems working well: keyword hight-lighting, outline view, error probing, &#8230; Great toolkit!</p>
<p>Using JavaCC is quite simple, just download  javacc-4.0.zip and unzip it, then following its examples tutorial. I sugguest you to start with JavaGrammars and VTransformer examples, as they are about Java grammar.</p>
<p>I think, later, given opportunity, I will try JavaCC out on other projects. Maybe my Java2Script compiler would be benefited from JavaCC.</p>
<p>P.S. Update:<br />
There is a <a href="http://eclipse-javacc.sourceforge.net/">JavaCC Eclipse Plugin project</a>, you can <a href="http://sourceforge.net/project/showfiles.php?group_id=56876">download the plugin</a> to help you writing your syntax file.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.zhourenjian.com/blog/2008/04/23/javacc.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
