Meet JSON's functional half-brother.

A Single-source-of-truth (SSOT) for keeping business logic up to date and giving the same results on different codebases (e.g. front & backend).

I built JSOL because I didn't want to keep maintaining the same rules twice (once for the server, once again for the browser) on IPAX, a color science framework for accessible design systems. Every change meant updating both, testing both, and hoping they still agreed.

Did you know that something as simple as modulo can give you different results across languages? My LLM didn't. And that's just one bug that slipped through code review.


The ugliest common denominator

Since most general-use languages today are somehow C-like, I wondered if there was some lingua franca we could use to declare business logic once, and include afterwards in our code with bit-for-bit parity.

That's how JSOL was born: a strict subset of JavaScript that transpiles to JavaScript, PHP, TypeScript and Python (with more targets planned), guaranteeing deterministic parity. Write the rule once, change it once, test it once.

Think JSON, but for business logic. Also, think dumb and ugly: the foundation was to find an economical point where C-like languages "naturally" meet, to the point an AST was not even needed. That lowest common denominator is usually PHP.

Case JS PHP Python
7.5 % 2 1.5 1 1.5
Math.round(2.5) 3 3 2
Math.round(-2.5) -2 -3 -2
"😀".length 2 4 1
String(true) true 1 True
"12abc" as int 12 12 ValueError
"12abc" as int 12 12 ValueError
"10" < "9" true false true
[10, 1, 2].sort() 1, 10, 2 1, 2, 10 1, 2, 10
"abc".split("") a,b,c a,b,c ValueError
"a" || "b" a true a
min(NaN, 5) NaN 5 nan
[].pop() undefined null IndexError
"" as number 0 0 ValueError

Every language behaves slightly differently. When maintaining business rules across several of them, it's a disaster waiting to happen. JSOL is being developed to give the same canonical answer on every target, considering more than 140 semantic differences to sort out.


Is it worth your time?

The first question we developers ask about a new tool is: "Should I bother learning this?"

JSOL has strict syntax, zero syntactic sugar, and a learning curve. Writing it — even with an AI's help — will take you longer than writing native code you've already mastered. But JSOL's upfront cost can pay off in iterative maintenance.

The honest way to answer that question is with a model. So the first example below is exactly that: an adoption-economics model written in JSOL, running live in the REPL. And compiled to every target for inspection.

Play with the inputs: how many targets you maintain, how often your rules change, how many iterations until the upfront cost pays for itself. Add rows to evaluate different scenarios. And while you're at it, you're watching JSOL do what it was built to do.

JSOL Mascot
JSOL's mascot: the Sun of May wearing Jason's mask.
📊 JSOL Spreadsheet REPL — v0.2.97

Function: $sValidateSpec030

// @JSOL v0.2.97

/**
 @description
 # JSOL Spec 0.3.0 Full Validation Suite
 
 Valida la completitud de la implementación de la especificación 0.3.0 en la 
 versión de transición 0.2.97. 
 
 Prueba de forma isomórfica:
 1. Dominio Math (Criterio Excel, operaciones variádicas).
 2. Dominio Bool (Operaciones lógicas variádicas).
 3. Dominio Str & Arr (Manejo de colecciones).
 4. Canal de Sombras (Validación de fallos out-of-band sin romper el runtime).

 @param {string} $sDomain - El dominio o feature a testear.
 @returns {string} - El código de resultado o error detectado en el Shadow Channel.
*/

/**
 @contract
 {
   "cases": [
     { "in": { "$sDomain": "math_excel" }, "expect": { "_result": "OK" } },
     { "in": { "$sDomain": "bool_variadic" }, "expect": { "_result": "OK" } },
     { "in": { "$sDomain": "shadow_divide_by_zero" }, "expect": { "_result": "DIVIDE_BY_ZERO" } },
     { "in": { "$sDomain": "shadow_parse_error" }, "expect": { "_result": "PARSE_ERROR" } },
     { "in": { "$sDomain": "shadow_not_found" }, "expect": { "_result": "NOT_FOUND" } },
     { "in": { "$sDomain": "shadow_empty_array" }, "expect": { "_result": "EMPTY_ARRAY" } },
     { "in": { "$sDomain": "shadow_key_not_found" }, "expect": { "_result": "KEY_NOT_FOUND" } }
   ]
 }
*/

const $sValidateSpec030 = function($sDomain) {

    // 1. CRITERIO EXCEL & MATEMÁTICA VARIÁDICA
    if ($sDomain === "math_excel") {
        // modX: Signo sigue al divisor (Excel)
        if (Math.modX(-10, 3) !== 2) { return "FAIL_MODX_1"; }
        if (Math.modX(10, -3) !== -2) { return "FAIL_MODX_2"; }
        
        // roundX: Half away from zero (Excel)
        if (Math.roundX(1.5) !== 2) { return "FAIL_ROUNDX_1"; }
        if (Math.roundX(-1.5) !== -2) { return "FAIL_ROUNDX_2"; }
        
        // Variadic Math
        if (Math.sum(10, 20, 5) !== 35) { return "FAIL_SUM"; }
        if (Math.sub(100, 20, 5) !== 75) { return "FAIL_SUB"; } // (100 - 20) - 5
        if (Math.mul(2, 3, 4) !== 24) { return "FAIL_MUL"; }
        if (Math.div(100, 2, 5) !== 10) { return "FAIL_DIV"; } // (100 / 2) / 5
        
        return "OK";
    }

    // 2. LÓGICA BOOLEANA VARIÁDICA
    if ($sDomain === "bool_variadic") {
        let $bT = true;
        let $bF = false;

        if (Bool.and($bT, $bT, $bT) !== true) { return "FAIL_AND"; }
        if (Bool.or($bF, $bF, $bT) !== true) { return "FAIL_OR"; }
        // XOR: Paridad impar (3 verdades = true)
        if (Bool.xor($bT, $bT, $bT) !== true) { return "FAIL_XOR"; }
        if (Bool.not($bF) !== true) { return "FAIL_NOT"; }
        
        return "OK";
    }

    // 3. CANAL DE SOMBRAS (SHADOW CHANNEL OUT-OF-BAND TESTING)
    if ($sDomain === "shadow_divide_by_zero") {
        JSOL.resetShadow();
        let $nResult = Math.div(100, 0, 5); // Falla en el primer divisor
        if (JSOL.ok() === false) { return "DIVIDE_BY_ZERO"; }
        return "FAIL";
    }

    if ($sDomain === "shadow_parse_error") {
        JSOL.resetShadow();
        let $nResult = Cast.toInt("basura_no_numerica");
        if (JSOL.ok() === false) { return "PARSE_ERROR"; }
        return "FAIL";
    }

    if ($sDomain === "shadow_not_found") {
        JSOL.resetShadow();
        let $iPos = Str.indexOf("hello world", "xyz");
        if (JSOL.ok() === false) { return "NOT_FOUND"; }
        return "FAIL";
    }

    if ($sDomain === "shadow_empty_array") {
        JSOL.resetShadow();
        let $aEmpty = [];
        let $val = Arr.pop($aEmpty);
        if (JSOL.ok() === false) { return "EMPTY_ARRAY"; }
        return "FAIL";
    }

    if ($sDomain === "shadow_key_not_found") {
        JSOL.resetShadow();
        let $mDict = Map.create("clave", "valor");
        let $val = Map.get($mDict, "clave_inexistente");
        if (JSOL.ok() === false) { return "KEY_NOT_FOUND"; }
        return "FAIL";
    }

    return "UNKNOWN_DOMAIN";
};
// @JSOL v0.2.97

/**
 @description
 # JSOL Spec 0.3.0 Full Validation Suite
 
 Valida la completitud de la implementación de la especificación 0.3.0 en la 
 versión de transición 0.2.97. 
 
 Prueba de forma isomórfica:
 1. Dominio Math (Criterio Excel, operaciones variádicas).
 2. Dominio Bool (Operaciones lógicas variádicas).
 3. Dominio Str & Arr (Manejo de colecciones).
 4. Canal de Sombras (Validación de fallos out-of-band sin romper el runtime).

 @param {string} $sDomain - El dominio o feature a testear.
 @returns {string} - El código de resultado o error detectado en el Shadow Channel.
*/

/**
 @contract
 {
   "cases": [
     { "in": { "$sDomain": "math_excel" }, "expect": { "_result": "OK" } },
     { "in": { "$sDomain": "bool_variadic" }, "expect": { "_result": "OK" } },
     { "in": { "$sDomain": "shadow_divide_by_zero" }, "expect": { "_result": "DIVIDE_BY_ZERO" } },
     { "in": { "$sDomain": "shadow_parse_error" }, "expect": { "_result": "PARSE_ERROR" } },
     { "in": { "$sDomain": "shadow_not_found" }, "expect": { "_result": "NOT_FOUND" } },
     { "in": { "$sDomain": "shadow_empty_array" }, "expect": { "_result": "EMPTY_ARRAY" } },
     { "in": { "$sDomain": "shadow_key_not_found" }, "expect": { "_result": "KEY_NOT_FOUND" } }
   ]
 }
*/

const $sValidateSpec030 = function($sDomain) {
  // 1. CRITERIO EXCEL & MATEMÁTICA VARIÁDICA
    if ($sDomain === "math_excel") {
    // modX: Signo sigue al divisor (Excel)
        if (Math["modX"](-10,  3) !== 2) {
      return "FAIL_MODX_1";
    }
    if (Math["modX"](10,  -3) !== -2) {
      return "FAIL_MODX_2";
    }
    // roundX: Half away from zero (Excel)
        if (Math["roundX"](1.5) !== 2) {
      return "FAIL_ROUNDX_1";
    }
    if (Math["roundX"](-1.5) !== -2) {
      return "FAIL_ROUNDX_2";
    }
    // Variadic Math
        if (Math["sum"](10,  20,  5) !== 35) {
      return "FAIL_SUM";
    }
    if (Math["sub"](100,  20,  5) !== 75) {
      return "FAIL_SUB";
    }
    // (100 - 20) - 5
        if (Math["mul"](2,  3,  4) !== 24) {
      return "FAIL_MUL";
    }
    if (Math["div"](100,  2,  5) !== 10) {
      return "FAIL_DIV";
    }
    // (100 / 2) / 5
        
        return "OK";
  }
  // 2. LÓGICA BOOLEANA VARIÁDICA
    if ($sDomain === "bool_variadic") {
    let $bT = true;
        let $bF = false;

        if (Bool["and"]($bT,  $bT,  $bT) !== true) {
      return "FAIL_AND";
    }
    if (Bool["or"]($bF,  $bF,  $bT) !== true) {
      return "FAIL_OR";
    }
    // XOR: Paridad impar (3 verdades = true)
        if (Bool["xor"]($bT,  $bT,  $bT) !== true) {
      return "FAIL_XOR";
    }
    if ((!$bF) !== true) {
      return "FAIL_NOT";
    }
    return "OK";
  }
  // 3. CANAL DE SOMBRAS (SHADOW CHANNEL OUT-OF-BAND TESTING)
    if ($sDomain === "shadow_divide_by_zero") {
    JSOL["resetShadow"]();
        let $nResult = Math["div"](100,  0,  5); // Falla en el primer divisor
        if (JSOL["ok"]() === false) {
      return "DIVIDE_BY_ZERO";
    }
    return "FAIL";
  }
  if ($sDomain === "shadow_parse_error") {
    JSOL["resetShadow"]();
        let $nResult = Cast["toInt"]("basura_no_numerica");
        if (JSOL["ok"]() === false) {
      return "PARSE_ERROR";
    }
    return "FAIL";
  }
  if ($sDomain === "shadow_not_found") {
    JSOL["resetShadow"]();
        let $iPos = Str["indexOf"]("hello world",  "xyz");
        if (JSOL["ok"]() === false) {
      return "NOT_FOUND";
    }
    return "FAIL";
  }
  if ($sDomain === "shadow_empty_array") {
    JSOL["resetShadow"]();
        let $aEmpty = [];
        let $val = Arr["pop"]($aEmpty);
        if (JSOL["ok"]() === false) {
      return "EMPTY_ARRAY";
    }
    return "FAIL";
  }
  if ($sDomain === "shadow_key_not_found") {
    JSOL["resetShadow"]();
        let $mDict = JSOL.dict("clave",  "valor");
        let $val = Map["get"]($mDict,  "clave_inexistente");
        if (JSOL["ok"]() === false) {
      return "KEY_NOT_FOUND";
    }
    return "FAIL";
  }
  return "UNKNOWN_DOMAIN";
};
window['$sValidateSpec030'] = $sValidateSpec030;
<?php
// @JSOL v0.2.97

/**
 @description
 # JSOL Spec 0.3.0 Full Validation Suite
 
 Valida la completitud de la implementación de la especificación 0.3.0 en la 
 versión de transición 0.2.97. 
 
 Prueba de forma isomórfica:
 1. Dominio Math (Criterio Excel, operaciones variádicas).
 2. Dominio Bool (Operaciones lógicas variádicas).
 3. Dominio Str & Arr (Manejo de colecciones).
 4. Canal de Sombras (Validación de fallos out-of-band sin romper el runtime).

 @param {string} $sDomain - El dominio o feature a testear.
 @returns {string} - El código de resultado o error detectado en el Shadow Channel.
*/

/**
 @contract
 {
   "cases": [
     { "in": { "$sDomain": "math_excel" }, "expect": { "_result": "OK" } },
     { "in": { "$sDomain": "bool_variadic" }, "expect": { "_result": "OK" } },
     { "in": { "$sDomain": "shadow_divide_by_zero" }, "expect": { "_result": "DIVIDE_BY_ZERO" } },
     { "in": { "$sDomain": "shadow_parse_error" }, "expect": { "_result": "PARSE_ERROR" } },
     { "in": { "$sDomain": "shadow_not_found" }, "expect": { "_result": "NOT_FOUND" } },
     { "in": { "$sDomain": "shadow_empty_array" }, "expect": { "_result": "EMPTY_ARRAY" } },
     { "in": { "$sDomain": "shadow_key_not_found" }, "expect": { "_result": "KEY_NOT_FOUND" } }
   ]
 }
*/

$sValidateSpec030 = function($sDomain) {
  // 1. CRITERIO EXCEL & MATEMÁTICA VARIÁDICA
    if ($sDomain === "math_excel") {
    // modX: Signo sigue al divisor (Excel)
        if (Math::modX(-10,  3) !== 2) {
      return "FAIL_MODX_1";
    }
    if (Math::modX(10,  -3) !== -2) {
      return "FAIL_MODX_2";
    }
    // roundX: Half away from zero (Excel)
        if (Math::roundX(1.5) !== 2) {
      return "FAIL_ROUNDX_1";
    }
    if (Math::roundX(-1.5) !== -2) {
      return "FAIL_ROUNDX_2";
    }
    // Variadic Math
        if (Math::sum(10,  20,  5) !== 35) {
      return "FAIL_SUM";
    }
    if (Math::sub(100,  20,  5) !== 75) {
      return "FAIL_SUB";
    }
    // (100 - 20) - 5
        if (Math::mul(2,  3,  4) !== 24) {
      return "FAIL_MUL";
    }
    if (Math::div(100,  2,  5) !== 10) {
      return "FAIL_DIV";
    }
    // (100 / 2) / 5
        
        return "OK";
  }
  // 2. LÓGICA BOOLEANA VARIÁDICA
    if ($sDomain === "bool_variadic") {
    $bT = true;
        $bF = false;

        if (JSOL_Bool::and($bT,  $bT,  $bT) !== true) {
      return "FAIL_AND";
    }
    if (JSOL_Bool::or($bF,  $bF,  $bT) !== true) {
      return "FAIL_OR";
    }
    // XOR: Paridad impar (3 verdades = true)
        if (JSOL_Bool::xor($bT,  $bT,  $bT) !== true) {
      return "FAIL_XOR";
    }
    if ((!$bF) !== true) {
      return "FAIL_NOT";
    }
    return "OK";
  }
  // 3. CANAL DE SOMBRAS (SHADOW CHANNEL OUT-OF-BAND TESTING)
    if ($sDomain === "shadow_divide_by_zero") {
    JSOL::resetShadow();
        $nResult = Math::div(100,  0,  5); // Falla en el primer divisor
        if (JSOL::ok() === false) {
      return "DIVIDE_BY_ZERO";
    }
    return "FAIL";
  }
  if ($sDomain === "shadow_parse_error") {
    JSOL::resetShadow();
        $nResult = Cast::toInt("basura_no_numerica");
        if (JSOL::ok() === false) {
      return "PARSE_ERROR";
    }
    return "FAIL";
  }
  if ($sDomain === "shadow_not_found") {
    JSOL::resetShadow();
        $iPos = Str::indexOf("hello world",  "xyz");
        if (JSOL::ok() === false) {
      return "NOT_FOUND";
    }
    return "FAIL";
  }
  if ($sDomain === "shadow_empty_array") {
    JSOL::resetShadow();
        $aEmpty = [];
        $val = Arr::pop($aEmpty);
        if (JSOL::ok() === false) {
      return "EMPTY_ARRAY";
    }
    return "FAIL";
  }
  if ($sDomain === "shadow_key_not_found") {
    JSOL::resetShadow();
        $mDict = JSOL::dict("clave",  "valor");
        $val = Map::get($mDict,  "clave_inexistente");
        if (JSOL::ok() === false) {
      return "KEY_NOT_FOUND";
    }
    return "FAIL";
  }
  return "UNKNOWN_DOMAIN";
};
declare var JSOL: any;
declare var Rgx: any;
declare var Str: any;
declare var Arr: any;
declare var Bool: any;
declare var Cast: any;

// @JSOL v0.2.97

/**
 @description
 # JSOL Spec 0.3.0 Full Validation Suite
 
 Valida la completitud de la implementación de la especificación 0.3.0 en la 
 versión de transición 0.2.97. 
 
 Prueba de forma isomórfica:
 1. Dominio Math (Criterio Excel, operaciones variádicas).
 2. Dominio Bool (Operaciones lógicas variádicas).
 3. Dominio Str & Arr (Manejo de colecciones).
 4. Canal de Sombras (Validación de fallos out-of-band sin romper el runtime).

 @param {string} $sDomain - El dominio o feature a testear.
 @returns {string} - El código de resultado o error detectado en el Shadow Channel.
*/

/**
 @contract
 {
   "cases": [
     { "in": { "$sDomain": "math_excel" }, "expect": { "_result": "OK" } },
     { "in": { "$sDomain": "bool_variadic" }, "expect": { "_result": "OK" } },
     { "in": { "$sDomain": "shadow_divide_by_zero" }, "expect": { "_result": "DIVIDE_BY_ZERO" } },
     { "in": { "$sDomain": "shadow_parse_error" }, "expect": { "_result": "PARSE_ERROR" } },
     { "in": { "$sDomain": "shadow_not_found" }, "expect": { "_result": "NOT_FOUND" } },
     { "in": { "$sDomain": "shadow_empty_array" }, "expect": { "_result": "EMPTY_ARRAY" } },
     { "in": { "$sDomain": "shadow_key_not_found" }, "expect": { "_result": "KEY_NOT_FOUND" } }
   ]
 }
*/

const $sValidateSpec030 = function($sDomain: any): string {
  // 1. CRITERIO EXCEL & MATEMÁTICA VARIÁDICA
    if ($sDomain === "math_excel") {
    // modX: Signo sigue al divisor (Excel)
        if (Math["modX"](-10,  3) !== 2) {
      return "FAIL_MODX_1";
    }
    if (Math["modX"](10,  -3) !== -2) {
      return "FAIL_MODX_2";
    }
    // roundX: Half away from zero (Excel)
        if (Math["roundX"](1.5) !== 2) {
      return "FAIL_ROUNDX_1";
    }
    if (Math["roundX"](-1.5) !== -2) {
      return "FAIL_ROUNDX_2";
    }
    // Variadic Math
        if (Math["sum"](10,  20,  5) !== 35) {
      return "FAIL_SUM";
    }
    if (Math["sub"](100,  20,  5) !== 75) {
      return "FAIL_SUB";
    }
    // (100 - 20) - 5
        if (Math["mul"](2,  3,  4) !== 24) {
      return "FAIL_MUL";
    }
    if (Math["div"](100,  2,  5) !== 10) {
      return "FAIL_DIV";
    }
    // (100 / 2) / 5
        
        return "OK";
  }
  // 2. LÓGICA BOOLEANA VARIÁDICA
    if ($sDomain === "bool_variadic") {
    let $bT: boolean = true;
        let $bF: boolean = false;

        if (Bool["and"]($bT,  $bT,  $bT) !== true) {
      return "FAIL_AND";
    }
    if (Bool["or"]($bF,  $bF,  $bT) !== true) {
      return "FAIL_OR";
    }
    // XOR: Paridad impar (3 verdades = true)
        if (Bool["xor"]($bT,  $bT,  $bT) !== true) {
      return "FAIL_XOR";
    }
    if ((!$bF) !== true) {
      return "FAIL_NOT";
    }
    return "OK";
  }
  // 3. CANAL DE SOMBRAS (SHADOW CHANNEL OUT-OF-BAND TESTING)
    if ($sDomain === "shadow_divide_by_zero") {
    JSOL["resetShadow"]();
        let $nResult: number = Math["div"](100,  0,  5); // Falla en el primer divisor
        if (JSOL["ok"]() === false) {
      return "DIVIDE_BY_ZERO";
    }
    return "FAIL";
  }
  if ($sDomain === "shadow_parse_error") {
    JSOL["resetShadow"]();
        let $nResult: number = Cast["toInt"]("basura_no_numerica");
        if (JSOL["ok"]() === false) {
      return "PARSE_ERROR";
    }
    return "FAIL";
  }
  if ($sDomain === "shadow_not_found") {
    JSOL["resetShadow"]();
        let $iPos: number = Str["indexOf"]("hello world",  "xyz");
        if (JSOL["ok"]() === false) {
      return "NOT_FOUND";
    }
    return "FAIL";
  }
  if ($sDomain === "shadow_empty_array") {
    JSOL["resetShadow"]();
        let $aEmpty: any[] = [];
        let $val = Arr["pop"]($aEmpty);
        if (JSOL["ok"]() === false) {
      return "EMPTY_ARRAY";
    }
    return "FAIL";
  }
  if ($sDomain === "shadow_key_not_found") {
    JSOL["resetShadow"]();
        let $mDict: Record<string, any> = JSOL.dict("clave",  "valor");
        let $val = Map["get"]($mDict,  "clave_inexistente");
        if (JSOL["ok"]() === false) {
      return "KEY_NOT_FOUND";
    }
    return "FAIL";
  }
  return "UNKNOWN_DOMAIN";
};
import math
import functools
from jsol_core import JSOL

# @JSOL v0.2.97

#*
# @description
# # JSOL Spec 0.3.0 Full Validation Suite
# 
# Valida la completitud de la implementación de la especificación 0.3.0 en la 
# versión de transición 0.2.97. 
# 
# Prueba de forma isomórfica:
# 1. Dominio Math (Criterio Excel, operaciones variádicas).
# 2. Dominio Bool (Operaciones lógicas variádicas).
# 3. Dominio Str & Arr (Manejo de colecciones).
# 4. Canal de Sombras (Validación de fallos out-of-band sin romper el runtime).
#
# @param {string} $sDomain - El dominio o feature a testear.
# @returns {string} - El código de resultado o error detectado en el Shadow Channel.
#

#*
# @contract
# {
#   "cases": [
#     { "in": { "$sDomain": "math_excel" }, "expect": { "_result": "OK" } },
#     { "in": { "$sDomain": "bool_variadic" }, "expect": { "_result": "OK" } },
#     { "in": { "$sDomain": "shadow_divide_by_zero" }, "expect": { "_result": "DIVIDE_BY_ZERO" } },
#     { "in": { "$sDomain": "shadow_parse_error" }, "expect": { "_result": "PARSE_ERROR" } },
#     { "in": { "$sDomain": "shadow_not_found" }, "expect": { "_result": "NOT_FOUND" } },
#     { "in": { "$sDomain": "shadow_empty_array" }, "expect": { "_result": "EMPTY_ARRAY" } },
#     { "in": { "$sDomain": "shadow_key_not_found" }, "expect": { "_result": "KEY_NOT_FOUND" } }
#   ]
# }
#

def sValidateSpec030(sDomain): 

  # 1. CRITERIO EXCEL & MATEMÁTICA VARIÁDICA
  if sDomain == "math_excel": 

    # modX: Signo sigue al divisor (Excel)
    if JSOL.math_modx(-10,  3) != 2: 

      return "FAIL_MODX_1";


    if JSOL.math_modx(10,  -3) != -2: 

      return "FAIL_MODX_2";


    # roundX: Half away from zero (Excel)
    if (math.floor(abs(1.5) + 0.5) * (1 - 2 * ((1.5) < 0))) != 2: 

      return "FAIL_ROUNDX_1";


    if (math.floor(abs(-1.5) + 0.5) * (1 - 2 * ((-1.5) < 0))) != -2: 

      return "FAIL_ROUNDX_2";


    # Variadic Math
    if JSOL.math_sum(10,  20,  5) != 35: 

      return "FAIL_SUM";


    if JSOL.math_sub(100,  20,  5) != 75: 

      return "FAIL_SUB";


    # (100 - 20) - 5
    if JSOL.math_mul(2,  3,  4) != 24: 

      return "FAIL_MUL";


    if JSOL.math_div(100,  2,  5) != 10: 

      return "FAIL_DIV";


    # (100 / 2) / 5

    return "OK";


  # 2. LÓGICA BOOLEANA VARIÁDICA
  if sDomain == "bool_variadic": 

    bT = True;
    bF = False;

    if JSOL.bool_and(bT,  bT,  bT) != True: 

      return "FAIL_AND";


    if JSOL.bool_or(bF,  bF,  bT) != True: 

      return "FAIL_OR";


    # XOR: Paridad impar (3 verdades = true)
    if JSOL.bool_xor(bT,  bT,  bT) != True: 

      return "FAIL_XOR";


    if (not bF) != True: 

      return "FAIL_NOT";


    return "OK";


  # 3. CANAL DE SOMBRAS (SHADOW CHANNEL OUT-OF-BAND TESTING)
  if sDomain == "shadow_divide_by_zero": 

    JSOL.reset_shadow();
    nResult = JSOL.math_div(100,  0,  5); # Falla en el primer divisor
    if JSOL.ok() == False: 

      return "DIVIDE_BY_ZERO";


    return "FAIL";


  if sDomain == "shadow_parse_error": 

    JSOL.reset_shadow();
    nResult = JSOL.to_int("basura_no_numerica");
    if JSOL.ok() == False: 

      return "PARSE_ERROR";


    return "FAIL";


  if sDomain == "shadow_not_found": 

    JSOL.reset_shadow();
    iPos = JSOL.str_index_of("hello world",  "xyz");
    if JSOL.ok() == False: 

      return "NOT_FOUND";


    return "FAIL";


  if sDomain == "shadow_empty_array": 

    JSOL.reset_shadow();
    aEmpty = [];
    val = JSOL.arr_pop(aEmpty);
    if JSOL.ok() == False: 

      return "EMPTY_ARRAY";


    return "FAIL";


  if sDomain == "shadow_key_not_found": 

    JSOL.reset_shadow();
    mDict = JSOL.dict("clave",  "valor");
    val = JSOL.map_get(mDict,  "clave_inexistente");
    if JSOL.ok() == False: 

      return "KEY_NOT_FOUND";


    return "FAIL";


  return "UNKNOWN_DOMAIN";


Every example is also a test.

To be released, every JSOL build has to pass every example correctly, with exactly the same results across every supported target. A "minor" change that resulted in a test giving out "8" in JavaScript and "8.0" in PHP? Rejected.

The language and compiler are continuosly improved because of what these 70+ examples demand. The CLRS examples are here for the same reason: if JSOL aims to be a language someone can read rather than just compile, it has to survive contact with computer science, not just invoicing.

