当前位置:首页 » 软件开发
开发技术指南» 文章正文
    引言: In this article we build a sim
 

 

 ·the java extension mechanism    »显示摘要«
    摘要:a huge number of publicly available packages extends the functionality of the java core platform. some of them provide access to features of the underlying operating system that are not available t......
    摘要:i wouldnt be exaggerating if i said that all of us use pojos—"plain old java objects"— in our everyday application development. we use them with hibernate or with entity beans, ......


From Writing Programs to Creating Compilers

in this article we build a simple compiler that augments java with tasks (independent blocks of code that execute in parallel), thus creating a new language called aj that well supports the programming of systems with concurrent activities. this is not to imply that java does not support multithreading, but to create a syntax that enables the clear expression of concurrency requirements. (aj programs do, in fact, compile into java programs that use java.lang.thread objects to support tasks.) you will see how to use a completely visual, user-friendly parser generator, visuallanglab, to quite easily build a compiler for aj.

visuallanglab is a freely downloadable (gpl) java.net project. to install it, just unzip the distribution file (visuallanglab.zip) into a directory. the visual parser generator (see figure 1) is started by clicking on visuallanglab.jar. the only other thing to keep in mind is that visuallanglab.jar must be on the classpath when compiling or executing the generated parser. 【程序编程相关:了解 JAVA classloader

start here: a readymade grammar for java 【推荐阅读:Java学习推荐书籍

the heart of any compiler project is the grammar--a typically cryptic piece of text that serves as a specification for the language. since we wish to augment the capabilities of an existing language (java), it is simpler to start with an existing grammar for the base language. the starting point for this exercise will therefore be a java 1.4 grammar included in the visuallanglab distribution (the file java14c.lkv). well-written grammars, like well-written programs, are divided into smaller units called rules. a few sample rules from the java 1.4 grammar (as displayed by the visuallanglab gui) are shown in figure 2 (ifstatement), figure 3 (switchstatement) and figure 4 (unaryexpression). 【扩展信息:hibernate的hello word

figure 1. the visuallanglab gui


...   下一页
 ·timing is everything    »显示摘要«
    摘要:tick, tick, tick, tick any time you introduce dynamic effects, animations, or time-based events to a java application, you find yourself re-implementing the same functionality you have written ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE