Repository navigation
Releases
v0.3.0
Iqalox 0.3.0
0.3 turns Iqalox from a single-file language into one you can build
multi-file programs in, and gives the compiler its first optimizations. It is
a breaking release (pre-1.0, so by design): the standard library now has
to be imported.
Run a program with one command
Each bundle now includes an iqalox launcher (iqalox.cmd on Windows):
./iqalox examples/classes.iqxIt compiles to a temporary bytecode file and runs it on the VM, exiting with
the VM's status. The two-step form (iqaloxc prog.iqx out.iqbc, then
iqaloxvm out.iqbc) still works. iqaloxc run <file> does the same thing
directly. First pass: no argument pass-through to programs yet, and no REPL.
What's new in the language
- Modules. A file's path is its module name (
math/vector.iqxis
math.vector).import math.vector.double,import math.vector.double as twice, orimport std.matrix.{transpose, multiply as mul}. Mark exports
withpub(pub fun,pub var,pub class,pub trait); everything else
is private to its file. Imports are read-only, and a name collision is a
compile error (no silent shadowing). The compiler still emits one.iqbc
file. - Import-gated standard library.
std.vector(push,pop,length,
reverse,concat,map,filter,reduce,sort) andstd.matrix
(transpose,multiply,add,subtract,elementwise) must now be
imported.printis the only name available without an import. This means
you can define your ownsortorpush. If you forget an import, the
error tells you which line to add. - Negative indices and slices.
v[-1], and end-inclusive slices
v[1:3],v[:2],v[3:],v[:]. - Richer list comprehensions. Several generators (a Cartesian product) and
an optional guard:[x + y | x <- xs, y <- ys | x != y]. - Warnings. Unused locals, parameters, top-level
var/fun, private class
members and imports are flagged (_-prefixed names andpubitems are
exempt). Warnings never change the exit status. - Better runtime errors. They now name the source file:
[math/vector.iqx, line 12], and<std.vector>for faults inside the
standard library.
Compiler optimizations
iqaloxc now folds constants, propagates never-assigned top-level vars with
literal initializers, and removes dead code. Behavior is unchanged (checked by
a differential test over 244 programs). Pass --no-optimize to turn it off.
Measured honestly: up to about 14% fewer executed instructions on programs
that name their constants (a time-conversion benchmark -13.6%, Game of Life
-10.4%), and no change on code that already uses literals and locals. The big
remaining cost is top-level variable lookup in the VM, which is 1.0 work.
Breaking changes
- The standard library must be imported (see above). Programs that used
push,map,transpose, etc. without an import no longer compile. - Top-level declarations are private to their file unless marked
pub. - Printing a vector now formats each element like a top-level
print:
print [1, "a"]gives[1, a](it used to give[1.0, 'a']). - The VM's default build type is now Release (it was Debug, roughly 15x
slower). Release bundles were already built that way.
Known limitations
These carry over and are documented in docs/LANGUAGE.md §15: no string
+ (use concat), a vector literal or parenthesized expression can't span
lines, a one-line function body ending in return x needs ; }, and with
mixins are simplified rather than fully C3-linearized.
Documentation
docs/LANGUAGE.md is the full reference for 0.3; every code sample in it
was run against this release. Earlier versions are preserved by tag
(docs/EARLIER-VERSIONS.md).
v0.2.0
Iqalox 0.2.0
The second real release of Iqalox, building directly on 0.1's compiler
frontend (compiler/, F#) and bytecode virtual machine (vm/, modern
C++23). 0.2 is everything 0.1 had — same syntax, same semantics, the
same core language — plus real vector manipulation and a first,
deliberately-scoped pass at multiple-inheritance-style class composition.
New since 0.1
- Vector indexing.
v[i]reads and writes, 0-based and
bounds-checked. Composes with call results and nests for matrix-style
access (grid[i][j]). Told apart from the pre-existing paren-free call
syntax (f [i]) purely by whitespace — the only place whitespace is
significant anywhere in the grammar. - Lambdas.
(a, b) -> expr— anonymous, single-expression closures,
disambiguated from a grouped comma expression by lookahead past the
closing paren for a trailing->. - Cons and list comprehensions.
[item | list]prepends;[expr | x <- xs]maps a single generator into a new vector. Both desugar
entirely at compile time into an ordinary loop — no new runtime
representation. - Vector-literal spread.
[...a, ...b], freely mixable with ordinary
items in a comma-separated literal. - Array-manipulation standard library.
push,pop,length,
reverse(true natives);map,filter,reduce,sort(ordinary
Iqalox functions, written against the same lambda/paren-free-call
surface any program has, prepended to every compiled program as a
prelude). - Matrix standard library. A matrix is just a vector of vectors —
transpose,multiply,add,subtract(true natives, with clean
shape-validation errors) andelementwise(prelude, takes a combining
lambda). - Property
pub/mutvisibility and mutability. Every property must
now be declared in the class body (var name,var name mut,var name pub,var name pub mut) — private and write-once by default.
Replaces0.1's "any field springs into existence on assignment, no
immutability concept" model entirely. - Method
pub/private visibility. A method withoutpubis only
reachable via internal (self.x) access — which is resolved
protected-like, so a subclass's own methods can still reach a
superclass's private members, the same as C++/Java/C#'sprotected.
initis always externally callable regardless of annotation. - Mixins (
with) and traits (trait/use). Two composition
mechanisms, split by keyword etymology:trait/useis PHP-style
static copying with zero runtime representation;withcomposes a
real class's already-compiled members at runtime (a simplified,
non-C3-linearized approximation — full Scala-style linearization is
deliberately deferred, seeROADMAP.md). Any two composed sources
sharing a member name is a compile-time error; a class's own literal
body always silently wins for methods, but never for properties (no
override semantics under the write-once model above).
Retirement of cross-implementation conformance testing
The property/method visibility changes above are a genuine breaking
change to the object model — an undeclared self.x = ... is now a
compile error — which means compiler/+vm/ can no longer run
poc/-era class fixtures at all. Rather than patch around this,
cross-implementation conformance testing (scripts/conformance-test.sh,
the poc-vs-compiler/+vm/ CI job) has been retired outright.
poc/ remains in the repository as a frozen, working 0.1-poc
reference implementation; pre-1.0, backward compatibility with an
earlier version isn't a project goal.
Known limitations
See docs/LANGUAGE.md §15 for the full list. Carried forward from
0.1: no string concatenation via + (use concat), the
call/argument-chaining ambiguity (f x.method() binds to the argument),
no token text/source excerpt on errors, a vector literal or grouping
expression can't span multiple lines, a non-identifier callee can't be
called (so an immediately-invoked lambda isn't expressible yet), and a
one-line block ending in a bare return x needs an explicit ; before
}. New for 0.2: list comprehensions support exactly one generator
and no guard clause; with-mixin composition is simplified, not full
C3; there's no trait-conflict disambiguation syntax (no insteadof/as
equivalent); a runtime error from inside a prelude function
(map/filter/reduce/sort/elementwise) reports a line number
relative to the prelude's own source, not the user's file; and
elementwise's shape-mismatch behavior is generic (an index-out-of-range
error), not a dedicated message, since Prelude-level Iqalox code has no
throw/raise construct to signal one with.
Getting the binaries
Download the archive for your platform below — each bundles both
iqaloxc (the compiler) and iqaloxvm (the VM), plus a handful of
example .iqx scripts, and needs nothing else installed. See the root
README.md for usage and build-from-source instructions.
Testing
209 F# tests (xUnit), 99 C++ test cases / 206 assertions (Catch2,
passing cleanly under both GCC and Clang with -Wall -Wextra), and
every top-level langspec/examples/*.iqx fixture verified end-to-end
through the real compiler/+vm/ toolchain.
Iqalox PoC 0.1.3
Iqalox 0.1.3-poc
A bug-fix release: six real bugs fixed, all found while building 0.1's
F#/C++23 compiler+VM port and ported back here. None change the
language's documented design — all were implementation bugs, not the
intended behavior.
Fixed
- A parse error partway through a vector literal could permanently
disable the comma operator.comma_as_operatorwas toggled off
before parsing a[...]literal's elements and back on after — but a
parse error partway through (e.g.[1, 2, bad+]) raised past that
restore, leaving the comma operator disabled for the rest of the file. - A
forloop with a bare;body could crash the interpreter.
for (;;) ;built aFornode with aNonebody instead of treating
it as an empty block. - The comma operator always evaluated to
nil.(1, 2)returned
nilinstead of2— the interpreter had no case for it at all and
silently fell through to its default. ??(null-coalescing) was not short-circuiting.5 ?? boom()
calledboom()even though5isn't nil, since both sides were always
evaluated before the operator was even checked.- Elvis (
?:) evaluated its condition twice when truthy. The parser
reuses the same expression node for both the condition and the
"value if truthy" branch; the interpreter evaluated it independently
each time, double-running any side effect (e.g.sideEffect() ?: false
ransideEffect()twice). concatcrashed the whole interpreter on a non-vector argument
instead of raising a clean runtime error.concat(5)used to print a
raw Python traceback; it now reportsArgument to 'concat' must be a vector, got number.like any other runtime error.
Testing
120 tests (up from 114), including new regression coverage for all six
fixes above — each verified to fail against the pre-fix code before being
confirmed against the fix.
Documentation
docs/PLAN-0.1-POC.md's running list of bugs found via the 0.1 F# port
is updated to reflect all six as now patched here too.
Iqalox PoC 0.1.2
Iqalox 0.1.2-poc
A bug-fix release: five real scanner bugs fixed, all found while writing
the scanner for the upcoming 0.1 (F#/C++23) implementation and ported
back here. None change the language's documented design — all were
implementation bugs, not the intended behavior.
Changed: repository layout
poc's code moved under a new poc/ directory (poc/src, poc/tests,
poc/tools, poc/pytest.ini, poc/requirements-dev.txt), making room
for the real 0.1 compiler frontend (F#) and bytecode VM backend (C++23)
now under active development alongside it — see docs/PLAN-0.1.md.
- Run tests with
cd poc && pytest(waspytestfrom the repo root) - Run scripts with
python3 poc/src/iqalox.py <file>(waspython3 src/iqalox.py <file>)
Fixed
- Decimal number literals never worked at all.
3.14silently scanned
as three separate tokens (3,.,14) instead of one number — no
test or example had ever used a decimal literal, so this went
undetected until now. - A leading-underscore identifier (
_foo) misscanned as the bare_
ignore operator followed by a separatefooidentifier. - The (currently unused)
...ellipsis token under-consumed by one
character. - A bare
#>outside a block comment was silently swallowed, with no
token or error. - An unterminated block comment produced no error at all, unlike an
unterminated string, which already errored correctly.
Testing
114 tests (up from 107), including new regression coverage for all five
fixes above. The two fixes with real, positive, everyday impact (decimal
literals and leading-underscore identifiers — the other three are
obscure/error-path edge cases) are now also demonstrated in
langspec/examples/operators.iqx and langspec/examples/functions.iqx.
v0.1.0
Iqalox 0.1.0
The first real implementation of Iqalox — superseding 0.1-poc's Python
tree-walk interpreter with a proper toolchain: a compiler frontend
(compiler/, F#) that compiles .iqx source to a bytecode file, executed
by a stack-based virtual machine (vm/, modern C++23) with its own
mark-sweep garbage collector.
0.1 is everything 0.1-poc had — same syntax, same semantics, the same
example programs, verified byte-for-byte identical output via a
cross-implementation conformance suite — plus four additions:
New since 0.1-poc
undefand must-assign-before-read. A mutable variable declared
without an initializer (var x mut) starts asundef, notnil—
reading it before its first real assignment is now a runtime error
instead of a silentnil.- String escape sequences.
\n\t\r\\\'\"\0are now
processed inside string literals; any other character after a backslash
is a compile-time error.0.1-pochad no escape processing at all. - Compile-time immutability enforcement. Reassigning a variable that
wasn't declaredmutis now caught before any code even runs, resolving
0.1-poc's documented runtime-only interim tradeoff. - Self-referencing classes. A class can now reference itself by name
from inside its own methods — a real Lox capability0.1-poccouldn't
cleanly support with its plain-environment binding model.
Architecture highlights
- Lexical scoping resolved entirely at compile time (a
clox-style
scope/slot/upvalue algorithm) — the VM never does a name lookup for a
local variable at runtime. - A real mark-sweep tracing garbage collector built into the VM, not
delegated to a host language. - Classes, single inheritance (
extends),self/super, and dynamic
dispatch, with method calls using a distinct calling convention from
plain function calls. - Bytecode format v2 carries a per-instruction source line table, so both
compile-time and runtime errors report a real[line N].
Known limitations
See docs/LANGUAGE.md §13 for the full list, including one real,
disclosed gap: errors report a line number but not yet the offending
token's text or a caret-underlined source excerpt (0.1-poc has both).
Vectors remain literal-only (no indexing/mutation), there's no string
concatenation via + (use concat), and object fields have no
immutability concept — all carried forward from 0.1-poc by design, not
regressions.
Getting the binaries
Download the archive for your platform below — each bundles both
iqaloxc (the compiler) and iqaloxvm (the VM), plus a handful of
example .iqx scripts, and needs nothing else installed. See the root
README.md for usage and build-from-source instructions.
Testing
123 F# tests (xUnit), 51 C++ tests (Catch2, passing cleanly under both
GCC and Clang with -Wall -Wextra), 120 Python tests (poc/'s own
suite, still exercised as the reference implementation), and a
cross-implementation conformance suite confirming compiler/+vm/ match
poc/'s output byte-for-byte on every example script.
Iqaloc PoC 0.1.1
Iqalox 0.1.1-poc
A small fix-and-polish release on top of 0.1.0-poc: no new language
features or breaking changes, just better diagnostics. Closes #1 and #2.
Fixed
-
Errors now point at exactly where they happened. Every token tracks
its own line and column, and scan/parse/runtime errors print the
offending source line with a^underline spanning the whole token —
not just a bare line number.[line 2] Error at '@@@': Unexpected characters: @@@ var y = @@@ 2 ^^^ -
A run of invalid characters is now one error, not one per character.
@@@used to produce three separate "Unexpected character" reports; it's
now a single error naming the whole run. -
Unterminated-string errors now point at the opening quote, not wherever
end-of-file happened to be reached. -
An implicit semicolon's lexeme is a literal newline, which used to split
theat '...'error text across two lines mid-message — now displayed
as the wordnewline.
Testing
107 tests (up from 99), including new coverage for column tracking,
invalid-character-run coalescing, and source-excerpt/caret rendering.
Documentation
docs/LANGUAGE.md §12 (Errors) and docs/PLAN-0.1-POC.md updated to
reflect the new diagnostics.
Iqalox PoC
Iqalox 0.1.0-poc
The first tagged release of Iqalox — a tree-walk interpreter, written in
Python, implementing the 0.1-poc milestone of the language: a Lox
derivative (from Bob Nystrom's Crafting Interpreters) mutated to suit its
own design goals. This is a proof of concept ahead of a future bytecode
implementation, not a production release.
Highlights
- No function call — builtin or user-defined — takes parentheses.
print x,math.square 3,Duck "Waddles",fact (n - 1). Parens
survive only for grouping a compound argument, the explicit zero-arg
marker (count()), and function declarations' parameter lists. - No
if/else, nowhile. A chainable ternary (? :, plus the elvis
short form?:) replacesif/elseentirely — including for
statement-like branches likebreak/continue.foris the only loop. - Classes, single inheritance (
extends),self(notthis), lexically
resolvedsuper. - Immutability by default —
var xcan't be reassigned; opt in with
var x mut. - Closures, first-class functions, recursion.
- Pipe operator (
|>) and ignore operator (_). print/concatare ordinary, shadowable builtin function values, not
keywords.
New/changed vs. Lox
- Vector literals (
[1, 2, 3]) — literals only, no indexing/mutation/stdlib
yet (full array support is0.2) - Block comments (
<# ... #>) alongside line comments (# ...) - Implicit semicolons (a newline ends a statement)
continue/breakas expressions, usable as ternary branches- Prefix
++/--with standard mutating semantics extendsinstead of<for inheritance- Null-coalescing (
??) and elvis (?:) operators - Modulo (
%) and power (^), same precedence as*// - Comma operator
Breaking changes vs. Lox
- No string concatenation via
+— useconcatinstead extendsreplaces<for inheritance- Ternary replaces
if/else;whileis gone - No parenthesized function calls anywhere
Known limitations
Documented in full in docs/LANGUAGE.md (§13), briefly:
- No escape sequences in string literals
- No built-in methods on primitive values (numbers/strings/vectors)
- Immutability is enforced at runtime, not compile time
- Object fields have no immutability concept
- Chaining
.method()directly onto an argument-taking call is ambiguous
(binds to the argument, not the outer call) — bind to a variable first - No exception handling, concurrency, or reflection at the language level
Try it
python3 src/iqalox.py langspec/examples/classes.iqx
Five other runnable examples live under langspec/examples/, covering
control flow, functions/closures, inheritance, loops, and operators.
Documentation
docs/LANGUAGE.md— full language reference, with a classification of
the language along every applicable PL-design axis, every feature with
examples, and the complete known-limitations listlangspec/SYNTAX_GRAMMAR.md/ rootREADME.md— grammar and precedence
referenceROADMAP.md— what's next (0.1hardening,0.2arrays/mixins/traits,
and beyond)
Testing
99 tests (pytest), covering the scanner, parser, interpreter, and every
language feature above.