CX · Reference guidecx-core-code
PlaygroundDownloadsAboutv0.18.0-pre.1

cx-core-code

the language: evaluator, stdlib, LSP, libcx, the cli and embed builds

Why reach for it

Ring 1 adds execution and nothing else. cx-core-code is the evaluator, CXPath, the directive set, the bundled standard library below, the formatter, the linter and the language server. It adds no servers, no protocol stacks and no databases: a Ring-1 program still cannot open a socket, and it reads nothing until you grant it (capabilities).

The language is the data format with directives: a program is a document whose [?…] elements the evaluator runs, a query is a pattern over the document you already have (code), and every error is a value you match on rather than an exception you catch. Effects are deny-by-default; a refusal names the flag that would allow the effect and is an ordinary value like any other.

It ships libcx, the embeddable evaluator the bindings load, and the cli and embed builds of cx: the same binary as the platform build with the servers left out, so a script or an embedded evaluator carries only the two rings. The specification behind every directive is projected into one table on the directive reference; if a directive is not in that table, it does not exist.

What it gives you

Every Ring 1 module a program can import without leaving the two rings. Each row below is a registry/modules.cxd row read when this page was built, and each links to the reference page the guide projects from that module's own documentation — the same source the conformance corpus grades.

module import it as where it lives reference
array [?lib 'cx-stdlib/array'] Ring 1 array reference
authz [?lib 'cx-stdlib/authz'] Ring 1 authz reference
bus [?lib 'cx-stdlib/bus'] Ring 1 bus reference
bytes [?lib 'cx-stdlib/bytes'] Ring 1 bytes reference
crypto [?lib 'cx-stdlib/crypto'] Ring 1 crypto reference
csv [?lib 'cx-stdlib/csv'] Ring 1 csv reference
cx [?lib 'cx-stdlib/cx'] Ring 1 cx reference
decision [?lib 'cx-stdlib/decision'] Ring 1 decision reference
diagram [?lib 'cx-stdlib/diagram'] Ring 1 diagram reference
did [?lib 'cx-stdlib/did'] Ring 1 did reference
email [?lib 'cx-stdlib/email'] Ring 1 email reference
env [?lib 'cx-stdlib/env'] Ring 1 env reference
format [?lib 'cx-stdlib/format'] Ring 1 format reference
fp [?lib 'cx-stdlib/fp'] Ring 1 fp reference
ft [?lib 'cx-stdlib/ft'] Ring 1 ft reference
geo [?lib 'cx-stdlib/geo'] Ring 1 geo reference
graphql [?lib 'cx-stdlib/graphql'] Ring 1 graphql reference
hash [?lib 'cx-stdlib/hash'] Ring 1 hash reference
heap [?lib 'cx-stdlib/heap'] Ring 1 heap reference
html [?lib 'cx-stdlib/html'] Ring 1 html reference
http-client [?lib 'cx-stdlib/http-client'] Ring 1 http-client reference
i18n [?lib 'cx-stdlib/i18n'] Ring 1 i18n reference
image [?lib 'cx-stdlib/image'] Ring 1 image reference
io [?lib 'cx-stdlib/io'] Ring 1 io reference
json [?lib 'cx-stdlib/json'] Ring 1 json reference
jsonrpc [?lib 'cx-stdlib/jsonrpc'] Ring 1 jsonrpc reference
jsonschema [?lib 'cx-stdlib/jsonschema'] Ring 1 jsonschema reference
locale [?lib 'cx-stdlib/locale'] Ring 1 locale reference
log [?lib 'cx-stdlib/log'] Ring 1 log reference
map [?lib 'cx-stdlib/map'] Ring 1 map reference
math [?lib 'cx-stdlib/math'] Ring 1 math reference
mime [?lib 'cx-stdlib/mime'] Ring 1 mime reference
oidc [?lib 'cx-stdlib/oidc'] Ring 1 oidc reference
path [?lib 'cx-stdlib/path'] Ring 1 path reference
pdf [?lib 'cx-stdlib/pdf'] Ring 1 pdf reference
process [?lib 'cx-stdlib/process'] Ring 1 process reference
prof [?lib 'cx-stdlib/prof'] Ring 1 prof reference
random [?lib 'cx-stdlib/random'] Ring 1 random reference
re [?lib 'cx-stdlib/re'] Ring 1 re reference
saml [?lib 'cx-stdlib/saml'] Ring 1 saml reference
sasl [?lib 'cx-stdlib/sasl'] Ring 1 sasl reference
sched [?lib 'cx-stdlib/sched'] Ring 1 sched reference
scim [?lib 'cx-stdlib/scim'] Ring 1 scim reference
set [?lib 'cx-stdlib/set'] Ring 1 set reference
similar [?lib 'cx-stdlib/similar'] Ring 1 similar reference
soap [?lib 'cx-stdlib/soap'] Ring 1 soap reference
strings [?lib 'cx-stdlib/strings'] Ring 1 strings reference
supervise [?lib 'cx-stdlib/supervise'] Ring 1 supervise reference
tar [?lib 'cx-stdlib/tar'] Ring 1 tar reference
term [?lib 'cx-stdlib/term'] Ring 1 term reference
test [?lib 'cx-stdlib/test'] Ring 1 test reference
time [?lib 'cx-stdlib/time'] Ring 1 time reference
url [?lib 'cx-stdlib/url'] Ring 1 url reference
uuid [?lib 'cx-stdlib/uuid'] Ring 1 uuid reference
validate [?lib 'cx-stdlib/validate'] Ring 1 validate reference
vc [?lib 'cx-stdlib/vc'] Ring 1 vc reference
ws [?lib 'cx-stdlib/ws'] Ring 1 ws reference
xsp [?lib 'cx-stdlib/xsp'] Ring 1 xsp reference
zip [?lib 'cx-stdlib/zip'] Ring 1 zip reference

