Repository navigation
Releases
Cob v0.0.9
Cob Language v0.0.9
Overview
Three headline features, and one big reorganisation.
Functions. Cob has recipe and serve (a function and its return):
recipe fact(n):
if n <= 1:
serve 1
serve n * fact(n - 1)
pop(fact(10))
A REPL. Run cob_interp with no file for an interactive session; a
bare expression prints its value, blocks continue with ..., and
variables and recipes persist. cob_interp file.cob -i runs a file and
then stays in the REPL with everything it defined. (Interpreter only.)
A real standard library. Everything that is not the core language is
now a separate shared library (.so / .dylib / .dll) loaded with
shuck, and every module and function in it is corn themed:
porch (console input), cornmath, kernels (text), almanac (time),
granary (files), pantry (SQLite), barn (windows), tassel
(Tcl/Tk) and silo (the everyday five in one shuck).
Added
recipe <name>(<params>):/serve [<expr>]: functions, with
recursion (up to 500 calls deep, then a warning and a result of 0
instead of a crash). Parameters and every name a recipesets are
local to it; any other name reads the global; a recipe cannot assign a
global. Recipes are defined at the top level and are hoisted, so a
call may appear above its recipe and recipes may call each other.
A call can also stand alone on a line (greet("Ada")).- Call checking before anything runs: a call to a name that does not
exist, or with the wrong number of arguments, is an error with its
line number, so a typo fails up front, not halfway through the run.
A forgottenshuckgets a hint naming the module to add. - The REPL in
cob_interp(no file,--repl, or-iafter a file):
commands:help,:vars,:recipes,:load <file>,:reset,
:quit; typing a recipe again replaces it; mistakes print an error
and the session carries on. Prompts and the banner appear only on a
terminal, socob_interp --repl < script.txtis scriptable. - The standard library (
stdlib/, built tobin/lib/by
make stdlib):porch,cornmath,kernels,almanac,granary,
pantry,barn,tassel,silo. 40+ functions, listed in the README.
shuck <module>finds the wrapper in the standard library directory
($COB_STDLIB, else<the tool's directory>/lib) after the current
directory andcob_modules/;extern ... from "<module>"finds the
library there too. popcorn_compgains recipes and the whole standard library,
including SQLite and windows, which it could never compile before. It
links-l<module>and records the standard library directory as an
rpath.make testandtools/tests/run_tests.sh: 17 checks, with every
program test run through the interpreter AND the compiler against the
same expected output.- A Docker image, built, smoke-tested and published to
ghcr.io/cob-software-foundation/cob(linux/amd64 + linux/arm64) by
the new.github/workflows/docker.yml: the interpreter and REPL, the
compiler,farmerand the standard library (withoutbarnand
tassel).docker run -it --rm ghcr.io/cob-software-foundation/cob
starts the REPL; see the README for running and compiling programs.
The image build runsmake test, andtools/docker/smoke_test.sh
checks the finished image. The old stress-test image moved to
Dockerfile.stress(ci.yml was updated to match). make cob_interp_static: a build with the browser-capable modules
compiled in, which is also what the WebAssembly build now uses.
Changed (BREAKING)
-
input,input_int, the SQLite keywords, the window keywords and
tcl_eval/tk_evalare no longer built into the interpreter.
They are standard library functions now and must beshucked:input(p) -> shuck porch; porch_ask(p) input_int(p) -> shuck porch; porch_ask_int(p) sql_open/exec/query/close -> shuck pantry; pantry_open/exec/query/close window_open/label/wait/close/button/slider/textbox -> shuck barn; barn_open/label/wait/close/button/slider/textbox tcl_eval / tk_eval -> shuck tassel; tassel_tcl / tassel_tkAn old name gives an error that says exactly what to write instead.
shuck cobwindowis gone with the keywords it acknowledged. -
recipeandserveare new reserved words (so anexterncannot be
named either);input,input_intand the others are no longer
reserved. -
One interpreter instead of three.
cob_interpis the core language
only and builds in about a second with no vendor libraries.
cob_interp_full,cob_interp_dbandcob_interp_windowremain as
maketargets so old scripts keep working: each builds the same
interpreter under the old name plus the modules that build used to
contain. -
Plain
makeno longer needs X11/OpenGL: it buildscob_interp,
popcorn_comp,farmerand the standard library (which includes
pantry).barn(raylib) andtassel(Tcl/Tk) are opt-in:
make stdlib-barn,make stdlib-tassel. -
A program or library file in the current directory shadows a standard
library module of the same name (porch.cobis found before the real
porch). Name your own files accordingly. -
.strawberrycache format bumped fromCOBSTRW9toCOBSTRW10
(the magic is one character longer). The built-in expression kinds
were removed and the survivors renumbered;recipe,serveand
call-statement kinds were added. Old caches are detected as stale and
rebuilt automatically. -
Library warnings are tagged by module (
[porch] warning: ...,
[pantry] warning: ...), and are now identical in the interpreter
and in compiled programs, because both call the same library. -
The harvest/trash
--no-gccheck now also looks insidepop(...)
and conditions, in both tools. -
In the WebAssembly build the sandbox notice is printed once per
library, not once per function.
Fixed
popcorn_comp:set s = s + "x"lost the old value (the variable
was freed before its own right-hand side was read), so a string built
up in a loop ended up as just the last piece. The right-hand side is
now evaluated first.popcorn_comp: operand evaluation order. C leaves the order of
function arguments unspecified, soa() + b()or a comparison of two
calls that print could runbfirst in a compiled program. Compiled
code now evaluates left to right, like the interpreter, whenever both
operands do something observable.
Notes
barnandtasselare ports of the old built-in window and Tcl/Tk
code. They compile against the vendored headers, but could not be
built and run in the environment this release was developed in (no
X11 extension headers for raylib; Tcl/Tk is a long from-source build),
so they have not been run. Please trymake stdlib-barn/
make stdlib-tasselon a real desktop.- The release workflows (
.github/workflows/build.yml) still package a
singlecobbinary. Releases must also ship thelib/directory
next to it (cp -r bin/lib dist/), orshuck porchand friends will
not find their libraries.make embedalready includes it. - The standard library is loaded with dlopen()/LoadLibrary(), so
cob_interpmust be a dynamically linked executable, and a program
compiled bypopcorn_compthat uses it must be too: a statically
linked program (such as a static-musl cross-compile target) cannot use
shared libraries. Cross-compiling a program that shucks stdlib modules
also needs those modules built for the target, withCOB_STDLIB
pointing at them. Check how the release binaries are linked before
publishing 0.0.9. Programs that use only the core language are
unaffected. - The Dockerfile and docker.yml could not be run in the environment this
release was developed in (no Docker there). The build stage's commands
were run by hand in a context filtered by.dockerignore, the runtime
layout was reproduced and exercised, and the smoke test was dry-run
(including a deliberately broken image, which it caught), but the first
real image build will be the one on GitHub Actions. The arm64 half is
built under QEMU and runs the full test suite there. - Tested here on Linux x86-64 with gcc, including under
AddressSanitizer and UBSan. The macOS and Windows code paths (library
naming,GetModuleFileName,.dllloading) are written but untested.
Cob Language v0.0.8
Overview
The headline feature is console input. Cob programs can now ask the
person running them a question and use the answer:
set name = input("What is your name? ")
set age = input_int("How old are you? ")
pop("Hello, " + name + "!")
pop(age + 1)
Added
input(<prompt>)prints the prompt (no trailing newline, flushed),
reads one line from standard input, and returns it as a string with
the line ending removed. At end of input it returns"". The prompt
is optional:input()is allowed.input_int(<prompt>)does the same and parses the line as a
base-10 integer. A line that is not a number (or end of input) returns
0; a non-numeric line also prints a warning on stderr.inputandinput_intare now reserved words when followed by(,
so anexterncan no longer be declared with those names. A variable
namedinput(no parentheses) still works.popcorn_compcompilesinputandinput_inttoo, so compiled
programs read standard input exactly like interpreted ones: same
prompt handling, same end-of-input results, same non-numeric
warning (tagged[cob]instead of[cob_interp], like every compiled
warning). The input runtime is only added to the generated C for
programs that use it, so every other program compiles to the same C
as before.- A regression test,
tools/tests/input.cob, with the lines it reads in
`input...
Cob v0.0.9-rc
Unreleased -- the Rust rewrite
Cob is now written in Rust. The interpreter, compiler (popcorn_comp),
package manager (farmer), license tool (cob_sign), the browser build and
every standard-library module are Rust crates (crates/, stdlib-rs/);
barn wraps the vendored raylib/raygui C libraries and SQLite stays the
vendored amalgamation. The language, its error messages, the .strawberry
cache format, the native-extension ABI (include/cob.h) and the generated C
are unchanged -- checked by running the original and the new tools side by side.
tassel(Tcl/Tk) is removed, along withvendor/TCL,vendor/TK,
make stdlib-tassel, and thetcl_eval/tk_evalupgrade hint.- Enterprise licenses can be bound to a machine.
cob_sign signnow writes
bind=machineby default: the first run records a hash of the OS machine UUID
in the license file;--machine <hash>pre-binds a license in the signed
part;--no-bindkeeps the old behaviour. See ENTERPRISE.md for what this
does and does not protect against. - The browser playground runs the Rust build (
make play). Numbers there are
64-bit like everywhere else (the old Emscripten build had 32-bitlong). - Public keys now live in
keys/drm_pubkeys.txtinstead of a C header. make wasm,make play,make wasm-testbuild and test the browser build;
it needs thewasm32-unknown-unknownRust target.- The
minizandmonocyphervendor directories are gone (replaced by the
zipcrate and a Rust EdDSA that is byte-compatible with Monocypher's).
Third-party crate licenses: legal/RUST_DEPENDENCIES.md. - Deep recursion/nesting no longer crashes the native interpreter.
cob_interpandpopcorn_compfind theirlib/(and the bundled Zig) fromargv[0]
when/proc/self/exeis unavailable (chroots, minimal sandboxes); the C version failed
there with "shuck ... failed" unlessCOB_STDLIBwas set.- The stale
tools/tests/input.cobtest andinput_native.share gone: they drove the
input()builtin that 0.0.9 replaced withporch_ask();porch_inputand
porch_cases.shcover the same scenarios.
Cob Language v0.0.9
Overview
Three headline features, and one big reorganisation.
Functions. Cob has recipe and serve (a function and its return):
recipe fact(n):
if n <= 1:
serve 1
serve n * fact(n - 1)
pop(fact(10))
A REPL. Run cob_interp with no file for an interactive session; a
bare expression prints its value, blocks continue with ..., and
variables and recipes persist. cob_interp file.cob -i runs a file and
then stays in the REPL with everything it defined. (Interpreter only.)
A real standard library. Everything that is not the core language is
now a separate shared library (.so / .dylib / .dll) loaded with
shuck, and every module and function in it is corn themed:
porch (console input), cornmath, kernels (text), almanac (time),
granary (files), pantry (SQLite), barn (windows), tassel
(Tcl/Tk) and silo (the everyday five in one shuck).
Added
recipe <name>(<params>):/serve [<expr>]: functions, with
recursion (up to 500 calls deep, then a warning and a result of 0
instead of a crash). Parameters and every name a recipesets are
local to it; any other name reads the global; a recipe cannot assign a
global. Recipes are defined at the top level and are hoisted, so a
call may appear above its recipe and recipes may call each other.
A call can also stand alone on a line (greet("Ada")).- Call checking before anything runs: a call to a name that does not
exist, or with the wrong number of arguments, is an error with its
line number, so a typo fails up front, not halfway through the run.
A forgottenshuckgets a hint naming the module to add. - The REPL in
cob_interp(no file,--repl, or-iafter a file):
commands:help,:vars,:recipes,:load <file>,:reset,
:quit; typing a recipe again replaces it; mistakes print an error
and the session carries on. Prompts and the banner appear only on a
terminal, socob_interp --repl < script.txtis scriptable. - The standard library (
stdlib/, built tobin/lib/by
make stdlib):porch,cornmath,kernels,almanac,granary,
pantry,barn,tassel,silo. 40+ functions, listed in the README.
shuck <module>finds the wrapper in the standard library directory
($COB_STDLIB, else<the tool's directory>/lib) after the current
directory andcob_modules/;extern ... from "<module>"finds the
library there too. popcorn_compgains recipes and the whole standard library,
including SQLite and windows, which it could never compile before. It
links-l<module>and records the standard library directory as an
rpath.make testandtools/tests/run_tests.sh: 17 checks, with every
program test run through the interpreter AND the compiler against the
same expected output.- A Docker image, built, smoke-tested and published to
ghcr.io/cob-software-foundation/cob(linux/amd64 + linux/arm64) by
the new.github/workflows/docker.yml: the interpreter and REPL, the
compiler,farmerand the standard library (withoutbarnand
tassel).docker run -it --rm ghcr.io/cob-software-foundation/cob
starts the REPL; see the README for running and compiling programs.
The image build runsmake test, andtools/docker/smoke_test.sh
checks the finished image. The old stress-test image moved to
Dockerfile.stress(ci.yml was updated to match). make cob_interp_static: a build with the browser-capable modules
compiled in, which is also what the WebAssembly build now uses.
Changed (BREAKING)
-
input,input_int, the SQLite keywords, the window keywords and
tcl_eval/tk_evalare no longer built into the interpreter.
They are standard library functions now and must beshucked:input(p) -> shuck porch; porch_ask(p) input_int(p) -> shuck porch; porch_ask_int(p) sql_open/exec/query/close -> shuck pantry; pantry_open/exec/query/close window_open/label/wait/close/button/slider/textbox -> shuck barn; barn_open/label/wait/close/button/slider/textbox tcl_eval / tk_eval -> shuck tassel; tassel_tcl / tassel_tkAn old name gives an error that says exactly what to write instead.
shuck cobwindowis gone with the keywords it acknowledged. -
recipeandserveare new reserved words (so anexterncannot be
named either);input,input_intand the others are no longer
reserved. -
One interpreter instead of three.
cob_interpis the core language
only and builds in about a second with no vendor libraries.
cob_interp_full,cob_interp_dbandcob_interp_windowremain as
maketargets so old scripts keep working: each builds the same
interpreter under the old name plus the modules that build used to
contain. -
Plain
makeno longer needs X11/OpenGL: it buildscob_interp,
popcorn_comp,farmerand the standard library (which includes
pantry).barn(raylib) andtassel(Tcl/Tk) are opt-in:
make stdlib-barn,make stdlib-tassel. -
A program or library file in the current directory shadows a standard
library module of the same name (porch.cobis found before the real
porch). Name your own files accordingly. -
.strawberrycache format bumped fromCOBSTRW9toCOBSTRW10
(the magic is one character longer). The built-in expression kinds
were removed and the survivors renumbered;recipe,serveand
call-statement kinds were added. Old caches are detected as stale and
rebuilt automatically. -
Library warnings are tagged by module (
[porch] warning: ...,
[pantry] warning: ...), and are now identical in the interpreter
and in compiled programs, because both call the same library. -
The harvest/trash
--no-gccheck now also looks insidepop(...)
and conditions, in both tools. -
In the WebAssembly build the sandbox notice is printed once per
library, not once per function.
Fixed
popcorn_comp:set s = s + "x"lost the old value (the variable
was freed before its own right-hand side was read), so a string built
up in a loop ended up as just the last piece. The right-hand side is
now evaluated first.popcorn_comp: operand evaluation order. C leaves the order of
function arguments unspecified, soa() + b()or a comparison of two
calls that print could runbfirst in a compiled program. Compiled
code now evaluates left to right, like the interpreter, whenever both
operands do something observable.
Notes
barnandtasselare ports of the old built-in window and Tcl/Tk
code. They compile against the vendored headers, but could not be
built and run in the environment this release was developed in (no
X11 extension headers for raylib; Tcl/Tk is a long from-source build),
so they have not been run. Please trymake stdlib-barn/
make stdlib-tasselon a real desktop.- The release workflows (
.github/workflows/build.yml) still package a
singlecobbinary. Releases must also ship thelib/directory
next to it (cp -r bin/lib dist/), orshuck porchand friends will
not find their libraries.make embedalready includes it. - The standard library is loaded with dlopen()/LoadLibrary(), so
cob_interpmust be a dynamically linked executable, and a program
compiled bypopcorn_compthat uses it must be too: a statically
linked program (such as a static-musl cross-compile target) cannot use
shared libraries. Cross-compiling a program that shucks stdlib modules
also needs those mo...
Cob v0.0.8
Cob Language v0.0.8
Overview
The headline feature is console input. Cob programs can now ask the
person running them a question and use the answer:
set name = input("What is your name? ")
set age = input_int("How old are you? ")
pop("Hello, " + name + "!")
pop(age + 1)
Added
input(<prompt>)prints the prompt (no trailing newline, flushed),
reads one line from standard input, and returns it as a string with
the line ending removed. At end of input it returns"". The prompt
is optional:input()is allowed.input_int(<prompt>)does the same and parses the line as a
base-10 integer. A line that is not a number (or end of input) returns
0; a non-numeric line also prints a warning on stderr.inputandinput_intare now reserved words when followed by(,
so anexterncan no longer be declared with those names. A variable
namedinput(no parentheses) still works.popcorn_compcompilesinputandinput_inttoo, so compiled
programs read standard input exactly like interpreted ones: same
prompt handling, same end-of-input results, same non-numeric
warning (tagged[cob]instead of[cob_interp], like every compiled
warning). The input runtime is only added to the generated C for
programs that use it, so every other program compiles to the same C
as before.- A regression test,
tools/tests/input.cob, with the lines it reads in
input.stdinand its expected output ininput.expected:
cob_interp tools/tests/input.cob < tools/tests/input.stdin;sh tools/tests/input_native.sh
checks the compiled binary against the interpreter.
Changed
- In the WebAssembly build only (
-DCOB_WASM),popnow flushes stdout
after each line, so a host that captures output byte by byte sees it
as it is printed instead of when libc's buffer fills. .strawberrycache format bumped fromCOBSTRW8toCOBSTRW9.
Two expression kinds (tags 19 and 20,inputandinput_int, one
operand each) were appended after the existing ones, in both
cob_interpandpopcorn_comp. Existing caches are detected as
stale and rebuilt automatically the next time a script runs (you will
see onecache ... unreadable, reparsing sourcenote per script).
Nothing needs to be deleted by hand. The bump also means an older
cob_interpthat finds a cache written by this version re-parses the
source instead of failing on a kind it does not know.popcorn_comp
takes a.strawberryfile as input, so regenerate it with
cob_interpfirst if it complains about the magic.
Verified this session
- Native binaries built by
popcorn_compandcob_interpgive
byte-identical stdout and identical warnings (modulo the[cob]tag)
ontools/tests/input.cobwith five different stdin files: normal,
CRLF line endings with blank and non-numeric answers, immediate end
of input, padded numbers with no trailing newline, and trailing junk
or negatives; and on a program with a 100,000-character line,input
insidewhile/if, and an expression as the prompt. - The generated C runs clean under AddressSanitizer + UndefinedBehavior-
Sanitizer + LeakSanitizer on all of those inputs.
Fixed
popcorn_comp: testing a string for truthiness (if name:,
while text:) leaked the string it tested. The compiled program's
cob_truthynow frees it. Output was never affected; LeakSanitizer
reported it on exit.
Not yet supported
- The browser sandbox has no keyboard. Unless the host page supplies
standard input (Pounce does),input()sees end of input.
Cob Language v0.0.7
Overview
The headline feature is conditionals. Cob now has if, elif and
else:
set score = 85
if score >= 90:
pop("grade: A")
elif score >= 80:
pop("grade: B")
else:
pop("keep practicing")
Both tools support it, and they print identical output for the same
program:
cob_interpparses, caches and runs it.popcorn_compcompiles it to a plain Cif (...) { ... } else { ... }.
Added
-
if <condition>:runs its indented block when the condition is
true. The condition grammar is exactlywhile's:==,!=,<,
>,<=,>=on two numbers or two strings, or a bare expression
as a truthiness test (non-zero for a number, non-empty for a string).
Comparing a string to a number still warns and evaluates to false. -
elif <condition>:andelse:may follow anifat the
SAME indentation. Any number ofelifs, at most oneelse. -
Blocks nest freely:
ifinsideif, insidewhile, andwhile
insideif. -
if,elifandelseare now reserved words, so anexterncan no
longer be declared with one of those names (same rule aswhile,
set,pop, ...). -
Clear syntax errors, each with a line number:
'else' without a matching 'if' at the same indentation'elif' without a matching 'if' at the same indentationmalformed condition in if statement(orelif)expected ':' to open if block(orelif)
-
A signed Debian package and apt repository. One package,
csf-cob(apt package names must be lowercase, soapt install CSF-COBcannot work; it iscsf-cob), carries all four Linux builds
(amd64, i386, arm64, armhf). On install, the post-install script keeps
the one that matches the machine (dpkg --print-architecture) and
deletes the other three;/usr/bin/cob,farmerandpopcorn_comp
run that build, andpopcorn_compstill finds its bundled Zig. It
replaces the oldcobpackage name. To install and keep it updated:sudo mkdir -p /etc/apt/keyrings curl -fsSL https://github.com/Cob-Software-Foundation/Cob/releases/download/apt-repo/cob-gpg-public-key.asc | sudo tee /etc/apt/keyrings/csf-cob.asc > /dev/null echo "deb [signed-by=/etc/apt/keyrings/csf-cob.asc] https://github.com/Cob-Software-Foundation/Cob/releases/download/apt-repo ./" | sudo tee /etc/apt/sources.list.d/csf-cob.list sudo apt update && sudo apt install csf-cobThe repository index (
InRelease,Release.gpg) is signed with the
project's GPG key, and the.debitself also has a detached signature
(csf-cob_<version>_all.deb.asc) plus a SHA-256 file, so it can be
checked by hand withgpg --verify. The repository lives on a
release namedapt-repoand keeps the newest three versions.
The workflow refuses to publish if the signing key is not configured. -
An "if / else" example on the in-browser playground, and
ifon the
website's release notes and download page.
Changed
.strawberrycache format bumped fromCOBSTRW7toCOBSTRW8.
A new statement kind (STMT_IF) was appended, with the condition
followed by the then-block and the else-block. Existing caches are
detected as stale and rebuilt automatically the next time a script
runs (you will see onecache ... unreadable, reparsing sourcenote
per script). Nothing needs to be deleted by hand.elifis not a separate kind in the cache or the compiler: the
parser turns it into anifnested inside the previouselse, so
the cache reader/writer and the code generator only ever deal with
if/else.
Verified this session
- A test script (
tools/tests/if_statements.cob, with its expected
output intools/tests/if_statements.expected) covering if, if/else,
an if/elif/elif/else chain, anifnested inside anelifbranch
inside awhileloop, string equality and inequality, and the
truthiness of0and"", produces byte-identical output cold,
against its own.strawberrycache, and as a native binary built by
popcorn_comp. cob_interpcompiles clean under-Wall -Wextra -Wpedanticand runs
clean under AddressSanitizer + UndefinedBehaviorSanitizer +
LeakSanitizer on the valid program (cold and cached) and on seven
malformed programs, including errors in the middle of an
if/elif/elsechain (a badelifcondition, a bad statement
inside anelsebody, a secondelse, a missing colon, anelse
with noif), which free a half-built chain.- The package and the signed apt repository were exercised with the
workflow's own scripts, serving the repository over HTTP to real apt
with throwaway keys:apt updateaccepts the signature,apt install csf-cobresolves its dependencies and installs,cobruns an
if/elsescript, an upgrade from one version to the next works and
leaves only the matching build, a package list changed after signing
is refused, an index signed by a different key is refused, and the
oldest of four published versions is pruned.apt install CSF-COB
fails withUnable to locate package, as expected. - The
.debpackaging steps frombuild.ymlwere run end to end on an
amd64 machine against a package tree laid out like the real Linux
build artifacts. The package installed, kept only theamd64build,
linkedcurrentto it, ran anif/elif/elsescript withcob,
compiled and ran it withpopcorn_compthrough the launcher (which
found the Zig next to the real binary, not next to/usr/bin), and
then removed cleanly. - Signing was exercised with throwaway keys, both unprotected and
passphrase-protected: the signature verifies from an empty keyring
holding only the published public key, a one-byte change to the
.debmakes verification fail, no private key material appears in
any published file, and the key and passphrase file are removed from
the runner afterwards. A push with no key fails the job, a fork pull
request builds unsigned and skips signing, and a protected key with no
passphrase fails without producing a signature. - A
COBSTRW7cache and a truncatedCOBSTRW8cache are both ignored
with a note and the script is re-parsed correctly, rather than
misread. - The existing arithmetic stress script still runs, and the widget
smoke script still runs in a plainmake cob_interpbuild. - Th...
Cob apt repository
Signed apt repository for the csf-cob package. Not meant to be downloaded by hand; see the install instructions in the latest Cob release.
In the near feature this will be moved to https://downloads.pixel-pulse.dev
Cob v0.0.7
Cob Language v0.0.7
Overview
The headline feature is conditionals. Cob now has if, elif and
else:
set score = 85
if score >= 90:
pop("grade: A")
elif score >= 80:
pop("grade: B")
else:
pop("keep practicing")
Both tools support it, and they print identical output for the same
program:
cob_interpparses, caches and runs it.popcorn_compcompiles it to a plain Cif (...) { ... } else { ... }.
Added
-
if <condition>:runs its indented block when the condition is
true. The condition grammar is exactlywhile's:==,!=,<,
>,<=,>=on two numbers or two strings, or a bare expression
as a truthiness test (non-zero for a number, non-empty for a string).
Comparing a string to a number still warns and evaluates to false. -
elif <condition>:andelse:may follow anifat the
SAME indentation. Any number ofelifs, at most oneelse. -
Blocks nest freely:
ifinsideif, insidewhile, andwhile
insideif. -
if,elifandelseare now reserved words, so anexterncan no
longer be declared with one of those names (same rule aswhile,
set,pop, ...). -
Clear syntax errors, each with a line number:
'else' without a matching 'if' at the same indentation'elif' without a matching 'if' at the same indentationmalformed condition in if statement(orelif)expected ':' to open if block(orelif)
-
A signed Debian package and apt repository. One package,
csf-cob(apt package names must be lowercase, soapt install CSF-COBcannot work; it iscsf-cob), carries all four Linux builds
(amd64, i386, arm64, armhf). On install, the post-install script keeps
the one that matches the machine (dpkg --print-architecture) and
deletes the other three;/usr/bin/cob,farmerandpopcorn_comp
run that build, andpopcorn_compstill finds its bundled Zig. It
replaces the oldcobpackage name. To install and keep it updated:sudo mkdir -p /etc/apt/keyrings curl -fsSL https://github.com/Cob-Software-Foundation/Cob/releases/download/apt-repo/cob-gpg-public-key.asc | sudo tee /etc/apt/keyrings/csf-cob.asc > /dev/null echo "deb [signed-by=/etc/apt/keyrings/csf-cob.asc] https://github.com/Cob-Software-Foundation/Cob/releases/download/apt-repo ./" | sudo tee /etc/apt/sources.list.d/csf-cob.list sudo apt update && sudo apt install csf-cobThe repository index (
InRelease,Release.gpg) is signed with the
project's GPG key, and the.debitself also has a detached signature
(csf-cob_<version>_all.deb.asc) plus a SHA-256 file, so it can be
checked by hand withgpg --verify. The repository lives on a
release namedapt-repoand keeps the newest three versions.
The workflow refuses to publish if the signing key is not configured. -
An "if / else" example on the in-browser playground, and
ifon the
website's release notes and download page.
Changed
.strawberrycache format bumped fromCOBSTRW7toCOBSTRW8.
A new statement kind (STMT_IF) was appended, with the condition
followed by the then-block and the else-block. Existing caches are
detected as stale and rebuilt automatically the next time a script
runs (you will see onecache ... unreadable, reparsing sourcenote
per script). Nothing needs to be deleted by hand.elifis not a separate kind in the cache or the compiler: the
parser turns it into anifnested inside the previouselse, so
the cache reader/writer and the code generator only ever deal with
if/else.
Verified this session
- A test script (
tools/tests/if_statements.cob, with its expected
output intools/tests/if_statements.expected) covering if, if/else,
an if/elif/elif/else chain, anifnested inside anelifbranch
inside awhileloop, string equality and inequality, and the
truthiness of0and"", produces byte-identical output cold,
against its own.strawberrycache, and as a native binary built by
popcorn_comp. cob_interpcompiles clean under-Wall -Wextra -Wpedanticand runs
clean under AddressSanitizer + UndefinedBehaviorSanitizer +
LeakSanitizer on the valid program (cold and cached) and on seven
malformed programs, including errors in the middle of an
if/elif/elsechain (a badelifcondition, a bad statement
inside anelsebody, a secondelse, a missing colon, anelse
with noif), which free a half-built chain.- The package and the signed apt repository were exercised with the
workflow's own scripts, serving the repository over HTTP to real apt
with throwaway keys:apt updateaccepts the signature,apt install csf-cobresolves its dependencies and installs,cobruns an
if/elsescript, an upgrade from one version to the next works and
leaves only the matching build, a package list changed after signing
is refused, an index signed by a different key is refused, and the
oldest of four published versions is pruned.apt install CSF-COB
fails withUnable to locate package, as expected. - The
.debpackaging steps frombuild.ymlwere run end to end on an
amd64 machine against a package tree laid out like the real Linux
build artifacts. The package installed, kept only theamd64build,
linkedcurrentto it, ran anif/elif/elsescript withcob,
compiled and ran it withpopcorn_compthrough the launcher (which
found the Zig next to the real binary, not next to/usr/bin), and
then removed cleanly. - Signing was exercised with throwaway keys, both unprotected and
passphrase-protected: the signature verifies from an empty keyring
holding only the published public key, a one-byte change to the
.debmakes verification fail, no private key material appears in
any published file, and the key and passphrase file are removed from
the runner afterwards. A push with no key fails the job, a fork pull
request builds unsigned and skips signing, and a protected key with no
passphrase fails without producing a signature. - A
COBSTRW7cache and a truncatedCOBSTRW8cache are both ignored
with a note and the script is re-parsed correctly, rather than
misread. - The existing arithmetic stress script still runs, and the widget
smoke script still runs in a plainmake cob_interpbuild. - The
-DCOB_WASMconfiguration (the same definesmake wasmuses)
compiles natively and gives the same output on the test script.
Not verified
make wasmhas not been run here: Emscripten is not installed in
this environment. The code is plain C99 with no new dependencies and
the-DCOB_WASMflavor was compiled natively as described above, but
the first realemccbuild will be whatever CI run triggers it.
Pounce (the block-coding front end) builds from this source, so it
inherits that gap.- The
debandapt-repojobs have not run on GitHub Actions, signing
has not been run with the realGPG_PRIVATE_KEY, and the repository has
not yet been fetched through GitHub's release-asset URLs (which redirect
to a CDN; apt follows redirects, but this was not tried against GitHub
itself). In the local run the amd64 build
was real but the Zig was a stand-in that forwards to gcc, and the
i386, arm64 and armhf builds were placeholders, so those three were
packaged but never installed or run on matching hardware. - The
.debis oneArchitecture: allpackage holding binaries for
several architectures, which is not how Debian packaging is normally
done and whichlintianwill complain about.dpkg --verifyreports
the deleted other-architecture files as missing, by design.apt
does not check detached.ascsignatures on a loose.deb; the
signature is for manual verification, not for anaptrepository. popcorn_comp's-Wpedanticbuild still emits one warning about an
over-long string literal in the C runtime preamble. It was already
there before this release and this release did not touch it.- Everything Windows/macOS/cross-compile-related that previous
releases flagged as not verified on real hardware remains not
verified; this release touched none of that code. - The website changes (
docs/index.html,docs/download.html,
docs/play/index.html) were edited but not opened in a browser, and
the new playground example has not been run in the WebAssembly
playground. - The full CI suite (
ci.yml,build.yml, the Docker stress image)
has not been run on this change.
Cob v0.0.6
Cob Language v0.0.6
Overview
The headline feature is CEP-2: a C API / FFI for native Cob
extensions. A Cob script can now call a real, exported C function:
extern calculate_fast(x) from "math_ext.so"
pop("result=" + calculate_fast(42))
and the native side is an ordinary C function against one fixed
signature, with no Cob-specific build step of its own:
#include "cob.h"
COB_EXPORT CobValue calculate_fast(CobValue *argv, int argc) {
if (argc < 1 || argv[0].kind != COB_INT) return cob_int(0);
return cob_int(argv[0].as.i * argv[0].as.i + 1);
}Both tools support it, with two different, deliberately-matched
strategies:
cob_interpresolvesexterneagerly, right when the
statement runs -- not lazily on first call -- usingdlopen()/
dlsym()on Linux/macOS andLoadLibraryA()/GetProcAddress()on
Windows. A missing library or symbol prints one warning and binds a
harmless stub that evaluates to0; it never aborts the script.popcorn_complinks statically: it emits a real
extern CobValue name(CobValue*, int);forward declaration into the
generated C and passes the named library straight to the spawned
compiler's command line (-lname, or the literal path, matching
CEP-2's own examples) -- nodlopen()anywhere in the compiled
binary. Because that's a static link, the same extern name can't be
pointed at two different libraries anywhere in one program; doing so
is a clear compile-time error instead of silently picking one.
Second: a WebAssembly build of the pure-language core now powers an
in-browser playground at /play -- try Cob with zero install, no
download, nothing sent anywhere. It's deliberately the stripped-down
cob_interp core: no SQLite, no Tcl/Tk, no _cobwindow, and no
extern (a browser tab can't dlopen() anything). All of those
keywords still parse in that build; they just quietly no-op and
print a one-time notice to the sandbox's own output instead of
crashing, so the rest of the script keeps running:
WARNING [COB Warning]: Desktop graphics (_cobwindow) and storage (SQLite) are bypassed in the web sandbox.
-> Download the native compiler at cob.pixel-pulse.dev/download.html to launch full windows and databases on your desktop!
Also in this release: --license actually works now (see "Fixed"
below), and the project finished moving off its old *.work.gd/
*.duckdns.org hostnames onto pixel-pulse.dev everywhere -- the
license notices, the security contact, the package-registry default
URL, and the website.
Added
C API / FFI (CEP-2)
extern <name>(<param>, ...) from "<library>"
include/cob.h-- the one header a native extension needs: the
CobValuestruct (anint/stringtagged union, matching Cob's own
two value kinds exactly), theCobFFIFuncsignature every native
function has regardless of how many arguments it takes, and
cob_int()/cob_str()constructors for building a return value.
COB_EXPORTmakes the symbol visible todlsym()/GetProcAddress()
(required on Windows; harmless elsewhere).- Parameter names in
extern name(x, y) from "lib"are accepted for
readability but carry no type information and aren't stored --
arity is deliberately not checked against the native function,
matching how Cob already treats every other call. - An
externname can't reuse a keyword or a built-in call name
(extern pop(x) from "lib"is a syntax error) -- the built-in would
otherwise silently win at every call site, which is a worse failure
mode than refusing the declaration outright. .strawberrycache format bumped toCOBSTRW7(fromCOBSTRW6):
STMT_EXTERNandEXPR_EXTERN_CALLround-trip through the cache
the same way every other statement/expression kind does.popcorn_complink arguments: a library named with a path or
extension ("math_ext.so","./a.so") is passed to the compiler as
a literal link input, matching CEP-2's own example; a bare name with
neither ("m", forlibm) becomes a conventional-lmflag. A
bare-filename native library (no directory component) also gets a
-Wl,-rpathpointed at the directorypopcorn_compran from, so
"the.sositting next to the script" resolves automatically at
run time without needing$LD_LIBRARY_PATHset by hand -- Windows
and macOS/Linux-without-a-path-like-library skip this; PE's DLL
search order already includes the executable's own directory.tools/ffi/-- a worked example:math_ext.c(four native
functions covering int args/returns, string args/returns, variable
arity, and a zero-argument call) plusffi_test.cobexercising all
of them, including a nested call (calculate_fast(calculate_fast(2)))
and a nonexistent symbol.
Browser sandbox / WebAssembly (make wasm, make play)
make wasmcompilessrc/file_io.c+src/cob_interp.cwith
Emscripten and-DCOB_WASM-- deliberately just those two files,
with none ofCOB_WITH_SQLITE/COB_WITH_TCL/COB_WITH_TK/
COB_WITH_COBWINDOWdefined, so there's novendor/build at all:
no SQLite, no Tcl/Tk (and therefore no autoconf), no raylib/raygui.
make playdoes the same and copies the two output files
(cob_interp.js,cob_interp.wasm) intodocs/play/, next to the
playground page.sql_open/sql_exec/sql_query/sql_close, every_cobwindow
keyword, andshuck cobwindowall still parse under-DCOB_WASM
and become silent no-ops, printing the sandbox notice to stdout
once per run (not once per call) the first time any of them is hit.externgets its own tailored sandbox notice (there's genuinely no
dlopen()in a.wasmmodule, so this isn't the same "feature
compiled out" situation as SQLite/_cobwindow-- it's a hard
platform limit) and evaluates to0, same as a failed native bind.docs/play/index.html-- the actual playground: a two-pane editor/
terminal page matching the rest of the site's design, four example
scripts (including one that deliberately exercises the sandbox
no-op path), Ctrl/Cmd+Enter to run, and a fresh WebAssembly module
instance per run (so script state, the once-per-run warning flag,
and the extern table all start clean every time)..github/workflows/pages.ymlnow builds the WASM module (a real,
version-pinnedemsdk, not a distro package -- see "Fixed" below
for why that distinction mattered) immediately before uploading
docs/as the Pages artifact, since the two generated files are
.gitignore'd on purpose rather than committed and left to drift
fromsrc/cob_interp.c.- A
Playlink in the site nav on every page.
--license
Every tool (cob_interp, popcorn_comp, farmer) now actually
supports --license, printing the short PolyForm Noncommercial notice
and exiting 0 -- and it's documented in each tool's own usage/--help
text this time, not left as a hidden flag with a comment claiming it
works. See "Fixed" below.
CI
test_ffi(build.yml): builds a tiny native extension with plain
gcc, then round-trips a script usingexternthree ways --
cob_interpcold,cob_interpagainst its own.strawberrycache,
andpopcorn_comp's statically-linked output -- diffing all three
against each other. Also confirms the missing-library path warns and
returns0instead of crashing.test_wasm(build.yml): builds the WASM sandbox for Node
(WASM_ENV=node, not the defaultweb,workerthe real site ships),
runs a plain script and confirms its output, then runs a script
usingsql_openandexterntogether and confirms both the
sandbox-warning text and that the script still finishes.
Fixed
--licensewas dead code.cob_print_license()existed in
include/common.hbut nothing ever called it, and--license
wasn't recognized by any of the three tools' argument parsing --
cob_interp --licenseprinted "unrecognized flag" and exited 1,
directly contradicting the comment sitting right above
COB_LICENSE_NOTICEthat described it as a real, working flag.
Added a sharedcob_check_hidden_license_flag()(mirroring the
existing--versionhelper) and wired it into all three tools'
main(), plus their usage text -- unlike--version, this one is
meant to be discoverable, not hidden.- A real use-after-free in
popcorn_comp's generated FFI adapter.
The first version of the generated C converted each argument to the
nativeCobFFIValueform by aliasing its string pointer, then
immediately freed the sourceCobValue-- before the native
function that still held the aliased pointer had actually been
called.greet("corn")compiled fine and ran, but printed garbage
instead of"Hello, corn!". Fixed by moving the free to after the
native call returns, matchingcob_interp.c's own real evaluation
order (evaluate all arguments, call the function, free() them only
then) -- caught by actually running the compiled output and
comparing it against the interpreter's output for the same script,
not just by getting both to compile cleanly. sb_appendf()'s fixed internal buffer (512 bytes) was too small
for the new FFI adapter's multi-line template and would have
silently truncated it viavsnprintf(), producing broken, half-written
C that would have failed far away, inside the spawned compiler, with
no indication why. Enlarged to 4096 bytes and added an explicit
check that now treats a would-be truncation as a hard error instead
of silently emitting partial output -- a correctness fix for every
other call site in the file, not just the new one.- Old
*.work.gd/*.duckdns.orghostnames, replaced with
pixel-pulse.devthroughout: the security contact
(.github/SECURITY.md), every copyright notice's required-notice
URL (LICENSE.md,legal/LICENSE.md,EMBED-README.md,
include/common.h), the package-registry default base URL
(`COB_FARM...
Cob v0.0.5
Cob Language v0.0.5
Overview
Three new capabilities for cob_interp, all opt-in and none of them
affecting the interpreter's original zero-dependency build:
- SQLite (
sql_open/sql_exec/sql_query/sql_close) and
_cobwindow, a native-window GUI backed by raylib
(window_open/window_label/window_wait/window_close) with
real, interactive raygui widgets (window_button/
window_slider/window_textbox), are now baked into
cob_interp_full-- the binary plainmakebuilds by default.
Both build with a plainMakefile, noconfigure/autoconf step for
either, so a cleanmakefrom a fresh checkout builds everything
itself in well under a minute. - Tcl/Tk (
tcl_eval/tk_eval) are still available, but no longer
part of the default build --make cob_interp_dbbuilds a separate
binary with them, for anyone who specifically wants that and is
willing to accept a much heavier, autoconf-based Tcl/Tk source build
(see "Fixed" below for what that build fights through on some
Windows toolchains). make cob_interpremains the original lightweight interpreter --
no SQLite, no_cobwindow, no Tcl/Tk, no vendor build at all.
Also new this release: a stress-test suite (tools/stress/), a
Dockerfile to run it in a reproducible container, and both a
ci.yml GitHub Actions workflow that runs it in Docker and natively,
and a build.yml workflow that now also round-trips the widget
keywords through the .strawberry cache.
Added
SQLite bindings
sql_open(<path>) -> handle (int, 0 on failure)
sql_exec(<handle>, <sql>) -> rc (int, 0 on success)
sql_query(<handle>, <sql>) -> string (first column of first row, "" if none)
sql_close(<handle>) -> 0
set h = sql_open("scores.db")
set rc = sql_exec(h, "CREATE TABLE IF NOT EXISTS t (name TEXT)")
set rc = sql_exec(h, "INSERT INTO t VALUES ('cob')")
set name = sql_query(h, "SELECT name FROM t LIMIT 1")
pop("got: " + name)
set rc = sql_close(h)
Builds via a single-file amalgamation (vendor/SQLite/sqlite3.c) --
no configure step, compiles the same way on every platform.
_cobwindow -- a native-window GUI backed by raylib, now with real widgets
window_open(<title>) -> handle (int, 0 on failure)
window_label(<handle>, <text>) -> 0 (sets/replaces the in-window text)
window_wait(<handle>, <seconds>) -> 0 (keeps the window responsive for ~<seconds>)
window_close(<handle>) -> 0
window_button(<h>, <label>) -> 1 if clicked since the last read of
that label, else 0
window_slider(<h>, <label>, <max>) -> current value, 0..<max>, as an int
window_textbox(<h>, <label>) -> current string contents of the box
shuck cobwindow
set h = window_open("Cob Window Demo")
set rc = window_label(h, "Hello from Cob!")
set clicked = window_button(h, "OK")
set volume = window_slider(h, "Volume", 100)
set name = window_textbox(h, "Name")
set rc = window_wait(h, 5)
set rc = window_close(h)
Backed by vendor/raylib (real 2D/3D graphics, proper anti-aliased
text rendering) instead of raw Win32/Xlib calls -- one build recipe
and one code path for every platform, rather than hand-maintained
separate Win32 and Xlib implementations. raylib's own build is a
plain Makefile: no configure, no autoconf, so none of the
busybox-ash/vendor-tree fragility documented under "Fixed" below
applies to it.
vendor/raygui (a header-only immediate-mode widget library that
draws on top of raylib) is now wired up to Cob syntax as
window_button/window_slider/window_textbox. Each widget is
identified by its own label text -- the first call with a new label
creates it, auto-stacked on screen below the window_label() text;
every later call with that same label (and kind -- a button and a
slider can share a label without colliding) reads or updates that
same widget. Declaring and reading happen in the same call, since Cob
has no separate "declare once, poll every frame" mechanism -- a
button's click flag resets on read, so a click is reported exactly
once; a slider re-ranges (and clamps) if called again with a
different <max>; a textbox is always in raygui's edit mode, since
Cob has no click-to-focus concept to hook a toggle to.
raylib only supports one native window per process (InitWindow()/
CloseWindow() are process-global, not per-handle) -- window_open()
called again before the first window is closed warns and returns 0,
same "0 means failure" convention every other handle-returning keyword
here uses. The close button ([X]) is intentionally swallowed -- Cob
has no callback mechanism to notify a running script that the user
clicked it, so the window keeps running until window_wait()'s timer
runs out or window_close() is called explicitly, the same
"explicit close only" model harvest()/trash() already use for
memory.
Verified for real, not just built: ran a .cob script against
cob_interp_window/cob_interp_full on a live (headless, via Xvfb)
X11 display and confirmed with actual screenshots that a real window
opened showing the label text, a button, a slider (with a readable
caption -- see "Fixed" below), and an editable text box with a
blinking cursor, all rendered with proper anti-aliased text.
cob_interp_full -- SQLite + _cobwindow, the new default
make (no target, i.e. make all) now builds cob_interp_full
instead of the lightweight cob_interp. It lists $(SQLITE_LIB) and
$(RAYLIB_LIB) as real Make prerequisites, so a single make builds
SQLite and raylib from vendor/ itself, with no separate build steps,
no configure/autoconf anywhere in the chain, and (confirmed) well
under a minute on a clean checkout.
make cob_interp still builds the original lightweight binary --
zero vendor dependency, builds in under a second -- for anyone who
wants that explicitly instead of the new default.
Kept as opt-in: cob_interp_db (SQLite + Tcl + Tk)
tcl_eval(<script>) -> string (Tcl's string result)
tk_eval(<script>) -> string (same interpreter as tcl_eval, plus Tk)
Still available via make cob_interp_db for anyone who specifically
wants tcl_eval()/tk_eval(). This needs a real Tcl/Tk source build
(make sqlite tcl tk, or cob_interp_db triggers it automatically
the same way cob_interp_full triggers SQLite/raylib) -- see "Fixed"
below for the autoconf/busybox-ash issues that build can hit on some
Windows toolchains, now resolved for the two specific failures
reported so far. _cobwindow is not part of this binary; use
cob_interp_full for that.
Stress-test suite, Dockerfile, ci.yml, and build.yml
tools/stress/run_stress.sh builds cob_interp_full and runs three
.cob scripts designed to catch regressions that only show up under
sustained load, not a single quick smoke test:
stress_arithmetic.cob-- 200,000-iteration loop (interpreter
overhead/stability)stress_sqlite.cob-- 2,000 sequentialINSERTs + a query (SQLite
under load)stress_window.cob-- 20 open/label/wait/close cycles (resource
leaks in the raylib backend would show up as the loop slowing down
or crashing, not just "does it open one window")
Dockerfile builds cob_interp_full in a clean Ubuntu 24.04
container with exactly the dependencies it needs (X11 + OpenGL dev
headers, Xvfb) and runs the stress suite as its entrypoint:
docker build -t cob-stress .
docker run --rm cob-stress # one pass
docker run --rm cob-stress --iterations 20 # repeat 20x
.github/workflows/ci.yml runs the same suite two ways -- once via
the Dockerfile (docker-stress job), once directly on the runner
(native-stress job) -- on push/PR to main, nightly on a schedule,
and on manual dispatch with a configurable iteration count.
.github/workflows/build.yml's test_extensions job now also opens
a real headless X11 window and round-trips window_button/
window_slider/window_textbox through the .strawberry cache --
write once, run again to force a cache hit, diff the two runs' output
-- specifically to catch a broken write_expr()/read_expr() pair
for the three new widget expression kinds (see "Fixed" below for why
this matters more than it might sound like).
Legal: raylib/raygui licenses
legal/license_raylib.terms and legal/license_raygui.terms added
(both zlib License). LICENSE.md's "THIRD-PARTY LICENSE NOTICE"
section was also out of date -- it only mentioned TinyCC, which isn't
even in this repo anymore -- rewritten to list every vendored
component actually present (miniz, SQLite, Tcl, Tk, raylib, raygui)
and where its license text lives.
cpi.cob.pixel-pulse.work.gd: fixed the "Package registry" 404 (separate repo)
docs/index.html's footer nav links "Package registry" to
.../download.html, which never existed on the cpi registry site
(Cob-Software-Foundation/cpi, a separate repo) -- only index.html
did, so the link 404'd. Added docs/download.html there: fetches
api/v1/packages/index.json and each manifest client-side, renders
them as cards matching the site's styling. This is a change to the
cpi repo, not this one -- shipped as its own small zip alongside
this release, not included in the main source zip.
Fixed
popcorn_comp: .strawberry magic constant was three format bumps stale
Repro: any plain .cob script, no SQL/window keywords required --
./cob smoke.cob then ./popcorn_comp smoke.strawberry -o smoke_native
failed with:
[popcorn_comp] error: 'smoke.strawberry' is not a valid .strawberry v3 file
Root cause: popcorn_comp.c keeps its own independent, byte-for-
byte-compatible copy of the .strawberry reader (documented in its
own header comment as deliberately duplicated from cob_interp.c),
including its own STRAWBERRY_MAGIC constant. cob_interp.c's magic
has mov...
Cob v0.0.3-bug-fix-1 (EOL)
⚠️ ARCHIVED / END OF LIFE (EOL)
NOTICE: This version is preserved strictly for historical reference. It will not receive future patches. Please migrate to the secure v0.0.3 bug fix 2 Release.
ℹ️ Hey There is a new version out v0.0.3 bug fix 2 available, we recommend upgrading to that version.
Cob Language v0.0.3-bug-fix-1
Fixed
popcorn_comp: Windows system() quoting bug in bundled-Zig auto-resolve
find_bundled_zig_cc() returns a pre-quoted compiler string ("path" cc).
cob_spawn_compile() then appends further quoted arguments (-o "out" "in"),
producing a command line with multiple separate quoted tokens that starts
with a quote.
On Windows, system() hands this to cmd.exe /c <string>. cmd.exe strips
only the first and last " of a command line that starts with a quote —
not matching pairs — which corrupts multi-token quoted strings like this
one. This meant auto-resolving a bundled zig/ folder next to the binary
failed with '...' is not recognized as an internal or external command,
even though the equivalent compiler invocation worked fine when passed
explicitly via --cc (which isn't pre-quoted).
Fix: on Windows, if the built command starts with a quote, wrap the whole
command in one more pair of quotes before calling system() — the standard
workaround for this cmd.exe behavior. --cc/$CobCC paths are untouched.
Only popcorn_comp (src/popcorn_comp.c) changed in this release; cob_interp
and farmer are unchanged from v0.0.3.
Not yet verified: on a real Windows machine with a genuine bundled Zig
folder. Verified so far: compiles clean, no regression to the --cc/$CobCC
explicit-compiler path, which was already unaffected by the bug.
Cob Language v0.0.3 — Project Obsidian Falcon
A corn-themed hybrid language with Python-style indentation, an interpreter, a native compiler, and a package manager.
What's new in v0.0.3
popcorn_comp: dropped embedded TCC, now spawns a real compiler
Earlier versions statically linked TCC's own compiler source (libtcc.c) directly into popcorn_comp. That's gone — popcorn_comp now transpiles a .strawberry file to plain C and spawns a real C compiler as a subprocess to produce the native executable.
- Default backend is Zig's
zig cc— a Clang-based drop-in C compiler that bundles libc/CRT files for essentially every target in a single install. That's what makesCobOS/CobArchcross-compiling a plain-targetflag instead of needing a separately installed cross-toolchain per platform. - Compiler resolution order:
--cc <path>→$CobCC→$CobOS/$CobArch(looked up in a table of Zig target triples) → plainzig cconPATHfor native builds. - Linux targets default to
musllibc, notglibc— produces fully static binaries with no runtime libc dependency. - Windows ARM32 is not supported (cut this cycle — it was also the target we were least confident Zig fully supports).
--emit-c <path.c>still works, for inspecting the generated C.
CobOS=windows CobArch=amd64 popcorn_comp prog.strawberry -o prog.exe
# -> spawns: zig cc -target x86_64-windows-gnu ...
farmer: real in-process zip extraction via miniz, plus zip-slip protection
farmer harvest used to shell out to unzip (Unix) or Expand-Archive (Windows) to extract downloaded packages. It now extracts in-process using the statically-linked miniz library instead — one less external tool required on the system.
- Every extracted archive entry's path is checked against zip-slip path traversal before anything is written to disk. A malicious
../../../../etc/whateverentry is rejected outright, with nothing written outside the destination directory. - Nested directories inside a package zip are now handled correctly regardless of whether the archive includes explicit directory entries.
- The package registry now lives in its own dedicated repo,
pixel-pulse-labs/cpi—farmer's default base URL was updated to match. Override anytime with$COB_FARMER_BASE_URL.
Documentation site
docs/index.html in this repo is now real language and tool reference documentation — every keyword (pop, set, while, shuck, harvest/trash, the _MakeCache directive) and all three CLI tools, each with usage and flags. The package-registry landing page that used to live here moved to the cpi repo, where it belongs.
Vendored libraries (not yet wired into Cob's language)
Added under vendor/ as embeddable/linkable libraries, per project decision. None of these have Cob-facing keywords yet — that's a separate design step.
- SQLite 3.53.4 — the single-file amalgamation build (
sqlite3.c/sqlite3.h). - Tcl 9.0.4 and Tk 9.0 — full source distributions, built via their own
configure/make(make tcl,make tktargets added to theMakefile). Tk requires real X11 development headers on the build machine. - miniz 3.1.1 — backs
farmer's zip extraction (see above).
CI
cob_interp,farmer, andpopcorn_compall build across the full 9-target matrix (Windows/Linux/macOS × amd64/386/arm64/arm as applicable — down from 10 after cutting Windows ARM32).- A real end-to-end smoke test now runs for
popcorn_compon native Linux amd64: compile a.cobprogram, run it throughpopcorn_comp, diff the output against the interpreter. - Fixed a bug in the TCC upstream-sync workflow where a
conftest.cfile./configuregenuinely needs was being silently dropped on every sync, because TCC's own vendored.gitignorehas aconftest*pattern that collaterally matched the tracked source file. (Now moot for this repo specifically, sincepopcorn_compno longer depends on TCC at all — but the underlying.gitignore-collision lesson is worth knowing if vendoring other C projects.)
Known gaps, stated plainly
- You need Zig installed for
popcorn_comp's default backend to work. This wasn't testable end-to-end in the environment these notes were written in (no network access toziglang.org) — the command-construction logic was verified against a stub, but real compiles need verification on an actual machine with Zig installed. - SQLite/Tcl/Tk are buildable, not usable from Cob yet. No
sqlopen, no Tclshuck-equivalent, no Tk widget keywords. Proving they build and link was this cycle's scope. popcorn_compisn't smoke-tested on the other 8 targets in CI — only native Linux amd64, since that's the only target whose output can actually execute on the CI runner without emulation.
Upgrading from v0.0.2
If you have scripts calling popcorn_comp and relying on the old CobOS/CobArch → cross-gcc-binary-name behavior, note that resolution now targets Zig triples instead. Install Zig, or pass --cc <path>/$CobCC to keep using a specific compiler directly.
Binaries are provided per-platform in this release. Verify downloads against checksums.txt.
Cob v0.0.4 (EOL)
Cob Language v0.0.4
Added
Strings — a real second value type
Cob variables were integers only, full stop, since the language's
first release. This adds a second kind of value: strings. This is a
new capability, not a bug fix, which is why it's versioned 0.0.4
rather than another 0.0.3-bug-fix-N.
What's new, concretely:
pop(<expr>)now accepts any expression, not just a string
literal.pop(x)prints an int variable's decimal value or a
string variable's contents. This was the single most-requested gap
in the language up to this point — there was previously no way to
print a computed value at all.setaccepts string literals:set name = "world". A
variable's "type" is just whatever it was lastsetto; Cob still
has no type declarations.- String concatenation via
+:"hello, " + name. If either
side of+is a string, the other side is stringified (an int
becomes its decimal digits) and the two are joined.-,*,/
still require two numbers, same as before, and now report a clear
warning (result treated as 0) rather than silently doing something
undefined if given a string. - String comparison in
while/conditions:==,!=,<,>,
<=,>=all work on two strings (strcmp-based ordering) exactly
as they already did on two numbers. Comparing a string to a number
is a warning, evaluating to false, rather than an implicit,
surprising conversion either direction. - Truthiness for a bare condition now applies to strings too: a
non-empty string is truthy, matching non-zero for numbers.
What did NOT change
harvest()/trash(), shuck, while loop semantics and the
10,000,000-iteration safety cap, and the --no-gc/--no-cache flags
are all unchanged and re-verified below.
popcorn_comp also compiles string-using programs now
Originally shipped as cob_interp-only in this same release, with
popcorn_comp support called out as follow-up work. That follow-up is
done: popcorn_comp now compiles .cob programs that use strings into
real, standalone native binaries too.
popcorn_comp has its own separate copy of the expression AST and its
own C code generator (it doesn't share code with cob_interp), so this
needed a real second implementation, not a shared fix. Every Cob
variable is now emitted as CobValue — a small tagged struct (int or
string) — instead of a plain long, and every operator becomes a
call into a small hand-written C runtime embedded at the top of the
generated file (cob_add, cob_eq, cob_pop, etc.) instead of a raw
C operator. That runtime deliberately mirrors cob_interp's
eval_expr/eval_cond logic, including the exact warning wording, so a
compiled program's behavior matches its interpreted behavior — same
results, same warnings, same fallback-to-0 on a type mismatch. The
one intentional difference: compiled-code warnings are tagged [cob]
rather than [cob_interp], since a compiled binary is its own
standalone program, not the interpreter.
popcorn_comp's own .strawberry reader was updated to the same v3
format (EXPR_STR, STMT_POP holding a general expression) so it
can read caches cob_interp now writes.
A real bug found and fixed before shipping this: the first
version of the string runtime used the platform's strdup(), which
isn't part of strict C99 — under -std=c99 it has no declaration, so
GCC implicitly assumed it returned int, truncating the returned
pointer and segfaulting on the very first string literal. Fixed by
hand-writing a small portable duplicate (cob_strdup_, malloc +
memcpy) instead of depending on a POSIX extension — the same pattern
cob_interp's own cob_strdup already used for exactly this reason.
A real leak found and fixed before shipping this: the first
version of the code generator never freed a variable's final string
value when the compiled program exited — cob_interp does this via
vars_free() at shutdown, but the generated C had no equivalent.
Fixed by emitting a cob_free() call for every declared variable
right before return 0 in generated main().
Also fixed in the same pass: pop(x) — printing a variable —
wasn't being scanned for variable names to declare in the generated
C, since the old codegen assumed pop() could only ever take a fixed
literal with no variables in it. A compiled program using pop(x)
would have referenced an undeclared C variable and failed to compile.
Verified this release, for popcorn_comp specifically:
- Every test used to verify cob_interp's string support was re-run
through the full pipeline —cob_interpproduces a.strawberry
cache,popcorn_compcompiles it, the resulting binary is run, and
its output is diffed againstcob_interp's own interpreted output
for the identical source. All matched exactly: the original
all-integer countdown example, string literals, concatenation
(string+string and string+int),pop()of both an int and a string
variable, string equality and ordering comparisons, both
type-mismatch warning paths,harvest()/trash()including a
dynamic (variable) byte count and a negative-size warning, the full
mathpackage (which exercisesshuck, six PASS assertions, and
the tally display), and the 2,000-iteration string-reassignment
stress test. - Every one of those, compiled and run, was also checked with
valgrind --leak-check=full— 0 leaks, 0 errors, including after
fixing the shutdown-cleanup leak above. gcc -std=c99 -Wall -Wextraonpopcorn_comp.citself: zero
warnings.
Known gap, pre-existing and not addressed in this pass: compiled
trash() has no double-free or invalid-handle detection at all — it
was already a direct, untracked free() call before strings existed,
and still is. cob_interp catches this and warns; a compiled binary
silently allows it, same as before this release. Worth its own
follow-up, unrelated to strings.
Known scope limit: cross-target string support is unverified
Everything verified above was compiled natively (Linux amd64 host,
Linux amd64 target, via plain gcc). The string runtime embedded in
generated C is written in portable C99 with no platform-specific
calls — it should cross-compile via Zig the same as any other
generated Cob program — but that hasn't actually been run and tested
on a genuine Windows or macOS target, or through the Zig backend
specifically, the way the native-gcc path in this release was. Treat
cross-compiled string support as "should work, not yet proven,"
consistent with how earlier releases have flagged untested
cross-platform paths.
The .strawberry cache format changed (v2 → v3)
The on-disk AST format changed shape to represent the new string
expression kind, so the cache's magic bytes were bumped from
COBSTRW2 to COBSTRW3. A cache written by this version is
correctly and safely rejected by anything still expecting v2 (falls
back to reparsing from source, the same as if no cache existed at
all) rather than being misread. This was verified directly: a
hand-corrupted file with the old magic and new-format bytes behind it
was confirmed to be rejected cleanly, with a fallback to reparsing,
not a crash or garbage output.
Verified this release
- Full rewrite of the value representation (
Var/VarTable,
eval_expr,eval_cond,execute()) from rawlongto a tagged
Value(int or string) — compiles clean with
gcc -std=c99 -Wall -Wextra, zero warnings. - Regression: the original all-integer countdown example and the
fullmathpackage test suite (factorial/gcd/power/abs/min/max/
tally, 6 assertions) both produce byte-identical output to before
this change. - New features, each actually run against the real interpreter:
string literals,pop()of an int variable,pop()of a string
variable, string+string concatenation, string+int concatenation,
string equality in a self-terminatingwhile, string ordering
comparison, and the type-mismatch warnings for-/*//on a
string and for comparing a string to a number. harvest()/trash()regression: allocate, free, double-free
warning, and the--no-gcgate all still behave identically now
that handles flow throughValueinstead of a barelong.- Memory correctness: every test above, plus a 2,000-iteration
loop reassigning a string each pass, run clean under
valgrind --leak-check=full— 0 leaks, 0 errors, allocations and
frees exactly balanced in every run. - Cache round-trip: a string-using program produces identical
output whether freshly parsed or loaded from its own.strawberry
v3 cache.
Not verified
- popcorn_comp's string support on a real Windows/macOS target, or
through a cross-compile (Zig) build rather than native gcc — see
above. - No testing on Windows or macOS for this change; verified on Linux
only, same as the source-level verification pattern in earlier
releases.
Cob Language v0.0.3-bug-fix-2
Changed
Project moved from pixel-pulse-labs to Cob-Software-Foundation on GitHub
All three repositories (Cob, cpi, and the new Cob-Docs) now live
under the Cob-Software-Foundation GitHub org instead of
pixel-pulse-labs. This release updates every reference that was
hardcoded to the old org:
include/common.h:COB_REPO_URLand the file header comment
now point tohttps://github.com/Cob-Software-Foundation/Cob.docs/index.htmlandRelease.txt: GitHub/license links
updated to the new org. (Historical mentions of the old
pixel-pulse-labs.github.io/cpiURL inside the bug-fix-2 changelog
entry above were left as-is deliberately — that's a factual record
of what the URL used to be, not a live link.)
COB_FARMER_DEFAULT_BASE_URL itself (`...
Cob v0.0.3-bug-fix-2 (EOL)
Cob Language v0.0.3-bug-fix-2
Changed
Project moved from pixel-pulse-labs to Cob-Software-Foundation on GitHub
All three repositories (Cob, cpi, and the new Cob-Docs) now live
under the Cob-Software-Foundation GitHub org instead of
pixel-pulse-labs. This release updates every reference that was
hardcoded to the old org:
include/common.h:COB_REPO_URLand the file header comment
now point tohttps://github.com/Cob-Software-Foundation/Cob.docs/index.htmlandRelease.txt: GitHub/license links
updated to the new org. (Historical mentions of the old
pixel-pulse-labs.github.io/cpiURL inside the bug-fix-2 changelog
entry above were left as-is deliberately — that's a factual record
of what the URL used to be, not a live link.)
COB_FARMER_DEFAULT_BASE_URL itself (cpi.cob.pixel-pulse.work.gd)
was already unaffected by the org rename, since it's a custom domain,
not a github.io URL — no change needed there, still correct from
bug-fix-2.
Also fixed while in there: cpi registry's zip_url fields were still on the old github.io URL
Separately from the org rename, cpi's own package metadata
(docs/api/v1/packages/*.json) had zip_url values pointing at
https://pixel-pulse-labs.github.io/cpi/packages/... — the raw
GitHub Pages URL from before the custom domain was set up in
bug-fix-2. farmer's own default base URL got updated to the custom
domain then, but the registry's self-referencing zip URLs were missed.
Updated both greeter.json and math.json to
https://cpi.cob.pixel-pulse.work.gd/packages/..., matching the
domain farmer actually resolves against by default.
Verified this release:
- Rebuilt
farmerfrom the patched source — compiles clean. - Re-ran the full local harvest test (local HTTP server standing in
for the registry, realfarmerbinary, real miniz extraction): metadata
fetch, sha256 verification, and extraction intocob_modules/math/
all passed against the correctedzip_url. - Grepped the full source tree, both doc sites, and both published
Cob packages (math,seed) for any remainingpixel-pulse-labs
reference — none left outside the deliberate historical changelog
mentions noted above.
Not verified: an actual farmer harvest against the live
cpi.cob.pixel-pulse.work.gd domain with the corrected zip_url from
a real machine — this environment's network doesn't reach that domain.
The local-server test above exercises the identical code path, but a
real end-to-end run on the live domain is still worth doing before
calling this fully verified.
Cob Language v0.0.3-bug-fix-2
Changed
farmer: default package registry URL updated to the custom domain
COB_FARMER_DEFAULT_BASE_URL (include/common.h) now points at
https://cpi.cob.pixel-pulse.work.gd instead of the previous
https://pixel-pulse-labs.github.io/cpi.
The cpi registry itself hasn't moved — it's still served from the
same GitHub Pages site (Cob-Software-Foundation/cpi, docs/ on main).
Only the domain in front of it changed, via a CNAME record on that
repo. This release just updates farmer's compiled-in default so a
plain farmer harvest <package> resolves against the new domain
without needing $COB_FARMER_BASE_URL set manually.
If you were already overriding the URL with
$COB_FARMER_BASE_URL=https://pixel-pulse-labs.github.io/cpi, that
still works — GitHub Pages doesn't stop serving the old
github.io URL just because a custom domain was added, it's just no
longer the default farmer uses.
No other change. cob_interp and popcorn_comp are unchanged from
v0.0.3-bug-fix-1.
Verified this release: grepped the full source tree for any other
reference to the old github.io URL — none found; common.h was the
only place it was hardcoded.
Not verified: an actual farmer harvest run against the live
cpi.cob.pixel-pulse.work.gd domain from a real machine outside this
environment (this environment's network egress doesn't reach that
domain to test directly). The URL was confirmed correct by inspection
of the compiled-in default, not by an end-to-end network fetch.
Cob Language v0.0.3-bug-fix-1
Fixed
popcorn_comp: Windows system() quoting bug in bundled-Zig auto-resolve
find_bundled_zig_cc() returns a pre-quoted compiler string ("path" cc).
cob_spawn_compile() then appends further quoted arguments (-o "out" "in"),
producing a command line with multiple separate quoted tokens that starts
with a quote.
On Windows, system() hands this to cmd.exe /c <string>. cmd.exe strips
only the first and last " of a command line that starts with a quote —
not matching pairs — which corrupts multi-token quoted strings like this
one. This meant auto-resolving a bundled zig/ folder next to the binary
failed with '...' is not recognized as an internal or external command,
even though the equivalent compiler invocation worked fine when passed
explicitly via --cc (which isn't pre-quoted).
Fix: on Windows, if the built command starts with a quote, wrap the whole
command in one more pair of quotes before calling system() — the standard
workaround for this cmd.exe behavior. --cc/$CobCC paths are untouched.
Only popcorn_comp (src/popcorn_comp.c) changed in this release; cob_interp
and farmer are unchanged from v0.0.3.
Not yet verified: on a real Windows machine with a genuine bundled Zig
folder. Verified so far: compiles clean, no regression to the --cc/$CobCC
explicit-compiler path, which was already unaffected by the bug.
Cob Language v0.0.3 — Project Obsidian Falcon
A corn-themed hybrid language with Python-style indentation, an interpreter, a native compiler, and a package manager.
What's new in v0.0.3
popcorn_comp: dropped embedded TCC, now spawns a real compiler
Earlier versions statically linked TCC's own compiler source (libtcc.c) directly into popcorn_comp. That's gone — popcorn_comp now transpiles a .strawberry file to plain C and spawns a real C compiler as a subprocess to produce the native executable.
- Default backend is Zig's
zig cc— a Clang-based drop-in C compiler that bundles libc/CRT files for essentially every target in a single install. That's what makesCobOS/CobArchcross-compiling a plain-targetflag instead of needing a separately installed cross-toolchain per platform. - Compiler resolution order:
--cc <path>→$CobCC→$CobOS/$CobArch(looked up in a table of Zig target triples) → plainzig cconPATHfor native builds. - Linux targets default to
musllibc, notglibc— produces fully static binaries with no runtime libc dependency. - Windows ARM32 is not supported (cut this cycle — it was also the target we were least confident Zig fully supports).
--emit-c <path.c>still works, for inspecting the generated C.
CobOS=windows CobArch=amd64 popcorn_comp prog.strawberry -o prog.exe
# -> spawns: zig cc -target x86_64-windows-gnu ...
farmer: real in-process zip extraction via miniz, plus zip-slip protection
farmer harvest used to shell out to unzip (Unix) or Expand-Archive (Windows) to extract downloaded packages. It now extracts in-process using the statically-linked miniz library instead — one less external tool required on the system.
- Every extracted archive entry's path is checked against zip-slip path traversal before anything is written to disk. A malicious
../../../../etc/whateverentry is rejected outright, with nothing written outside the destination directory. - Nested directories inside a package zip are now handled correctly regardless of whether the archive includes explicit directory entries.
- The package registry now lives in its own dedicated repo,
Cob-Software-Foundation/cpi—farmer's default base URL was updated to match. Override anytime with$COB_FARMER_BASE_URL.
Documentation site
docs/index.html in this repo is now real language and tool reference documentation — every keyword (pop, set, while, shuck, harvest/trash, the _MakeCache directive) and all three CLI tools, each with usage and flags. The package-registry landing page that used to live here moved to the cpi repo, where it belongs.
Vendored libraries (not yet wired into Cob's language)
Added under vendor/ as embeddable/linkable libraries, per project decision. None of these have Cob-facing keywords yet — that's a separate design step.
- SQLite 3.53.4 — the single-file amalgamation build (
sqlite3.c/sqlite3.h). - Tcl 9.0.4 and Tk 9.0 — full source distributions, built via their own
configure/make(make tcl,make tktargets added to theMakefile). Tk requires real X11 development headers on the build machine. - miniz 3.1.1 — backs
farmer's zip extraction (see above).
CI
cob_interp,farmer, andpopcorn_compall build across the full 9-target matrix (Windows/Linux/macOS × amd64/386/arm64/arm as applicable — down from 10 after cutting Windows ARM32).- A real end-to-end smoke test now runs for
popcorn_compon native Linux amd64: compile a.cobprogram, run it throughpopcorn_comp, diff the output against the interpreter. - Fixed a bug in the TCC upstream-sync workflow where a
conftest.cfile./configuregenuinely needs was being silently dropped on every sync, because TCC's own vendored.gitignorehas aconftest*pattern that collaterally matched the tracked source file. (Now moot for this repo specifically, sincepopcorn_compno longer depends on TCC at all — but the underlying.gitignore-collision lesson is worth knowing if vendoring other...
