Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ and the fleet's [landing kit](https://github.com/go-fleettools/landingkit)
are parsed and checked in the browser, not run, with the `5-r` example
(v0.9.0): the CLI kernel has run them since go-notebook v0.10.0, but the
WebAssembly cores do not link the evaluator; the
default core no longer carries the Julia and R parsers (v0.10.0).
default core no longer carries the Julia and R parsers (v0.10.0). C cells
are parsed and checked the same way, with the `6-c` example, once the
`playground/go.mod` pin is a playground release that has them.
- **The hero** is the kit's carousel: the README's notebook
(`layouts/partials/hero-terminal.html`), a notebook with a Ruby cell and
what it printed (`hero-terminal-ruby.html`), and the playground.
Expand Down
11 changes: 8 additions & 3 deletions playground/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/go-notebook/go-notebook.github.io/playground

go 1.27.3

require github.com/go-notebook/playground v0.11.0
require github.com/go-notebook/playground v0.12.0

require (
filippo.io/age v1.3.2 // indirect
Expand Down Expand Up @@ -79,8 +79,9 @@ require (
github.com/go-crdt/crdt v0.57.0 // indirect
github.com/go-dataframe/dataframe v0.1.0 // indirect
github.com/go-datetime/dates v0.2.0 // indirect
github.com/go-embedded-c/c v0.2.1 // indirect
github.com/go-embedded-julia/julia v0.5.0 // indirect
github.com/go-embedded-r/r v0.1.0 // indirect
github.com/go-embedded-r/r v0.13.1 // indirect
github.com/go-embedded-ruby/ruby v0.8.5 // indirect
github.com/go-encryptions/unixcrypt v0.1.0 // indirect
github.com/go-facter/facter v0.0.0-20260830120958-454b72e642ab // indirect
Expand All @@ -104,7 +105,7 @@ require (
github.com/go-mustache/mustache v0.1.0 // indirect
github.com/go-ndarray/ndarray v0.28.0 // indirect
github.com/go-nokogiri/nokogiri v0.1.0 // indirect
github.com/go-notebook/notebook v0.9.0 // indirect
github.com/go-notebook/notebook v0.14.0 // indirect
github.com/go-numerics/integrate v0.2.0 // indirect
github.com/go-numerics/optimize v0.3.1 // indirect
github.com/go-numerics/special v0.2.0 // indirect
Expand Down Expand Up @@ -420,5 +421,9 @@ require (
modernc.org/libc v1.79.0 // indirect
modernc.org/mathutil v1.7.1 // indirect
modernc.org/memory v1.12.1 // indirect
modernc.org/opt v0.2.0 // indirect
modernc.org/sortutil v1.2.1 // indirect
modernc.org/sqlite v1.61.0 // indirect
modernc.org/strutil v1.2.1 // indirect
modernc.org/token v1.1.0 // indirect
)
18 changes: 10 additions & 8 deletions playground/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,12 @@ github.com/go-dataframe/dataframe v0.1.0 h1:l92liqTQ/StH5rurH2ipgvXunMbtCJAkDNWE
github.com/go-dataframe/dataframe v0.1.0/go.mod h1:rAJdylzFafSOhTAV6z+gSs4i0D9M9XKMKqhWUjIEolk=
github.com/go-datetime/dates v0.2.0 h1:5zXrMqTgw3ljlQfghRsdJRtXYqnR6jYqTgMvA3kG81I=
github.com/go-datetime/dates v0.2.0/go.mod h1:FmzSHylloy714Cc8MEkRjREYP7TcslqjmzsFMQXglAg=
github.com/go-embedded-c/c v0.2.1 h1:LCNcLHJ1T3Ry0adJwO+jK9RnoFwrMd6yR/0bb0muHIc=
github.com/go-embedded-c/c v0.2.1/go.mod h1:MhuXRqUtTZTUnm/3fVjho1HiL6QCFylChzOQ+Tu9eiQ=
github.com/go-embedded-julia/julia v0.5.0 h1:yLdnc0M+qycG8lbkDyH58RYushqdMOp2xdrIZpaIcBo=
github.com/go-embedded-julia/julia v0.5.0/go.mod h1:f8anO/Ngw/UB/9Fj/k9qX/F8LRgh90Bp1VaJ2SQsGgw=
github.com/go-embedded-r/r v0.1.0 h1:GdGFSo2UNwTcCEYvdp1bVWPnxwCDm0pm6Mkd6v2dQ6E=
github.com/go-embedded-r/r v0.1.0/go.mod h1:ac1Px4RIxnrBB88WLetKff8ZDkurBTXwPoh/YteYmKg=
github.com/go-embedded-r/r v0.13.1 h1:dZQNZ9YDug3S0gIZ9JbTOBp+NoomuQoVpMBDfmH0VsY=
github.com/go-embedded-r/r v0.13.1/go.mod h1:+SbBiE9KSTuc1kWNF6009Ixrs2tM2uQCuKxByngTWL4=
github.com/go-embedded-ruby/ruby v0.8.5 h1:JGKa6Cz4ihKNVfooeeytuPsT133byK7CkZr04Px9PYQ=
github.com/go-embedded-ruby/ruby v0.8.5/go.mod h1:2wJ+VJXuGxD+Zl98T0L+/OQN1c5J/eLq452MS7aVZ2M=
github.com/go-encryptions/unixcrypt v0.1.0 h1:XWk4h9uCDd+T2hovOzgO0B2vOdJvAwi9nbOBVb3o62c=
Expand Down Expand Up @@ -259,10 +261,10 @@ github.com/go-ndarray/ndarray v0.28.0 h1:9RWfw01uRUH1YqsVUpNllm01XEohqdSfsk4Kw0x
github.com/go-ndarray/ndarray v0.28.0/go.mod h1:bDbGWswQLmTMh6V3LwvKUbpfHzeG4sZDcvuGnA0GC+s=
github.com/go-nokogiri/nokogiri v0.1.0 h1:3Q3BewGHK16Bt34ggJeyf9xeIMJyA3dmfbIxARPgR9U=
github.com/go-nokogiri/nokogiri v0.1.0/go.mod h1:zjghooYIK8Xfg+fL4/OUhROslx51xGsM3JKtB2TI0tg=
github.com/go-notebook/notebook v0.9.0 h1:BBfL1Q0yu22GfdmCbaDsB6F/eAHmgc5oAITuW7Av3Vs=
github.com/go-notebook/notebook v0.9.0/go.mod h1:N4+uD9yDDgUUXqbu0d6ADGKXq3LOkn2Kis6vXs4ipf4=
github.com/go-notebook/playground v0.11.0 h1:bEaoMqvJEoDiTj9Gtx72yEQ2hvzBh2P2mmePHQY6KXE=
github.com/go-notebook/playground v0.11.0/go.mod h1:dbUJ8M3GSPSmpK1r9c0JlT9BeRWqRPAlKyc1mabwU54=
github.com/go-notebook/notebook v0.14.0 h1:Tm9mZkZb4rk5aYBB6aDvCjYLMOYahCKpMkr3dEsdEpU=
github.com/go-notebook/notebook v0.14.0/go.mod h1:kVOmlBr0TQt3XZUcJcY1Z4hJnl1UPz+5grPT5fNAK3M=
github.com/go-notebook/playground v0.12.0 h1:IT2t8HvXl/Pw94ugGfFawQDdLJ6C84OekN1tIJnxrio=
github.com/go-notebook/playground v0.12.0/go.mod h1:RRDrkC/YgjNYPxu27FGeo7Iqkc2xwW7R5E7UBdL2Hv0=
github.com/go-numerics/integrate v0.2.0 h1:IkJhDimTc7nQETCixEvbbHhtOF36GbANBKJI3mJB3Kw=
github.com/go-numerics/integrate v0.2.0/go.mod h1:ABjpcWy8ZSOg8j6S+7YRsvMJ2LpVkH4E64/CGet2gCw=
github.com/go-numerics/optimize v0.3.1 h1:eYkT9BpORKSwXnDtEJxXfZ19qJT0cI2RH6xEL3VLZSU=
Expand Down Expand Up @@ -974,8 +976,8 @@ github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWD
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
github.com/tannevaled/gobig2 v0.2.0 h1:yx97/ltljALrIWDFVqHjPUIjAp3bfUUhH8Z8UROvNLc=
github.com/tannevaled/gobig2 v0.2.0/go.mod h1:X0S1H+N35kg6zYgVYRqGMsGj3C35zs+iA2r1MXyPcV4=
github.com/tetratelabs/wazero v1.8.2 h1:yIgLR/b2bN31bjxwXHD8a3d+BogigR952csSDdLYEv4=
github.com/tetratelabs/wazero v1.8.2/go.mod h1:yAI0XTsMBhREkM/YDAK/zNou3GoiAce1P6+rp/wQhjs=
github.com/tetratelabs/wazero v1.12.0 h1:DuWcpNu/FzgEXgGBDp8J1Spc+CWOvvtvVyjKlaZopYU=
github.com/tetratelabs/wazero v1.12.0/go.mod h1:LvKtzl2RqO4gyF27BiXU+nKAjcV8f38U+kP/q2vgxh0=
github.com/tinylib/msgp v1.6.4 h1:mOwYbyYDLPj35mkA2BjjYejgJk9BuHxDdvRnb6v2ZcQ=
github.com/tinylib/msgp v1.6.4/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA=
github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75 h1:6fotK7otjonDflCTK0BCfls4SPy3NcCVb5dqqmbRknE=
Expand Down
38 changes: 38 additions & 0 deletions playground/notebooks/6-c.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# C cells, checked here but not run

A cell written in a `c` fence is **parsed and checked** with [go-embedded-c](https://github.com/go-embedded-c/c)'s front end, and it is **not run**, here or in the `notebook` command: go-embedded-c has no code generation yet (its milestone M2). Until that lands, a C cell is checked, not run. No C compiler is started. The badge on the cell says what happens: *C · not runnable yet*.

C cells are not independent, as they are in a C file: a cell sees the typedefs, macros and declarations of the C cells before it. The first one below declares a type and a size; the second one uses both, and would be an error alone.

```c
typedef int myint;
#define N 10
```

This C cell is well formed, so it is not an error. It does not run either: its output says why, and no number comes back. Only variables cross to the other languages. Functions, typedefs and macros stay C's, so `total` is the one name a Go cell can read.

```c
myint total = N * N;
```

This Go cell reads `total`, which the C cell defines. The name analysis sees that, so the cell is **blocked**: it waits for the C cell, and says so, instead of failing on a name that never arrives.

```go
m := total + 1
```

A cell that does not read anything from C is not held back. It runs as usual, whatever the C cells above it do:

```go
n := 10
n * 2
```

A mistake in a C cell is caught at the right line, before anything runs, in the front end's own words, and the cells that do not read it still run. This notebook would stop being published if one of its cells had one, so here is one, quoted. With a cell that reads

> int y = 2;
> int x = y y;

the page shows `line 2:11: unexpected identifier, expected ';'`, at line 2, column 11, where a second name follows the first with no operator between them. Try it: add a C cell with `int x = y y;` and run the notebook.

When go-embedded-c's code generation lands, these cells will run and the blocked cell will compute `total + 1`. Follow the progress at [github.com/go-embedded-c/c](https://github.com/go-embedded-c/c).
Loading