Try it

A query grouped by an attribute: every user by department, counted. There is no object model to build first and no parser to call — the program reads the data in the form you wrote it.

input.cx

        [users
  [user dept=eng [name Alice]]
  [user dept=sales [name Bob]]
  [user dept=eng [name Carol]]]
      

prog.cx

        [?for [user @dept=$d]
      [group-by $d]
      [yield [row dept=$d count=$count]]]
      
        $ cx --data=input.cx prog.cx
[row dept=eng count=2]
[row dept=sales count=1]
      

Fixture program-for-004-group-count in deps/cx-core-code/conformance/code.cxd — replayed against this cx when the page was built.

Status

The language repository builds on the data core alone and is built on by the platform's storage engine; the front door compiles its evaluator and its bundled modules from the pin, and the cx this site's examples were replayed against is that build.

fact as the registry records it
ships as binary
status extracted
pinned at ee6a880b7
builds on cx-core-data
built on by cx-platform-net, cx-platform-store, cx-platform-db, cx-platform-xsp, cx-platform-flow, cx-platform-connector, cx-platform-secrets, cx-platform-sso, cx-platform-ux, cx-platform-workbench, cx-platform-agent
bundled modules 59
BUILDS ON THIS REPOSITORY · SHIPS BUILT ON BY cx-core-data cx-core-code array authz bus bytes crypto csv cx decision diagram did email env format fp ft geo graphql hash heap html http-client i18n image io json jsonrpc jsonschema locale log map math mime oidc path pdf process prof random re saml sasl sched scim set similar soap strings supervise tar term test time url uuid validate vc ws xsp zip cx-platform-net cx-platform-store cx-platform-db cx-platform-xsp cx-platform-flow cx-platform-connector cx-platform-secrets cx-platform-sso cx-platform-ux cx-platform-workbench cx-platform-agent DRAWN FROM registry/repos.cxd's pins= COLUMN AND registry/modules.cxd WHEN THIS PAGE WAS BUILT
Fig. — what cx-core-code plugs into: the repositories it builds on (left), the modules it ships (centre), the repositories that build on it (right) · drawn from registry/repos.cxd, deps.cxd and registry/modules.cxd when this page was built