From Seo Wiki - Search Engine Optimization and Programming Languages

Jump to: navigation, search
File:Pnuts logo.png
Paradigm Object-oriented, Scripting
Appeared in 1997
Developer Toyokazu Tomatsu (Sun Japan)
Stable release 1.2.1 (2007-7-24; 438464956 ago)
Typing discipline static, dynamic, duck
Influenced by Java
OS Cross platform (JVM)
License Sun Public License

Pnuts is a dynamic scripting language for the Java Platform. It is designed to be used in a dual language system with the Java programming language. The goals of the Pnuts project are to provide a small, fast scripting language that has tight integration with the Java language. Pnuts uses syntax that is simple and friendly to Java developers, while also being very expressive.

Relationship to Java

Because Java and Pnuts share the same type system, Java code can easily invoke or define Pnuts functions. Likewise, Pnuts code can easily manipulate Java objects. Pnuts code can even define Java classes. Because Pnuts compiles to Java byte codes, these classes can be used by Java just like any other class. A class written in Pnuts can even later be replaced by a class written in Java with no other code changes.

Pnuts syntax can look very similar to Java. The following is a code sample written in Java that is also a valid Pnuts script:

import java.util.ArrayList;
import java.util.List; 
List<String> countries = new ArrayList<String>(); 
for (String country : countries) 
	System.out.println("Hello " + country);

Alternatively, the expressiveness of Pnuts could be utilized:

use("pnuts.lib") // Standard module that makes sort, println and other functions available. 
countries = ["Canada", "Austria", "Brazil"] 
for (country : countries) println("Hello " + country)


Pnuts was originally developed in 1997 by Toyokazu Tomatsu as a testing tool for Java classes. Pnuts has since been extended, mainly focusing on essential functionality required for a Java-based scripting engine, such as a module system and bytecode compiler.

External links

Personal tools

Served in 0.546 secs.