# MIVA Script

Miva Script is a proprietary computer scripting language mainly used for internet applications such as e-commerce. As of 2015, it is developed, maintained and owned by Miva Merchant, Inc., based in San Diego, California. Many web hosting companies support Miva Script on their servers, but it is significantly less widespread than other popular web languages.

## History

The language was first developed under the name HTMLScript by Joe Austin and others in 1995, and a company, HTMLScript Corporation, was formed the following year.
The origins of Miva Script began in 1993 when David Haldy and Joseph Austin built the first version of HTMLScript. The first version was written in the programming language Perl, which was called Logic Enhanced HTML (LEHTML). Joseph Austin wrote a wrapper for it in the programming language C that let it start off as a root process and then downgrade itself immediately to the ownership and permissions of the owner of the script file. This wrapper made it suitable for use with his hosting service which was called Volant Turnpike at the time. Joseph Austin eventually sold Volant Turnpike to Dave Haldy. Perl allowed self-executing code, so LEHTML did not have its own expression analyzer and just parsed the expression into Perl syntax and then passed it into Perl. Volant Turnpike users liked using LEHTML, so Joseph Austin and Ron Ahern wrote an expression analyzer and re-implemented the LEHTML syntax in the C language. Joseph Austin called the result HTMLScript and registered the name with the United States Patent and Trademark Office (USPTO). Joseph Austin, Troy McCasland and Derek Finley were the founders of the company called HTMLScript Corporation.
HTMLScript did not have the concept of a "WHILE" or "FOR" loop because of the low server processing power at the time. It would be enough to bring the whole server down if even one program ran away. So, Joseph Austin did not implement a loop to make it impossible for an HTMLScript server process to run away. Also, he implemented the macro in the first version of HTMLScript so it would allow self-executing code. The macro was powerful, but it eventually had some security issues.
In 1997, Jon Burchmore extensively rewrote the language to make it more syntactically consistent, although the new engine supported both old HTMLScript and new (named mivascript) syntaxes. Jon Burchmore rewrote HTMLScript with syntax that Joe developed with the help of SoftQuad, using the emerging XML standard. Jon Burchmore wrote the replacement for KoolKat which then became Miva Merchant. The new end-product supported both the old HTMLScript syntax and new (named Miva Script) syntaxes.
On October 14, 1997, HTMLScript’s name was changed to Miva Script and the company name was changed to Miva. Soon afterward, Miva Merchant followed suit for the name of the product. The name Miva comes from the Egyptian hieroglyphics for the word cat. The word for cat is a combination of two symbols: milk basin followed by a quail. The milk basin is pronounced mee and the quail is pronounced waa which are combined to say cat. Joseph Austin thought this was clever, as they had called KoolKat “an electronic (cat)alog.” Joseph showed it to a German friend who could not pronounce the waa sound and instead kept on pronouncing it as va. Joseph Austin registered the domain Miva.com and filed the trademark.
In 1998, the firm was renamed Miva Corporation. In 1998, the first version of Miva Merchant came out. In 2002, the Miva Script compiler was delivered, and the HTMLScript syntax and macros were dropped from the engine. Miva Corporation was sold in 2003 to a mid-cap, public company called FindWhat. Subsequently, FindWhat bought the name Miva.
In 2007, Russell Carroll and a group of investors bought the original Miva technologies and customer base from Miva and started Miva Merchant, Inc.

## Language features

Miva Script is often described as 'XML-like' although this is something of a misnomer. It consists of tags which may be interspersed with HTML and XHTML and which all start with <Mv. There are both paired and stand-alone (empty) tags. Before version 4.14, Miva Script was interpreted by the Miva Script engine, Empresa. Version 4.00 introduced a compiler, boosting performance significantly.
One of the distinguishing features of Miva Script is the native support for a variation of dBase database platform (DBF III) tables with a proprietary index format and support for SQL. Many installations today are running with MySQL database.
Variables are untyped and are not pre-declared. Miva Script uses the file extensions .mv, .mvc, and .mvt which is the common file extension for runtime compiled template source files.

## Implementations
### Miva Merchant Empresa

Empresa is the underlying engine for Miva Script. In versions numbered less than 4.0, Miva Merchant Empresa is a script interpreter available for web servers running *nix and Microsoft Windows operating systems. The most recent interpreter version is 3.9705. Interpreted Miva Script is still widely supported by many web hosts. Versions numbered 3.9x are a transitional form of the language, implementing some (but not all) of the new features found in version 4, such as arrays.
Since 4.0, Miva Merchant Empresa is a Virtual Machine for running compiled Miva Script, again available in versions for *nix and Microsoft Windows.
The current version level 5.x added new language constructs, native SQL support, a new access-methodology for dbase3 tables, called MIVA-SQL, and a new templating syntax that the Empresa virtual machine can compile on the fly. Version 5.08 and later support the GD Graphics Library.

### Miva Merchant Mia

Miva Merchant Mia is a version of the Empresa engine designed to run on a Windows PC as a localhost server watching a specified port, usually 8000 or 8080. No other server software is needed unless the Post Office Protocol (POP) and SMTP functions are used. This provides a portable, stand-alone development environment.
Miva Merchant Mia is updated with each Miva Merchant Empresa release. Like Empressa, versions pre-4 are interpreters while post-4.0 work only with compiled script. There are a few minor differences between.

### Miva Merchant Script Compiler -- Miva Script

Miva Merchant Script Compiler was introduced in mid-2002, claiming to offer better performance and the closure of application source code. Compilability required some changes to the language, with support for the old HTMLScript syntax and macros evaluated at runtime (often considered a security risk) dropped. The compiler produces a platform-independent bytecode which runs on the Miva Merchant Empresa and Miva Merchant Mia Virtual Machines Minor variations exist between Empresa and Mia virtual machines.
In May 2005, MIVA Corporation made the Script Compiler available free. In 2011, the built in licensing code was removed simplifying installation.
In August 2007, Miva Merchant was separated from its parent company due to a management buy-out.
Miva Script 5.0 Introduced the a page template compiler command which is the basis for Miva Merchant Storemorph&trade; page template system. This compiler within a compiler offers a simplified subset of the full language, more suitable for end user creation and editing of web page templates. Storemorph&trade; pages allow modular components created in MivaScript, to be added to a template extending its capabilities.