Getting started with jessica

5 views
Skip to first unread message

William ML Leslie

unread,
Dec 12, 2025, 9:38:11 PM (3 days ago) Dec 12
to cap-talk
Hi,

If anyone here is familiar with the jessica compiler for the jessie language (or knows where I can ask questions about it), I've recently started converting a project into it and I'm a little confused by the output.  Here's the module I want to load:

import { mkPrimeBank } from './coyimg/primebank';
// export { buildImage };
export const buildImage = (builder, output) => {
    const [renderer, bank] = mkPrimeBank();
    builder(bank);
    output.write(renderer());
};

I tried to read the rules and it's likely I have some way to go, but this looks to me like it should compile.  The traceback contains a couple of pages of base64 but shortened it says:

[wleslie@sanderson:~/projects/capimg/jessie]
 12:27:19 $ node --experimental-vm-modules src/modulesystem2.mjs file://./src/nothing.mjs
info: -------template--------
        undefined:1: "import { mkPrimeBank } from './coyimg/primebank';
    -------
    looking for safeModule, EOL_COMMENT, MULTILINE_COMMENT
error: Syntax error at 48 ";" #0:48 Error
    at /home/wleslie/projects/jessica/node_modules/@michaelfig/slog/dist/slog.cjs.js:118:25
    at tag [as error] (/home/wleslie/projects/jessica/node_modules/@michaelfig/slog/dist/slog.cjs.js:69:20)
    at file:///home/wleslie/projects/jessica/lib/boot-peg.js:88:13
    at Object.start (data:severalpagesofbase64:14:13)
    at baseCurry (file:///home/wleslie/projects/jessica/lib/boot-peg.js:592:23)
    at templateTag (file:///home/wleslie/projects/jessica/lib/boot-peg.js:572:21)
    at tagged (file:///home/wleslie/projects/jessica/lib/tag-string.js:30:12)
    at Object.runModule (file:///home/wleslie/projects/jessica/lib/boot-jessica.js:62:22)
    at runModule (file:///home/wleslie/projects/capimg/jessie/src/modulesystem2.mjs:50:24)
    at loadRoot (file:///home/wleslie/projects/capimg/jessie/src/modulesystem2.mjs:53:28)
node:internal/modules/run_main:107
    triggerUncaughtException(
    ^
error: Syntax error at 48 ";" #0:48
(Use `node --trace-uncaught ...` to show where the exception was thrown)
Node.js v24.11.1

Maybe I'm reading this incorrectly but it appears to be saying that it failed to parse the first line.  Any idea why that might be?

I am going to package up my WIP and upload today if it might help.

--
William ML Leslie

William ML Leslie

unread,
Dec 12, 2025, 10:57:25 PM (3 days ago) Dec 12
to cap-talk, mf...@agoric.com
+mfig: Hello! Really excited to try jessica and probably using it incorrectly, I know you must be busy but if you have any suggestions I would love to hear them.


It expects to be in the same directory as jessica. If there's no jessica release before I start sharing it with people, I should make that a submodule.  I used the jessica commit 7a6070c8e2af0754e15e6f539611e33a58431c13 last changed on the 23rd of August, which is the latest change afaict.

The command I am trying to run is the jessie/src/modulesystem2.mjs file.  Quoting my own message for context, apologies to everyone else.
--
William ML Leslie

William ML Leslie

unread,
Dec 14, 2025, 9:49:12 PM (2 days ago) Dec 14
to Michael FIG, cap-talk
Forwarding to cap-talk at Michael's request.  This is all exciting news, thank you Michael.  I'm on my lunch break at the moment but I'll see how far I get after work, and try to find all of the pointers that led me here so we can snap them to the right place.

On Sun, 14 Dec 2025 at 22:44, Michael FIG <mf...@agoric.com> wrote:
Hi, William!

TL;DR: Jessica is dead!  Long live @jessie.js/parse and https://es-meta.github.io/playground/ !

I really haven't done very much with Jessica's implementation of Jessie.  Instead, I've only ever used it for building ASTs for other little languages.  Note that the latest "23rd of August" commit was August 23rd, 2023!  It's likely that you were tripped up by my (foolhardy) inclusion of an experimental `insulate` reserved word (and later attempts to hardwire `harden`) built into the syntax.  This would be much better handled via static analysis.

The scant time I've put in since then has been to reconstruct Jessica's parser machinery in https://github.com/endojs/Jessie/tree/main/packages/parse.  The basic PEG stuff is usable, but I haven't gotten far enough up polishing the stack of parsers from peg -> json -> json5* -> justin -> jessie.  (* I am here).  This building-a-language-from-first-principles approach is a fun toy, but it needs much better test suites and tooling.  The personal goal I've set for this stack is to write minimal static verifiers of these languages (with good error recovery for interactive use) that I could adapt as plugins to other tools like ESLint or Prettier.

Beyond that, I'd rather just verify some input source code and then pass it off to other software in order to interpret it.

My current dream is to create machine-readable annotation files describing each JSON-to-Jessie subset in relation to a given EcmaScript standard's text.  Then we could teach https://es-meta.github.io/ how to read those annotations to build a toolchain for each subset.

Maybe not what you wanted to hear, but I haven't had a lot of free time. :P

Cheers,
Michael.


--
William ML Leslie
Reply all
Reply to author
Forward
0 new messages