💳

Strict Validation

Luhn, IBAN, CUIT, ISBN-13. Checksum algorithms that have to produce the exact same result in the browser and on the server: the exact scenario where a divergent implementation means a rejected payment or a failed compliance check.
📈

Finance & Rules

Loan amortization, progressive tax tiers, stacked discounts, shipping rate matrices. Rules that change when the business changes, and that silently produce wrong invoices when the frontend and backend disagree.
🧮

Computer Science

Dynamic Programming vs. Greedy (Coin Change), searching algorithms, sorting algorithms, Caesar/Rot13 ciphers, Sieve of Eratosthenes. Executable pseudocode that compiles and runs, not just sits in a textbook.

What JSOL is NOT

JSOL is not a full-stack framework, and it's not a general-purpose language. It is an isolated, pure, synchronous calculator. It doesn't touch the DOM, it doesn't make network requests (no fetch or Async), and it doesn't talk to databases.

Every alternative to JSOL (like Haxe or WebAssembly) buys generality or performance at the cost of requiring a toolchain. JSOL buys zero-toolchain portability by aggressively restricting what you can write.


The Honest Tradeoffs (Where JSOL is worse)

JSOL is intentionally worse and slower than writing native code on any single target. It is currently validating its core hypotheses on portability first. These are the engine-level restrictions you accept when using it:

Feature Native JS / PHP / Python JSOL Why it was stripped
Developer Speed & Syntax Fast (Syntactic sugar, modern abstractions) Slower (Dumb, ugly, spartan & strictly constrained) To eliminate the need for an AST compiler, JSOL severely restricts grammar to flat, lowest-common-denominator patterns.
Control Flow Async, Promises, Threads Strictly Synchronous (Single-thread blocking) Async control flow has no shared syntax between JS, PHP, and Python.
State & Collections Performance Classes, this, Reference Passing Flat Dicts & Value Semantics (Higher GC pressure) Forbidding classes guarantees simple $O(1)$ property access, but forces copying for immutability across targets, making JSOL slower on large arrays.
Text Parsing Native Regex (PCRE / V8 / RE2) Restricted Regex subset & procedural loops Regex engines differ across runtimes. Complex patterns, lookarounds, and backreferences can cause catastrophic backtracking (ReDoS) in one engine but not another.
Floating Point Precision Native floating-point masking / coercion quirks Strict IEEE-754 across all targets For $n, JSOL enforces strict IEEE-754 behavior across all runtimes for predictable standardization. For exact accounting where IEEE-754 is unsuitable, future specs project incorporating other mature, mathematically proven standards.

Design Pillars

Four principles shape every rule in the specification.

1. Clarity

A JSOL algorithm has to be readable by the person who owns the business logic, not just by a compiler.

This is also why JSOL doesn't standardize how you structure code (nested functions vs. flat scope, for instance) — that's implementation shape, not business logic.

2. Portability

The same source runs correctly on every proven target.

This is where Deterministic Parity comes from: given identical inputs, every target's output has to match, bit for bit.

3. Performance

The compiled output should be no heavier and no slower than it has to be.

This is where Zero Dead Code comes from: nothing gets shipped that a given file doesn't actually use.

4. Developer Experience

Writing, compiling, and debugging JSOL should be as frictionless as the constraints allow.

This is where the AST-free compiler pipeline and Zero Runtime Dependencies come from.

This is an open problem, not a finished product

JSOL works today for JavaScript, PHP, TypeScript and Python. The compiler is self-hosting (i.e., it compiles itself) and the fixed-point convergence tests prove that the output is stable across generations and hosts. But the really interesting work is what comes next.

The project's real bet is that the same approach can extend to other targets. TypeScript, Go, C#, Python, Rust, C: each one is a separate compiler backend, and each one teaches you something different about what "portable business logic" actually requires.

If you're a CS educator or student, EXTENDING.md lays out the feasibility matrix, the JSOL-C leverage effect, and the specific compiler design problems involved.

Fork it. Break it. Build a target. The compiler architecture is deliberately modular: adding a language means writing one compiler file, not rewriting the core.