HOME

TheInfoList



OR:

Judoscript is a general purpose
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
designed primarily for
scripting Script may refer to: Writing systems * Script, a distinctive writing system, based on a repertoire of specific elements or symbols, or that repertoire * Script (styles of handwriting) ** Script typeface, a typeface with characteristics of handw ...
tasks on the Java platform. It was conceived and developed by James Jianbo Huang (), starting in late 2001. Judoscript was one of the first so-called Java scripting languages; but its most striking characteristics is its audacious multi-domain support philosophy and practice. By the end of 2005, Judoscript has completed all the designated application features. The situation with Java scripting languages swiftly changed when
JavaSoft Sun Microsystems, Inc. (Sun for short) was an American technology company that sold computers, computer components, software, and information technology services and created the Java programming language, the Solaris operating system, ZFS, the ...
announced to create its own in 2003. Judoscript's development was stopped when JavaSoft's own
Groovy ''Groovy'' (or, less commonly, ''groovie'' or ''groovey'') is a slang colloquialism popular during the 1950s, '60s and '70s. It is roughly synonymous with words such as "excellent", "fashionable", or "amazing", depending on context. History The ...
language was close to be released.


History

Huang has worked on a commercial report writer,
SQR SQR (Hyperion SQR Production Reporting, Part of OBIEE) is a programming language designed for generating reports from database management systems. The name is an abbreviation of Structured Query Reporter, which suggests its relationship to SQL ...
, which is used extensively in PeopleSoft. Technically, SQR is an archane, general purpose scripting language with
embedded SQL Embedded SQL is a method of combining the computing power of a programming language and the database Data Manipulation Language, manipulation capabilities of SQL. Embedded SQL statement (programming), statements are SQL statements written inline wi ...
and reporting directives for producing character-based reports and data manipulation. Written in C, it is ported to almost all flavors of major operating systems, and works with all major
RDBMS A relational database is a (most commonly digital) database based on the relational model of data, as proposed by E. F. Codd in 1970. A system used to maintain relational databases is a relational database management system (RDBMS). Many relation ...
databases. With the advent of
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
and JDBC, Huang quickly realized that a single version of such software would eliminate the whole array of different ports of SQR. This was the seed of ''the Judoscript idea''. Even back in the late 1990s, embedded SQL was not a new idea; for instance,
Oracle An oracle is a person or agency considered to provide wise and insightful counsel or prophetic predictions, most notably including precognition of the future, inspired by deities. As such, it is a form of divination. Description The word '' ...
's
Pro*C Pro*C (also known as Pro*C/C++) is an embedded SQL programming language used by Oracle Database DBMSes. Pro*C uses either C or C++ as its host language. During compilation, the embedded SQL statements are interpreted by a precompiler In co ...
did just that. Remarkably, embedded SQL is indeed a domain-specific (
RDBMS A relational database is a (most commonly digital) database based on the relational model of data, as proposed by E. F. Codd in 1970. A system used to maintain relational databases is a relational database management system (RDBMS). Many relation ...
) feature built into a general purpose language. Regular expression in
Perl Perl is a family of two high-level, general-purpose, interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned "sister language", Perl 6, before the latter's name was offici ...
is another good example, in the domain of text handling. The ''vision'' of Judoscript started to take shape, to be ''a general purpose scripting language with declarative expressiveness for many popular programming domains in a coherent way.'' At the turn of the millennium, the
Internet The Internet (or internet) is the global system of interconnected computer networks that uses the Internet protocol suite (TCP/IP) to communicate between networks and devices. It is a '' network of networks'' that consists of private, pub ...
started to permeate our lives, and a growing number of key technologies were becoming widely adopted, therefore, choosing specific domains to support in Judoscript was not too hard a thing. In a way, this vision came about at the right time. The domain-specific features that were embodied in Judoscript's lifetime included JDBC scripting, SAX-style SGML and XML programming, WSDL scripting, Ant scripting, unified file system and archive scripting,
Microsoft Microsoft Corporation is an American multinational technology corporation producing computer software, consumer electronics, personal computers, and related services headquartered at the Microsoft Redmond campus located in Redmond, Washing ...
COM Com or COM may refer to: Computing * COM (hardware interface), a serial port interface on IBM PC-compatible computers * COM file, or .com file, short for "command", a file extension for an executable file in MS-DOS * .com, an Internet top-level d ...
scripting, running native OS executables, send mail, HTTP and SCP scripting, and last but not least, Java scripting. Had Judoscript continued to grow, it would foreseeably contain more and more domain-specific support as new technologies become prevalent, such as
NoSQL A NoSQL (originally referring to "non- SQL" or "non-relational") database provides a mechanism for storage and retrieval of data that is modeled in means other than the tabular relations used in relational databases. Such databases have existed ...
, AI, etc. Being a JVM-based scripting language, Judoscript has Java scripting as a first-class citizen. Judoscript has pioneered native Ant support, allowing users to tap into the vast pool of utilities in the Ant ecosystem. With native scripting capabilities with Java, Ant, WSDL, HTTP, and Microsoft's COM, Judoscript users can readily utilize resources from heterogeneous sources. The base language of Judoscript is very much
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
plus static class declaration. Like any scripting languages, Judoscript has various syntactic sugars, multi-line string literals, XML and regular expression literals, a versatile print statement, etc. However, while these aspects dominate the design of most other languages, general programmability is less significant a talking point compared to the language's key, unique characteristics. The initial outlook of Judoscript crystallized and development commenced in late 2001; the first version was released in November. Judoscript became one of the first general purpose scripting languages designed specifically for use with the Java platform, along with
Rhino A rhinoceros (; ; ), commonly abbreviated to rhino, is a member of any of the five extant species (or numerous extinct species) of odd-toed ungulates in the family Rhinocerotidae. (It can also refer to a member of any of the extinct species o ...
,
BeanShell BeanShell is a small, free, embeddable Java source interpreter with object scripting language features, written in Java. It runs in the Java Runtime Environment (JRE), dynamically executes standard Java syntax and extends it with common scripting c ...
,
Jython Jython is an implementation of the Python programming language designed to run on the Java platform. The implementation was formerly known as JPython until 1999. Overview Jython programs can import and use any Java class. Except for some standa ...
, and a few others. In 2004, Judoscript approached version 0.9. Development continued through 2005, where most of the final features were implemented. A key feature missing is the generation of Java bytecode either offline or at runtime, which was considered essential for such a language to reach version 1.0. For this matter, Huang has invented a Java macro assembly language,
Jamaica Jamaica (; ) is an island country situated in the Caribbean Sea. Spanning in area, it is the third-largest island of the Greater Antilles and the Caribbean (after Cuba and Hispaniola). Jamaica lies about south of Cuba, and west of His ...
. But this work for Judoscript was never achieved. In
JavaOne __NOTOC__ JavaOne is an annual conference first organized in 1996 by Sun Microsystems to discuss Java (programming language), Java technologies, primarily among Java developers. It was held in San Francisco, California, typically running from a M ...
2003, in June, JavaSoft announced its intention to create a wholly-owned scripting language for the Java platform. This monopolous move has stifled the lives of most of its competitors. The result was the Groovy language, whose name is apparently a phonetic morphing from "jruby", with its first version released in 2007. Its built-in Ant support is suspiciously connected to Judoscript's ''Ant scripting'' feature, chronologically speaking. When Groovy was about to be unleashed, Judoscript has lost impetus of moving forward. By the end of 2005, after a mere four years, Judoscript's development was stopped. Even so, Judoscript has remained dear to language designers and aficionados, and occupies a place in the
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
history, being the first and possibly the only general purpose language with so many native domain-specific features built-in. The reason for this will be delved further later.


Language design

The design of the Judoscript language blends two distinct flavors. First and foremost, it is a general purpose scripting language like any modern programming languages, using dynamic typing and dot notation for accessing object members. Supporting both procedural and object-oriented paradigms, it sports static class declaration and inheritance. Various syntactic sugars and a versatile print statement typify its scripting language nature. Judoscript is fully capable of scripting Java resources. Its static typing feature was introduced primarily for invoking overloaded Java methods. The second flavor, which distances Judoscript from the rest of the crowd, is its embodiment of a number of native domain-specific statements, each carrying a very different look. Some return a value, others not. Most of these special statements can be used as regular statements anywhere in the program. Expressions can be embedded in the domain-specific statements wherever appropriate. Expressions can also be embedded in textual literals like strings and XML values, effectively making them textual templates.


Language features I: a potent scripting language


The Base language

The Judoscript base language is almost identical to JavaScript for variable and constant declarations, flow control statements, and dot notation for accessing object members. In addition to the two C++-style comments, it has a third form, /? ?/, useful to disable a chunk of code. Function parameters can have default values, and invocation can take named parameter values. Like in JavaScript, functions are also objects and can be passed as values. Dynamic programming is available via the eval and evalExternal commands.


Object oriented programming

Unlike JavaScript, user-defined classes are declared statically, but the data members are dynamic. Multiple inheritance is supported, and programmers should handle potential diamond inheritance issues. Class instances can be transposed to another type. class Node


Code organization

Judoscript has a !include directive to include other scriptlets. This is the only mechanism to share code written in Judoscript. The lack of support for Java-like ''package'' or ''module'' in other languages is intentional, in order to discourage creating libraries written in Judoscript. Reusable libraries are encouraged to be written in Java, and let Judoscript (or any Java scripting languages) to use.


Language features II: Java scripting

Java scripting is a first-class citizen in Judoscript. Listed here are some of the most important Java scripting features. Refer to the documentation to see all the uses and examples.


Scripting Java Objects

a = new java::java.util.HashMap; a.put('date', Date(2001,1,1)); a.put('integer', 1); a.put('double', 10.01); a.put('string', 'Hello, World!'); a.put('Dimension', new java::java.awt.Dimension(10,20)); for k in a.keys() props = new java::Properties( a.b.c.d.e.f.g = 'a thru g', h.i.j.k.l.m.n = 'h thru n' ); println props;


Aliasing Java static methods

The capability to alias Java static methods as Judoscript functions is an important mechanism, responsible for many built-in functions. function prop for java::System.getProperty(); function now for java::System.currentTimeMillis(); function rt for java::Runtime.getRuntime(); println now(), nl; println prop('java.class.path'), nl; rt().gc();


Using Java classes as values

Java classes are also object values, and can be assigned to variables or constants. const #Types = java::java.sql.Types; fields = [ 'BIT', 'TINYINT', 'SMALLINT', 'INTEGER', 'BIGINT', 'FLOAT', 'REAL', 'DOUBLE', 'NUMERIC', 'DECIMAL', 'CHAR', 'VARCHAR', 'LONGVARCHAR', 'DATE', 'TIME', 'TIMESTAMP', 'BINARY', 'VARBINARY', 'LONGVARBINARY', 'NULL', 'OTHER', 'JAVA_OBJECT', 'DISTINCT', 'STRUCT', 'ARRAY', 'BLOB', 'CLOB', 'REF' ]; println 'JDBC types in Java ', sysProperty('java.version'), ':'; for fld in fields


Extending Java classes and implementing Java interfaces

It is possible to define Judoscript classes that extend Java classes or implement Java interfaces. class MyHashMap extends java::HashMap Anonymous Java interface adapters can be created and used. import java.awt.Frame; import java.awt.event.*; f = new java::Frame; f.addWindowListener( new java::WindowListener ); f.setVisible(true);


Language features III: special domain supports

This part of the language is what makes Judoscript unique. Each major domain support will be touched on briefly, usually with examples.


JDBC scripting

JDBC scripting is a central feature of Judoscript, as well as a key motivation for the language itself. It makes database operations intuitive and convenient. Below is an example that connects to database and runs some SQL statements. db::connect to 'jdbc:oracle:thin:@dbsvr:1521:dbname', 'user', 'pass'; if tableExists('EMP') db::sql println 'db::sql result: ', $_; disconnect(); Using stored procedures is through the db:any statement. db::any * CREATE PROCEDURE test_proc( param_io IN OUT NUMBER, param_i IN VARCHAR, param_o OUT VARCHAR) AS BEGIN param_o := param_i; IF param_io IS NOT NULL THEN param_io := param_io + 1; ELSE param_io := -1000; END IF; END; *; The more interesting usage is the parameterized queries and updates. Queries and updates can be run directly or preparedly. db::prepare ins: INSERT INTO emp( emp_no, first_name, last_name, birth_date, salary ) VALUES( :empNo, :firstName, :lastName, :birthDate, :salary ) ; for row in rows Below is a query example. db::query qry: SELECT emp_no, first_name, last_name, birth_date, salary FROM emp ; println 'ID First-Name Last-Name Salary Birth-Date', nl, '--- ---------- ----------- -------- ----------'; while qry.next()


SGML and XML document processing

SGML is the generic hypertext format that includes HTML and XML. There are two APIs for processing XML documents: Simple API for XML (or SAX), and Document Object Model (or DOM). SAX processing scans the whole text as a stream, and fires events for each encountered tag or text segment. Judoscript has a cute little statement that makes use of this feature effectively for XML and SGML data. The next example shows the essence of HTML scraping. With this, writing a web site crawler is not far from reality! do 'http://www.judoscript.org' as sgml The following example processes the XML data that is appended at the end of the script. do $$local as xml EndScript ------------------------------------------------------- UNIX in a Nutshell Daniel Gilly O'Reilly & Associates, Inc. 1-56592-001-5 1986-12 1992-06 Advanced Programming in the UNIX Environment Richard Stevens Addison-Wesley 0-201-56317-7 1993 1996-12 Judoscript also supports DOM and XSLT processing of XML documents.


Apache Ant scripting

Apache Ant has been ''the'' build system for Java for a long time; companies and developers have been creating many extensions called ''Task''s, in Ant parlance, and the Ant ecosystem becomes a treasure trove of all kinds of utilities, either general purpose or proprietary. Judoscript has included a mechanism to directly invoke any Ant tasks. Below is an example. a = 'ants'; anttask:: anttask::Hello, more $! There are ways to run native executables in Judoscript, but you can also resort to Ant scripting, as shown below. src = '.'; anttask::


Unified file system and archive scripting

File manipulation is one of the most common tasks for information workers. Judoscript strives to provide a consistent experience dealing with files in both file systems and archives such as ZIP files and TAR balls. The following examples inspects files in a ZIP archive.
listFiles '*' in 'awebapp.zip' dirOnly;
for x in $_ 
The next example copies files into a ZIP archive. By slightly changing the expressions, you can copy files to another location in the file system.
copy '*.java, *.properties' in 'C:/temp/classes/' recursive
     into 'judo.jar' store manifest
 *
  Manifest-Version: 1.0
  Main-Class: judo
  Created-By: James Jianbo Huang (c) 2001-(* #year *)
*
;
Another example for ZIP with finer control.
zf = createZip('~/archives/work-'+Date().fmtDate('yyyyMMdd')+'.zip');

copy '*' in 'c:/judo/src/' except '*/alfa*, */beta*, */save/*'
  recursive noHidden echo
  into zf under 'src/';

copy '*' in 'c:/judo/docs/' except '*/alfa*, */beta*, */save/*'
  recursive noHidden echo
  into zf under 'docs/';

copy '*' in 'c:/judo/examples/' except '*/alfa*, */beta*, */save/*'
  recursive noHidden echo
  into zf under 'examples/';

zf.close();
And you can copy internet resources to file systems or archives, shown below.
tar = createTar('yahoo_comp.tar.gz');
zip = createZip('yahoo_comp.zip');
urls = [
  'http://dir.yahoo.com/Computers_and_Internet/index.html',
  'http://dir.yahoo.com/Computers_and_Internet/Internet/index.html',
  'http://dir.yahoo.com/Computers_and_Internet/Internet/WAIS/index.html'
];
for u in urls 
tar.close();
zip.close();


SOAP web service scripting

In the times of Judoscript, the SOAP web service was the industry standard for remote invocations before the RESTful API emerged. Judoscript makes it easy to consume SOAP web services.
svc = wsdl::'http://coldrooster.com/dhtmldude/mathservice.asmx?WSDL';
println '3 + 2 = ', svc.Add(3, 2);
println '3 - 2 = ', svc.Subtract(3, 2);
println '3 * 2 = ', svc.Multiply(3, 2);
println '3 / 2 = ', svc.Divide(3, 2);


Other application features

Judoscript has all kinds of programming goodies to cover most of the everyday tasks for information workers, such as executing OS native executables, sending E-mails, running scheduled jobs, accessing internet resources via HTTP, SSH, SCP, launching your own HTTP server, etc. The Microsoft COM scripting capability opens door to the Microsoft Office documents, using their DOM to access and manipulate data therein, and integrate with other data stores and sources.


Implementation

The Judoscript language grammar and its parser are done with the JavaCC tool. Many a complicated domain-specific statement constitutes a sub-language of its own that warrants an embedded sub-parser. Other such statements and some syntactic sugars require native methods in the JavaCC grammar file. Because of these complexities, the parser directly produces the internal representation of the program, readily executable by the language engine. There are many supporting libraries included in the language runtime; some are from third parties, others are developed internally.


See also

* List of Java scripting languages * JavaCC *
Bean Scripting Framework The Bean Scripting Framework is a method of allowing the use of scripting in Java code. It provides a set of Java classes which provides support within Java applications for scripting languages, and also allows access to Java objects and methods. ...
* Apache Ant *
JSR223 Scripting for the Java Platform is a framework for embedding scripts into Java source code. There is no requirement for a given Java virtual machine (JVM) to include any engines by default, but the Oracle JVM (Java 6 and later) includes a JavaScr ...
*
Rhino A rhinoceros (; ; ), commonly abbreviated to rhino, is a member of any of the five extant species (or numerous extinct species) of odd-toed ungulates in the family Rhinocerotidae. (It can also refer to a member of any of the extinct species o ...
*
BeanShell BeanShell is a small, free, embeddable Java source interpreter with object scripting language features, written in Java. It runs in the Java Runtime Environment (JRE), dynamically executes standard Java syntax and extends it with common scripting c ...
*
Groovy ''Groovy'' (or, less commonly, ''groovie'' or ''groovey'') is a slang colloquialism popular during the 1950s, '60s and '70s. It is roughly synonymous with words such as "excellent", "fashionable", or "amazing", depending on context. History The ...
*
SQR SQR (Hyperion SQR Production Reporting, Part of OBIEE) is a programming language designed for generating reports from database management systems. The name is an abbreviation of Structured Query Reporter, which suggests its relationship to SQL ...
*
4GL A fourth-generation programming language (4GL) is any computer programming language that belongs to a class of languages envisioned as an advancement upon third-generation programming languages (3GL). Each of the programming language generations ai ...


References

{{reflist


External links


The Judoscript Museum

The reconstructed judoscript.com site

Judoscript Language on Sourceforge

JudoScript: Scripting for Java and Beyond


Scripting languages Domain-specific programming languages Object-oriented programming languages Java programming language family JVM programming languages Declarative programming Dynamically typed programming languages Statically typed programming languages Software using the LGPL license