Back to Java Users Group Home Print this page

Java Users Group

February 2008 Meeting Information

February 12, 2008
Technical Overview of iScript

As we celebrate our 7-year anniversary this month, Manny Goyenechea will introduce his own personal scripting language called iScript, an open source object-oriented scripting language written in Java that mixes the best of JavaScript, Basic Script, Ruby, Groovy, PHP, Python, Perl and other scripting languages in rich new ways.

		<title>Simple Entry Form</title>

	name = request.getParameter("name")
	if name = null then
		oldvalue = request.getParameter("oldvalue")
	if oldvalue = null then
		oldvalue = ""
	Please enter your name<br>
	<form action="./simpleform.isp" method="get">
		<input type="text" name="name" value="<%= oldvalue %>"><br>
		<input type="submit" value="Submit">
		<input type="reset" value="Reset">

	<% elseif name = "" then %>
		<h1>Please enter your name</h1><br>
		[ <a href="./simpleform.isp?oldvalue=<%= name %>">try again</a> ]
	<% else %>
		<h1>Hello <% =name %></h1><br>
		[ <a href="./simpleform.isp?oldvalue=<%= name %>">try again</a> ]
	<% end %>
iScript is also a general purpose markup language and/or preprocessor that can be used as a powerful source code generator, application generator, and data-access-layer (DAL) generator for any language and database using just simple templates and scripts that have full, seamless access to the Java APIs and data types. iScript, when combined with a Servlet engine like Tomcat, can be used like Java Server Pages (JSP) to dynamically generate HTML pages from simple templates and script files. iScript is also a general purpose scripting language that can be used with iBuild, an open source development environment, iPP, an open source preprocessor, and iMake, an open source make processor, and to rapidly prototype compelling solutions. The following example generates XML from a database. Notice which tags are used and can be dynamically changed, as needed, so in this example #* *# is used for meta tags instead of the default <% %> meta tags, but any other start/send character sequence can be used as well.

import java.sql.DriverManager

	ConnectionString = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=/dev.stec/stec/iScript/templates/sp/databases/sample.mdb"
	Query = "select * from employees"
	connection = DriverManager.getConnection(ConnectionString)

	statement = connection.createStatement()

	resultSet = statement.executeQuery("select * from employees")

	metaData = resultSet.getMetaData();
	columnCount = metaData.getColumnCount()

	#* while *#
			#* for columnIndex = 1 to columnCount *#
			#* next *#
	#* loop *#

The current development has it effortlessly supporting a myriad of computer programming language syntax and formatting styles. So it handles this:

	if (i < 0)
		return -i;
		return i;
as easy as this:

function abs(i)
	if i < 0 then
		return -i
		return i
	end if
end function
or any combination of a myriad of syntax and formatting styles from a growing list of scripting languages without it even raising a blink of an eye. One of the goals is to regardless of whether ones background is FORTRAN, BASIC, C, C++, Java, C#, Ruby, Groovy, Python, PHP, JavaScript, VBScript or some other scripting or programming language you will feel comfortable and at home and be productive without having to re-learn everything. From day one, a developer can start with the syntax and formatting style they are comfortable using and expand from there. Future development in iScript may see it used as a general purpose batch language or even supporting keywords and syntax of a number of human languages. So the above could have been written in Spanish as this:

funci�n abs(n�mero)
	si n�mero < 0 entonces
		vuelta -n�mero
	si no
		vuelta n�mero
	acaba si
acaba funci�n
or any other spoken or written language.

Meetings are held every second Tuesday of the month at the Scotch Plains Rescue Squad second floor meeting hall starting promptly at 7:30pm. Meetings are open to the public, and visitors are encouraged to join ACGNJ.

SIG Leader Mike Redlich
Phone: (908) 246-0410