/ Language

Language Comparisons

Following is a feature comparison of various languages with Jsi.

Feature Jsi NodeJs Tcl Lua Perl Python
Standard ES 5.2+ ES 6+
Implemention C/C++ C++ C C/C++ C C
C++ Compatible
Non-Script API
Type Checking
Error Navigation
Builtin Debugger
Debugger GUI
Web Ready
Modular Apps
Shrink Wrap
Self Configure

These comparisons are of software out-of-the-box.

Note: as of version 5.3.4, Lua also supports native C++.



Jsi and Node-JS are javascript implementations, and so use the Ecmascript standard (at least as a starting point).

The other languages, seem to have just sort of evolved.

The advantage of using a standard are:

  • All languages have idiosyncracies.
  • However, users will find a "standard" language easier to learn.
  • Language implementation is hard.
  • But language design is even harder.

Jsi has a further advantage in that it's internal design is based on Tcl. This means that there was just far less design involved, and more building on the shoulders of giants.


All the compared languages can be embedded in a C application, except for Node-Js: it is C++, and is limited loading extensions.

There is a difference in the degree of difficulty involved in embedding each. Perl, and perhaps Python Most require linking against an external libraries, and often involve dealing with dependancies.

By contrast, Jsi was written from the ground-up to be C embeddable. It provides a single amalgamated source file for quick and easy embedding.


To be standalone, a language should be easy to statically link.

The jsish binary can be built within libmusl, sqlite and libwebsockets to provide a completely self contained executable. Applications can also include jsi.c directly to build in Jsi support atomically.

See Standalone.

Modular Apps

Jsi supports modules. But it can also execute applications directly from a .zip file.

See Zvfs.

Shrink Wrap

But there's more. Script files used by Jsi are appended to a zip at the end of the executable. This is mounted as a Zip filesystem at runtime. In addition, user scripts can be merged with these to convert jsish into a shrink-wrapped application.

Type Checking

The Javascript language does not provide type checking. Jsi however, supports typechecking function arguments.

See Functions.


A sub-interpreter can be used to run scripts in seperate environment and/or threads. Uses include sandboxing, debugging and multi-tasking.

See Interps.

Error Navigation

Error navigation refers to the error message format being compatible with gcc. This allows scripts to be run from editors such as geany and vi, and seamlessly navigate through errors and warnings.

See Errors.


The logging facilitity in Jsi allows output messages, often including the file, line and function of the current line. More importantly, these inclue logDebug and logTrace that output such messages only when debugging is enabled.

See Logging.

Debug Console

Jsi provides a builtin console debugger, invoked with jsish -d SCRIPT.

See debugger.

Debugger GUI

Jsi also provides a web based interface debugger, which is a lot easier to navigate around in that the console.

This is invoked with jsish -D SCRIPT.

Web Ready

Jsi comes with builtin support for:

  • Websocket and database
  • Html, Javascript and CSS preprocessing
  • Wiki markup

Example Applications

Aside from the builtin applications for the debugger and sqlite, Jsi comes with the external app Ledger.

See Examples.

Self Configure

Most unix software relies on '''autoconf''' for configuring the application prior to building. In Jsi, a minimial version Jsi is built first so it can self-configure.

C++ Compatible

Jsi is written in C+/-. It compiles as C, and as native C++ (without use of extern C). This means that Jsi source code is subjected to more stringent checking.

One advantage of this is the detection of missing enum cases in a switch statements, as in the follow:

switch (code) {
    case CODE_A: break;
    case CODE_B: break;
#ifdef __cplusplus
    case CODE_NONE:
    Jsi_LogBug("invalid code %d", code);
    return JSI_ERROR;


That is, we employ a default label when compiled with C, but not when compiled with C++ so as to warn of missing cases.

Thus, even if we don't intend to use C++, we can employ it for something useful. That said, extensions can (if desire) directly access C++ constructs.


All code written in C has by definition some form of C API.

But Jsi was modelled internally after Tcl, which has a very mature and well developed C API.


A Jsi-Lite, a subset of the Jsi C-API that is available for use by C programs that require no scripting.

This includes string processing, Hash, Tree and an Sqlite C-API.

See Jsi-Lite.


Implementation refers the language the source code is written in. Jsi is unique in that although it is written in C99, it will compile with

make CC=g++.

Using C++ provides a higher level of checking than provided by C, but requires a more rigourous coding style.


The following syntax is implemented by Jsi (see Reference for commands):
continue [IDENT] ;
break [IDENT] ;
debugger ;
delete IDENT ;
do { STMTS; } while( EXPR ) ;
for ([var] IDENT = EXPR; EXPR; EXPR) { STMTS; }
for ([var] IDENT in EXPR) { STMTS; }
for ([var] IDENT of EXPR) { STMTS; }
function [IDENT] ([IDENT, IDENT, ...]) { STMTS; }
if (EXPR) { STMTS; } [ else { STMTS; } ]
IDENT instanceof IDENT ;
[new] FUNC( ARGS ) ;
return [EXPR] ;
switch (EXPR) { case EXPR: STMTS; [break;] case EXPR: STMTS; [break;]  ... [default EXPR;] }
throw EXPR ;
try { EXPR; } catch(IDENT) { STMTS; } [finally { STMTS; }]
typeof EXPR ;
var IDENT [ = EXPR ] [, ...] ;
with ( EXPR ) { STMTS; }
  • Square brackets indicate optional.
  • Curley braces are just for illustrative purposes and except for function and switch are not required.


Expressions take the usual form:
STMTS , STMTS [, ...]

where OP is one of the binary operators +, -, *, /, etc.


ARGSZero or more comma-seperated arguments
EXPR An expression (see below)
FUNCA function value
IDENT Is an valid identifier
PRIMITIVE A primitive value acceptable as an argument type.
STMTS Is zero or more statements
TYPEA type value acceptable as defaults


Keywords can be displayed using Info.keywords():
  "...", "any", "arguments", "array", "boolean", "break", "case", "catch", 
  "continue", "debugger", "default", "delete", "do", "else", "false", 
  "finally", "for", "function", "if", "in", "instanceof", "new", "null", 
  "number", "object", "of", "regexp", "return", "string", "switch", 
  "this", "throw", "true", "try", "typeof", "undefined", "userobj", "var", 
  "void", "while", "with"