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.
(INPUT)
(OUTPUT)
Function: $mAdoptionEconomicsSimple
// @JSOL v0.2.96
/**
@description
# Simplified JSOL Adoption Economics
Simplified version of `adoption-economics.jsol.js`: same break-even model
from **ADOPTION_ECONOMICS.md**, collapsed from 11 inputs to 5 by folding
dev cost and QA cost into a single number per side (native and JSOL),
and treating host-adaptation cost (H/h, "wiring, not logic" per the
source doc) as negligible rather than asking for it separately.
## Cost Formulas
`setupCostNative = qTargets * nNativeCostSetup`
`setupCostJsol = nJsolCostSetup`
`iterationCostNative = qTargets * nNativeCostIteration`
`iterationCostJsol = nJsolCostIteration`
## Derivation Reference
See `adoption-economics.jsol.js` for the full derivation of **verdict** and
**breakEvenIterations** from setupGap and perIterationSavings, including
why a single "immediate win" boolean is the wrong shape for this
result: setup cost and per-iteration cost can favor different sides,
and collapsing that into one flag hides real scenarios (JSOL can be
cheaper today and still lose over time if its iteration cost is high
enough — **jsol_wins_until_expiration** below).
## Parameters
- **@param {integer} $qTargets** - N, number of target languages (e.g. 2 for JS+PHP).
- **@param {number} $nNativeCostSetup** - Combined dev+QA cost per target, writing it the first time.
- **@param {number} $nJsolCostSetup** - Cost of writing and verifying the .jsol file, first time.
- **@param {number} $nNativeCostIteration** - Combined dev+QA cost per target, per later change.
- **@param {number} $nJsolCostIteration** - Cost of changing and re-verifying the .jsol file, per later change.
## Returns
- **@returns {Map}** - **verdict**: *jsol_wins_always* | *jsol_wins_after_breakeven* | *jsol_wins_until_expiration* | *native_always_wins*
- **breakEvenIterations**: -1 when no finite crossover exists
- **setupCostNative**: Total native setup cost
- **setupCostJsol**: Total JSOL setup cost
- **iterationCostNative**: Total native iteration cost
- **iterationCostJsol**: Total JSOL iteration cost
*/
/**
@contract
{
"cases": [
{ "$qTargets": 2, "$nNativeCostSetup": 2, "$nJsolCostSetup": 4, "$nNativeCostIteration": 0.8, "$nJsolCostIteration": 0.7 },
{ "$qTargets": 2, "$nNativeCostSetup": 2, "$nJsolCostSetup": 6, "$nNativeCostIteration": 0.8, "$nJsolCostIteration": 1 },
{ "$qTargets": 4, "$nNativeCostSetup": 2, "$nJsolCostSetup": 7, "$nNativeCostIteration": 0.8, "$nJsolCostIteration": 2 }
]
}
*/
const $mAdoptionEconomicsSimple = function($qTargets, $nNativeCostSetup, $nJsolCostSetup, $nNativeCostIteration, $nJsolCostIteration) {
const $nSetupCostNative = $qTargets * $nNativeCostSetup;
const $nSetupCostJsol = $nJsolCostSetup;
const $nIterationCostNative = $qTargets * $nNativeCostIteration;
const $nIterationCostJsol = $nJsolCostIteration;
const $nSetupGap = $nSetupCostJsol - $nSetupCostNative;
const $nPerIterationSavings = $nIterationCostNative - $nIterationCostJsol;
let $sVerdict = "native_always_wins";
let $nBreakEvenIterations = -1;
if ($nPerIterationSavings > 0) {
if ($nSetupGap <= 0) {
$sVerdict = "jsol_wins_always";
$nBreakEvenIterations = 0;
} else {
$sVerdict = "jsol_wins_after_breakeven";
$nBreakEvenIterations = $nSetupGap / $nPerIterationSavings;
}
} else if ($nPerIterationSavings < 0) {
if ($nSetupGap < 0) {
$sVerdict = "jsol_wins_until_expiration";
$nBreakEvenIterations = $nSetupGap / $nPerIterationSavings;
}
} else {
if ($nSetupGap <= 0) {
$sVerdict = "jsol_wins_always";
$nBreakEvenIterations = 0;
}
}
return Map.create(
"verdict", $sVerdict,
"breakEvenIterations", $nBreakEvenIterations,
"setupCostNative", $nSetupCostNative,
"setupCostJsol", $nSetupCostJsol,
"iterationCostNative", $nIterationCostNative,
"iterationCostJsol", $nIterationCostJsol
);
};
// @JSOL v0.2.96
/**
@description
# Simplified JSOL Adoption Economics
Simplified version of `adoption-economics.jsol.js`: same break-even model
from **ADOPTION_ECONOMICS.md**, collapsed from 11 inputs to 5 by folding
dev cost and QA cost into a single number per side (native and JSOL),
and treating host-adaptation cost (H/h, "wiring, not logic" per the
source doc) as negligible rather than asking for it separately.
## Cost Formulas
`setupCostNative = qTargets * nNativeCostSetup`
`setupCostJsol = nJsolCostSetup`
`iterationCostNative = qTargets * nNativeCostIteration`
`iterationCostJsol = nJsolCostIteration`
## Derivation Reference
See `adoption-economics.jsol.js` for the full derivation of **verdict** and
**breakEvenIterations** from setupGap and perIterationSavings, including
why a single "immediate win" boolean is the wrong shape for this
result: setup cost and per-iteration cost can favor different sides,
and collapsing that into one flag hides real scenarios (JSOL can be
cheaper today and still lose over time if its iteration cost is high
enough — **jsol_wins_until_expiration** below).
## Parameters
- **@param {integer} $qTargets** - N, number of target languages (e.g. 2 for JS+PHP).
- **@param {number} $nNativeCostSetup** - Combined dev+QA cost per target, writing it the first time.
- **@param {number} $nJsolCostSetup** - Cost of writing and verifying the .jsol file, first time.
- **@param {number} $nNativeCostIteration** - Combined dev+QA cost per target, per later change.
- **@param {number} $nJsolCostIteration** - Cost of changing and re-verifying the .jsol file, per later change.
## Returns
- **@returns {Map}** - **verdict**: *jsol_wins_always* | *jsol_wins_after_breakeven* | *jsol_wins_until_expiration* | *native_always_wins*
- **breakEvenIterations**: -1 when no finite crossover exists
- **setupCostNative**: Total native setup cost
- **setupCostJsol**: Total JSOL setup cost
- **iterationCostNative**: Total native iteration cost
- **iterationCostJsol**: Total JSOL iteration cost
*/
/**
@contract
{
"cases": [
{ "$qTargets": 2, "$nNativeCostSetup": 2, "$nJsolCostSetup": 4, "$nNativeCostIteration": 0.8, "$nJsolCostIteration": 0.7 },
{ "$qTargets": 2, "$nNativeCostSetup": 2, "$nJsolCostSetup": 6, "$nNativeCostIteration": 0.8, "$nJsolCostIteration": 1 },
{ "$qTargets": 4, "$nNativeCostSetup": 2, "$nJsolCostSetup": 7, "$nNativeCostIteration": 0.8, "$nJsolCostIteration": 2 }
]
}
*/
const $mAdoptionEconomicsSimple = function($qTargets, $nNativeCostSetup, $nJsolCostSetup, $nNativeCostIteration, $nJsolCostIteration) {
const $nSetupCostNative = $qTargets * $nNativeCostSetup;
const $nSetupCostJsol = $nJsolCostSetup;
const $nIterationCostNative = $qTargets * $nNativeCostIteration;
const $nIterationCostJsol = $nJsolCostIteration;
const $nSetupGap = $nSetupCostJsol - $nSetupCostNative;
const $nPerIterationSavings = $nIterationCostNative - $nIterationCostJsol;
let $sVerdict = "native_always_wins";
let $nBreakEvenIterations = -1;
if ($nPerIterationSavings > 0) {
if ($nSetupGap <= 0) {
$sVerdict = "jsol_wins_always";
$nBreakEvenIterations = 0;
}
else {
$sVerdict = "jsol_wins_after_breakeven";
$nBreakEvenIterations = $nSetupGap / $nPerIterationSavings;
}
}
else if ($nPerIterationSavings < 0) {
if ($nSetupGap < 0) {
$sVerdict = "jsol_wins_until_expiration";
$nBreakEvenIterations = $nSetupGap / $nPerIterationSavings;
}
}
else {
if ($nSetupGap <= 0) {
$sVerdict = "jsol_wins_always";
$nBreakEvenIterations = 0;
}
}
return JSOL.dict(
"verdict", $sVerdict,
"breakEvenIterations", $nBreakEvenIterations,
"setupCostNative", $nSetupCostNative,
"setupCostJsol", $nSetupCostJsol,
"iterationCostNative", $nIterationCostNative,
"iterationCostJsol", $nIterationCostJsol
);
};
window['$mAdoptionEconomicsSimple'] = $mAdoptionEconomicsSimple;
<?php
// @JSOL v0.2.96
/**
@description
# Simplified JSOL Adoption Economics
Simplified version of `adoption-economics.jsol.js`: same break-even model
from **ADOPTION_ECONOMICS.md**, collapsed from 11 inputs to 5 by folding
dev cost and QA cost into a single number per side (native and JSOL),
and treating host-adaptation cost (H/h, "wiring, not logic" per the
source doc) as negligible rather than asking for it separately.
## Cost Formulas
`setupCostNative = qTargets * nNativeCostSetup`
`setupCostJsol = nJsolCostSetup`
`iterationCostNative = qTargets * nNativeCostIteration`
`iterationCostJsol = nJsolCostIteration`
## Derivation Reference
See `adoption-economics.jsol.js` for the full derivation of **verdict** and
**breakEvenIterations** from setupGap and perIterationSavings, including
why a single "immediate win" boolean is the wrong shape for this
result: setup cost and per-iteration cost can favor different sides,
and collapsing that into one flag hides real scenarios (JSOL can be
cheaper today and still lose over time if its iteration cost is high
enough — **jsol_wins_until_expiration** below).
## Parameters
- **@param {integer} $qTargets** - N, number of target languages (e.g. 2 for JS+PHP).
- **@param {number} $nNativeCostSetup** - Combined dev+QA cost per target, writing it the first time.
- **@param {number} $nJsolCostSetup** - Cost of writing and verifying the .jsol file, first time.
- **@param {number} $nNativeCostIteration** - Combined dev+QA cost per target, per later change.
- **@param {number} $nJsolCostIteration** - Cost of changing and re-verifying the .jsol file, per later change.
## Returns
- **@returns {Map}** - **verdict**: *jsol_wins_always* | *jsol_wins_after_breakeven* | *jsol_wins_until_expiration* | *native_always_wins*
- **breakEvenIterations**: -1 when no finite crossover exists
- **setupCostNative**: Total native setup cost
- **setupCostJsol**: Total JSOL setup cost
- **iterationCostNative**: Total native iteration cost
- **iterationCostJsol**: Total JSOL iteration cost
*/
/**
@contract
{
"cases": [
{ "$qTargets": 2, "$nNativeCostSetup": 2, "$nJsolCostSetup": 4, "$nNativeCostIteration": 0.8, "$nJsolCostIteration": 0.7 },
{ "$qTargets": 2, "$nNativeCostSetup": 2, "$nJsolCostSetup": 6, "$nNativeCostIteration": 0.8, "$nJsolCostIteration": 1 },
{ "$qTargets": 4, "$nNativeCostSetup": 2, "$nJsolCostSetup": 7, "$nNativeCostIteration": 0.8, "$nJsolCostIteration": 2 }
]
}
*/
$mAdoptionEconomicsSimple = function($qTargets, $nNativeCostSetup, $nJsolCostSetup, $nNativeCostIteration, $nJsolCostIteration) {
$nSetupCostNative = $qTargets * $nNativeCostSetup;
$nSetupCostJsol = $nJsolCostSetup;
$nIterationCostNative = $qTargets * $nNativeCostIteration;
$nIterationCostJsol = $nJsolCostIteration;
$nSetupGap = $nSetupCostJsol - $nSetupCostNative;
$nPerIterationSavings = $nIterationCostNative - $nIterationCostJsol;
$sVerdict = "native_always_wins";
$nBreakEvenIterations = -1;
if ($nPerIterationSavings > 0) {
if ($nSetupGap <= 0) {
$sVerdict = "jsol_wins_always";
$nBreakEvenIterations = 0;
}
else {
$sVerdict = "jsol_wins_after_breakeven";
$nBreakEvenIterations = $nSetupGap / $nPerIterationSavings;
}
}
else if ($nPerIterationSavings < 0) {
if ($nSetupGap < 0) {
$sVerdict = "jsol_wins_until_expiration";
$nBreakEvenIterations = $nSetupGap / $nPerIterationSavings;
}
}
else {
if ($nSetupGap <= 0) {
$sVerdict = "jsol_wins_always";
$nBreakEvenIterations = 0;
}
}
return JSOL::dict(
"verdict", $sVerdict,
"breakEvenIterations", $nBreakEvenIterations,
"setupCostNative", $nSetupCostNative,
"setupCostJsol", $nSetupCostJsol,
"iterationCostNative", $nIterationCostNative,
"iterationCostJsol", $nIterationCostJsol
);
};
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.96
/**
@description
# Simplified JSOL Adoption Economics
Simplified version of `adoption-economics.jsol.js`: same break-even model
from **ADOPTION_ECONOMICS.md**, collapsed from 11 inputs to 5 by folding
dev cost and QA cost into a single number per side (native and JSOL),
and treating host-adaptation cost (H/h, "wiring, not logic" per the
source doc) as negligible rather than asking for it separately.
## Cost Formulas
`setupCostNative = qTargets * nNativeCostSetup`
`setupCostJsol = nJsolCostSetup`
`iterationCostNative = qTargets * nNativeCostIteration`
`iterationCostJsol = nJsolCostIteration`
## Derivation Reference
See `adoption-economics.jsol.js` for the full derivation of **verdict** and
**breakEvenIterations** from setupGap and perIterationSavings, including
why a single "immediate win" boolean is the wrong shape for this
result: setup cost and per-iteration cost can favor different sides,
and collapsing that into one flag hides real scenarios (JSOL can be
cheaper today and still lose over time if its iteration cost is high
enough — **jsol_wins_until_expiration** below).
## Parameters
- **@param {integer} $qTargets** - N, number of target languages (e.g. 2 for JS+PHP).
- **@param {number} $nNativeCostSetup** - Combined dev+QA cost per target, writing it the first time.
- **@param {number} $nJsolCostSetup** - Cost of writing and verifying the .jsol file, first time.
- **@param {number} $nNativeCostIteration** - Combined dev+QA cost per target, per later change.
- **@param {number} $nJsolCostIteration** - Cost of changing and re-verifying the .jsol file, per later change.
## Returns
- **@returns {Map}** - **verdict**: *jsol_wins_always* | *jsol_wins_after_breakeven* | *jsol_wins_until_expiration* | *native_always_wins*
- **breakEvenIterations**: -1 when no finite crossover exists
- **setupCostNative**: Total native setup cost
- **setupCostJsol**: Total JSOL setup cost
- **iterationCostNative**: Total native iteration cost
- **iterationCostJsol**: Total JSOL iteration cost
*/
/**
@contract
{
"cases": [
{ "$qTargets": 2, "$nNativeCostSetup": 2, "$nJsolCostSetup": 4, "$nNativeCostIteration": 0.8, "$nJsolCostIteration": 0.7 },
{ "$qTargets": 2, "$nNativeCostSetup": 2, "$nJsolCostSetup": 6, "$nNativeCostIteration": 0.8, "$nJsolCostIteration": 1 },
{ "$qTargets": 4, "$nNativeCostSetup": 2, "$nJsolCostSetup": 7, "$nNativeCostIteration": 0.8, "$nJsolCostIteration": 2 }
]
}
*/
const $mAdoptionEconomicsSimple = function($qTargets: any, $nNativeCostSetup: any, $nJsolCostSetup: any, $nNativeCostIteration: any, $nJsolCostIteration: any): Record<string, any> {
const $nSetupCostNative: number = $qTargets * $nNativeCostSetup;
const $nSetupCostJsol: number = $nJsolCostSetup;
const $nIterationCostNative: number = $qTargets * $nNativeCostIteration;
const $nIterationCostJsol: number = $nJsolCostIteration;
const $nSetupGap: number = $nSetupCostJsol - $nSetupCostNative;
const $nPerIterationSavings: number = $nIterationCostNative - $nIterationCostJsol;
let $sVerdict: string = "native_always_wins";
let $nBreakEvenIterations: number = -1;
if ($nPerIterationSavings > 0) {
if ($nSetupGap <= 0) {
$sVerdict = "jsol_wins_always";
$nBreakEvenIterations = 0;
}
else {
$sVerdict = "jsol_wins_after_breakeven";
$nBreakEvenIterations = $nSetupGap / $nPerIterationSavings;
}
}
else if ($nPerIterationSavings < 0) {
if ($nSetupGap < 0) {
$sVerdict = "jsol_wins_until_expiration";
$nBreakEvenIterations = $nSetupGap / $nPerIterationSavings;
}
}
else {
if ($nSetupGap <= 0) {
$sVerdict = "jsol_wins_always";
$nBreakEvenIterations = 0;
}
}
return JSOL.dict(
"verdict", $sVerdict,
"breakEvenIterations", $nBreakEvenIterations,
"setupCostNative", $nSetupCostNative,
"setupCostJsol", $nSetupCostJsol,
"iterationCostNative", $nIterationCostNative,
"iterationCostJsol", $nIterationCostJsol
);
};
import math
import functools
from jsol_core import JSOL
# @JSOL v0.2.96
#*
# @description
#
# # Simplified JSOL Adoption Economics
#
# Simplified version of `adoption-economics.jsol.js`: same break-even model
# from **ADOPTION_ECONOMICS.md**, collapsed from 11 inputs to 5 by folding
# dev cost and QA cost into a single number per side (native and JSOL),
# and treating host-adaptation cost (H/h, "wiring, not logic" per the
# source doc) as negligible rather than asking for it separately.
#
# ## Cost Formulas
#
# `setupCostNative = qTargets * nNativeCostSetup`
# `setupCostJsol = nJsolCostSetup`
# `iterationCostNative = qTargets * nNativeCostIteration`
# `iterationCostJsol = nJsolCostIteration`
#
# ## Derivation Reference
#
# See `adoption-economics.jsol.js` for the full derivation of **verdict** and
# **breakEvenIterations** from setupGap and perIterationSavings, including
# why a single "immediate win" boolean is the wrong shape for this
# result: setup cost and per-iteration cost can favor different sides,
# and collapsing that into one flag hides real scenarios (JSOL can be
# cheaper today and still lose over time if its iteration cost is high
# enough — **jsol_wins_until_expiration** below).
#
# ## Parameters
#
# - **@param {integer} $qTargets** - N, number of target languages (e.g. 2 for JS+PHP).
# - **@param {number} $nNativeCostSetup** - Combined dev+QA cost per target, writing it the first time.
# - **@param {number} $nJsolCostSetup** - Cost of writing and verifying the .jsol file, first time.
# - **@param {number} $nNativeCostIteration** - Combined dev+QA cost per target, per later change.
# - **@param {number} $nJsolCostIteration** - Cost of changing and re-verifying the .jsol file, per later change.
#
# ## Returns
#
# - **@returns {Map}** - **verdict**: *jsol_wins_always* | *jsol_wins_after_breakeven* | *jsol_wins_until_expiration* | *native_always_wins*
# - **breakEvenIterations**: -1 when no finite crossover exists
# - **setupCostNative**: Total native setup cost
# - **setupCostJsol**: Total JSOL setup cost
# - **iterationCostNative**: Total native iteration cost
# - **iterationCostJsol**: Total JSOL iteration cost
#
#*
# @contract
# {
# "cases": [
# { "$qTargets": 2, "$nNativeCostSetup": 2, "$nJsolCostSetup": 4, "$nNativeCostIteration": 0.8, "$nJsolCostIteration": 0.7 },
# { "$qTargets": 2, "$nNativeCostSetup": 2, "$nJsolCostSetup": 6, "$nNativeCostIteration": 0.8, "$nJsolCostIteration": 1 },
# { "$qTargets": 4, "$nNativeCostSetup": 2, "$nJsolCostSetup": 7, "$nNativeCostIteration": 0.8, "$nJsolCostIteration": 2 }
# ]
# }
#
def mAdoptionEconomicsSimple(qTargets, nNativeCostSetup, nJsolCostSetup, nNativeCostIteration, nJsolCostIteration):
nSetupCostNative = qTargets * nNativeCostSetup;
nSetupCostJsol = nJsolCostSetup;
nIterationCostNative = qTargets * nNativeCostIteration;
nIterationCostJsol = nJsolCostIteration;
nSetupGap = nSetupCostJsol - nSetupCostNative;
nPerIterationSavings = nIterationCostNative - nIterationCostJsol;
sVerdict = "native_always_wins";
nBreakEvenIterations = -1;
if nPerIterationSavings > 0:
if nSetupGap <= 0:
sVerdict = "jsol_wins_always";
nBreakEvenIterations = 0;
else:
sVerdict = "jsol_wins_after_breakeven";
nBreakEvenIterations = nSetupGap / nPerIterationSavings;
elif nPerIterationSavings < 0:
if nSetupGap < 0:
sVerdict = "jsol_wins_until_expiration";
nBreakEvenIterations = nSetupGap / nPerIterationSavings;
else:
if nSetupGap <= 0:
sVerdict = "jsol_wins_always";
nBreakEvenIterations = 0;
return JSOL.dict(
"verdict", sVerdict,
"breakEvenIterations", nBreakEvenIterations,
"setupCostNative", nSetupCostNative,
"setupCostJsol", nSetupCostJsol,
"iterationCostNative", nIterationCostNative,
"iterationCostJsol", nIterationCostJsol
);
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
Finance & Rules
Computer Science
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.