lisa MANUAL


Copyright © 2002, Gabriele Budelacci <g.bude@eudoramail.com>

Language version 0.2.0
Manual version 0.0.3


NOTE:
This first version of manual is still incomplete and only in HTML format. It may be rewritten using XML DTD language, like PHP manual structure.

I'm searching translators for documentation, because I'm Italian and my english is very poor.


INDEX

Preface
  1. Introduction
  2. Language syntax
    1. Types
    2. Variables
    3. Functions
    4. Expressions
    5. Control Statements
    6. Comments
    7. Directives
  3. XML configuration
    1. Database setup
  4. Modules
    1. The standard module std
      1. Language support functions
      2. Document functions
    2. The database module dbsupport
  5. Examples / Tutorials

PREFACE

Copyright © 2002 Gabriele Budelacci <
g.bude@eudoramail.com>

This manual is free documentation; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free software Foundation; either version 2 of the license, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License for more details. You can obtain a copy of the GNU General Public License by writing to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

If you use this software in a commercial distribution, it would be nice to send the authors a complimentary copy of your product.


INTRODUCTION

lisa (LIght Scripts Assistant) is an easy web language with C-like syntax, used for simplified scripts generation.
lisa provide several abstraction layers:

Why lisa?

It's there enough space for a new web language? I think yes!
lisa doesn't support any data structure, class or object. It's a SIMPLIFIED web language for all the small things of everyday.
lisa can be compiled to asp™, jsp™ and php™ sources (by now, only php generation is active). So, you may develop your application and test it with your preferred language and, when completed, convert it in the language supported by your internet provider.
Probably, if you are an advanced web programmer, lisa may be too limited for you. It's a basic language for beginners.


LANGUAGE SYNTAX

lisa is a C-like syntax variable, with few changes to optimize code development.
It's a CASE INSENSITIVE language, so elements called 'ABC' or 'abc' (or 'aBc', etc) are effectivelly the same element.
Guidelines for standard scripts are:

Types


lisa support three standard types:

Variables


Variable names that ends with '_' are RESERVED for language optimizations.

All variables have a scope. A variable is valid in the block whithin is declared:
Example:
	// this variable is visible globally in the page:
	var a;
	
	if ( ... )
	{
		// this variable is visible only in this block:
		var b;
		// 'a' variable is more visible...
	}

	// 'b' variable is no more visible...
	
Any variable is destroyed at the end of the page.
If you want preserve a variable in all your web application, then you can declare it global:
Example:
	// this variable is valid globally in all the pages of your project:
	global var a;
	
Only variant variables can be declared globals.
Global variables, when declared, can't be redeclared.

Special variables are parameters:
Example:
	// this is a parameter:
	parameter var x;
	
Parameters are defined in anoter page and passed to your page via a POST or GET FORM.
Only variant variables can be declared as parameters.
It is guarantee that if a parameter is not defined, then his value is set to empty value.


Functions


Function names that starts with '_' are RESERVED for language optimizations.

Funtions are declared with the function keyword:
function funcName( arg1, arg2, ... )
{
function code
return value;
}
You can't declare a function inner another.

A function can return a value, via the return keyword.
By default, and if no return value is specified, a function will return an EMPTY value.

Alternative syntax for arithmetic function declaration is:
function funcName( arg1, arg2, ... ) is expression;


Expressions


Expressions may use the following operators:


Control Statements




Comments


Comments presents Java-like syntax:
Example:
	// this is a single line comment

	/*
		this is a multi line comment...
		...............................
	*/
	
Comments aren't passed to the compiled file.


Directives


There are two types of directives:

The first type of directives are evaluated at compile time.
This is the standard of a directive in all the other languages.

The directives are:
#self
Represent the complete name of the page (with extension) is compiling.


#asp
...asp code...
#/asp
To include ASP source code directly in your pages.
The block of code is compiled only if you are in ASP compile mode.
NOT SUPPORTED YET!

#jsp
...jsp code...
#/jsp
To include JSP source code directly in your pages.
The block of code is compiled only if you are in JSP compile mode.
NOT SUPPORTED YET!

#php
...php code...
#/php
To include PHP source code directly in your pages.
The block of code is compiled only if you are in PHP compile mode.



The special directives are:
#include "filename"
This a Server Side Include directive.
The filename MUST be a string value (can't be a variable).
Note that the other file isn't compiled while including, but must be compiled separately.

A special syntax for module inclusion is:
#include <modulename>
The modulename MUST be a fixed value (can't be a variable) WITHOUT any extension. The extension will be added later by the lisa compiler.
Note that the other file isn't compiled while including, but must be compiled separately.




XML CONFIGURATION

The lisa compiler may configured with a standard XML file called 'config.xml'.
By now, the config.xml file describe the database parameters.
You can found an example configuration file in the lisa archive.

WARNING
Some informations presents in the config.xml file (like dsn, username and password, etc...) may be very important for your site.
The config.xml file may NOT be present in your product site, but only in your dev-machine.


Database setup


<db-dsn> data source name </db-dsn>
This is the database dsn.
<db-host> host name </db-host>
This is the database server hostname. You can specify the full URL name or the static IP address.
Leaving this field blank will automatically set the IP number 127.0.0.1 (localhost).
<db-name> database name </db-name>
This is the database name. This field is obligatory.
<db-password> password </db-password>
This is the password used connecting to database.
<db-port> port number </db-port>
This is the database port whitch the server is waiting connections.
Leaving this field blank will automatically set the default port for the specified database type.
<db-type> database type </db-type>
This is the database server type you're using. Just enter any of the follow types:
mySql
<db-username> username </db-username>
This is the username used connecting to database.

<jdbc> see the follow tags </jdbc>
This block contains the JDBC control tags.
<jdbc-driver> driver name </jdbc-driver>
This is the class name of the JDBC driver.
<jdbc-string> connection string </jdbc-string>
This is the connection string used by the JDBC driver connecting to database.



MODULES

You can create a function library for simplify the managing of your applications. This library is called module. Creating modules is very simple, just call the lisa compiler like the following example:
lisac --module --php modulename.lisa
As you can see, the --module option (or -m in short form) is the way to inform the compiler that you want generate a module, nor the file generated is standard.
The module generated can be used in your applications by the #include directive:
#include <modulename>
Note that the modulename is specified WITHOUT any extension.

IMPORTANT

You're be warned to prevent recursive module inclusions: the Web Server may generate some errors.


The standard module std


The std module is automatically included in every standard page you create.
You must compile the std.lisa file as a module and place the result in the same directory of your deployed application.

There are some useful functions for your applications:


Language support functions


number = arrSize( array )
This function return the number of items contained in an array.


Document functions


echo( string )
This function will write the message contained in the string to the generated HTML document.


The database module dbsupport


The dbsupport module is automatically included in every standard page you create, when a database engine is specified via config.xml.
This module is automatically created by the compiler, you must only place the result in the same directory of your deployed application.

Now follow an explanation of all the public functions provided by this module:

boolean = dbEmpty( set )
This is a boolean function. It will return a true value if the set contains no data.

set = dbQuery( string )
This function will execute a query (contained into string) on the specified database. It will return a set of the results.
This function will block if an error is occured while the query execution.

dbSql( string )
This function is similar to dbQuery, but no values will be returned. This can be useful for SQL update statements, like 'INSERT' or 'UPDATE'.



EXAMPLES / TUTORIALS

Example 1: Simple access to a database table.