Limbo for VS Code
Support for Limbo, the programming language of the Inferno® operating
system and of InferNode, its 64-bit distribution,
and for the two other languages an Inferno tree is written in: the
Inferno shell and mk.
Made by the InferNode project (infernode.io).
Its source is infernode-os/vscode-limbo.
Report problems there.

What it does
Limbo
- Highlighting for
.b sources and .m module interfaces, covering
every keyword the native compiler knows, radix constants (16rFF),
raw strings, and \u/\U escapes. Some languages share the .m
suffix (Objective-C, MATLAB, Mathematica). A .m file is treated as
Limbo only when its text is Limbo, i.e. it has Name: module or
implement Name;.
- Errors as you type. The tree's own native
limbo compiler checks
the buffer, so errors show before you save. They land on the token or
name they are about. An error in an included file shows up in that
file and also at the include line that pulled it in. Checking never
writes a .dis file where the runtime would load it.
- Run in Inferno (the ▶ button on a
.b file, or an Inferno shell
script: see below). It builds on the
host, then runs the module in the tree's own emu, in an Inferno
terminal inside the editor: the ; prompt with your login profile, as
from o.emu -c1 -r$ROOT sh -l. The first run starts emu, and later
runs reuse it, picking up the rebuilt module without a restart.
Run in Inferno with Arguments… asks for the arguments, and
Open Inferno Terminal (also under the terminal panel's +)
opens one without running anything. Ctrl-C at the terminal exits
emu.
- Build and Install runs
mk install in the file's directory: the
tree's own build, with its native tools on the host, as CLAUDE.md
says. It compiles only what is stale and installs each .dis where
the runtime loads it. Errors go to Problems. With no mkfile it uses
tools/compile-limbo.sh.
- A
$limbo problem matcher for your own tasks (mk install, for
example).
- Snippets for a command module,
load, alt, spawn, a list
loop, an exception handler, and a unit test in the testing.m style.
Debugging
Set breakpoints in the gutter of a .b file and press F5 (or
Debug in Inferno beside the ▶ button). No launch.json is needed.
- The program is built with
mk install, as Run builds it.
- It runs in an
emu of its own, started with -D -c0. -D allows
debugging, which InferNode refuses otherwise; -c0 is the
interpreter, as only interpreted code stops at a breakpoint. Your
everyday emu is not touched.
- That
emu serves debugfs(4) (InferNode's debugger, debug(2), as
files) on a loopback port, under a random name that only this
editor is told. The editor drives it over 9P.
What you get:
- Breakpoints by line. A breakpoint in a module not loaded yet
waits, and is marked set once it loads.
- Stepping: step over, into and out, continue, pause and stop.
- The call stack, with each frame's source line.
- Variables: a frame's locals, arguments and module globals.
Adts, lists, arrays and channels open up like folders.
- Hover and watch: hover over a name for its value; add watch
expressions. An expression is a variable path: a local, argument or
global, then fields (
p.x), list cells (l.tl.hd) and elements
(a[2]).
- Conditional breakpoints (
n > 40, s == "hello", or just p,
meaning not nil or zero). A condition is a path compared with a
literal.
- Hit counts (
5, >= 5, == 5, % 5).
- Logpoints (
sum of {a} and {b}). They print to the Debug Console
and don't stop.
- Stops at a crash. An exception nothing catches (a nil
dereference, an array bounds error, a
raise) stops the program at
the line it broke on, with the error. The stack and variables are as
they were, and the other threads are stopped too. Continue ends the
program. This needs debugfs(4) from an InferNode tree that holds a
broken Prog where it broke; with an older one, the session just ends.
- Threads: each Prog a program spawns is a thread, with the same
breakpoints. When one stops, the rest stop too, as Go's debugger does
with goroutines.
- Output: the program's output in the Debug Console.
A launch.json entry takes program, args, stopOnEntry, root,
board (see Debugging on a board) and emuArgs (options for the debugging emu, as a window size -g800x600;
unset, limbo.emu.args less its -c, since debugging interprets):
{
"type": "limbo",
"request": "launch",
"name": "Debug cat",
"program": "${workspaceFolder}/appl/cmd/cat.b",
"args": ["/lib/sh/profile"]
}
Debugging needs an InferNode tree whose emu takes -D and has
debugfs built (mk install in appl).
The Inferno shell
sh(1) and std's builtins (sh-std(1)): rc-style quoting (single quotes,
'' inside them), braced blocks, fn definitions, for … in, $#var,
${hd …}-style substitutions, `{…}, "{…}, <{…} and >{…},
and redirections such as >[2] and >[2=1].
A tree keeps the host's scripts and Inferno's side by side, both as
.sh. A script is taken as Inferno's when:
- its first line is
#!/dis/sh (or #!/dis/sh.dis); any other #!
line means it is not;
- with no
#! line, its text reads as Inferno's: load std, if {,
fn name {, >[2] or $#x, more than it reads as POSIX (then,
fi, done, esac, $(…), [[, ;;).
That covers .sh files and files with no suffix (lib/sh/profile,
lib/sh/srv). Every script in the InferNode tree comes out as its #!
line says; a script that guesses wrong can be given a #! line, or its
language picked from the status bar.
Run in Inferno on a script runs sh /its/path at the Inferno
terminal, in a shell of its own, so what it binds and defines does not
stay behind. A script under the root has the same path from /;
elsewhere it is reached through /n/local, where the login profile
binds the host's files.
mk
Plan 9's mk (mk(1)) for mkfile, mkconfig, mkfile-* and the
shared rules in mkfiles/: assignments with attributes (NAME=U=…),
<file and <|command includes, rules with their attributes
(all:V:), % and & patterns, $stem, $target, $prereq and mk's
other variables, ${VAR:a%b=c%d} substitutions, and `{…}.
Recipes may be the host's sh or rc, so in them only mk's variables,
quoted strings and comments are coloured.
An example
examples/spiro.b is a spirograph that draws itself
in emu's window. Open it with limbo.root set to your InferNode tree,
press ▶ to watch it draw, change wheel or pen and run it again, or
set a breakpoint in its loop and press F5: the drawing stops where the
program does. It needs an emu built with a display (the SDL3 build);
limbo.emu.args can size its window, as ["-c1", "-g800x600"].
A file outside the tree builds and debugs as one inside it does; its
.dis goes where its PATH constant says, in the tree's dis/.
What it needs
An InferNode (or Inferno) tree with its native tools built, and for
running, its emulator and runtime (./build-macos-sdl3.sh or your
platform's build script, then mk install in appl):
./makemk.sh
export ROOT=$PWD PATH=$PWD/$(uname -s | sed s/Darwin/MacOSX/)/$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')/bin:$PATH
for d in lib9 libbio libmath libmp libsec limbo; do (cd $d && mk install); done
Debugging needs an InferNode recent enough to have debugfs(4) and
emu -D (infernode-os/infernode#1319);
with an older tree, F5 says so and the rest works.
QUICKSTART.md
covers the full build. The extension finds the tree as the nearest
directory above the file that holds module/sys.m, or through $ROOT
or limbo.root. It uses the compiler the tree built for this machine,
for example MacOSX/arm64/bin/limbo or Linux/amd64/bin/limbo.
Settings
| Setting |
Default |
|
limbo.root |
|
The Inferno root. Empty: $ROOT, then the nearest directory above the file with module/sys.m. |
limbo.compilerPath |
|
The native compiler. Empty: the tree's own build for this host, then limbo on PATH. |
limbo.includePaths |
[] |
More include directories. Searched after the file's own and before module/. |
limbo.check |
onType |
onType, onSave or off. |
limbo.checkDelay |
500 |
Milliseconds after typing stops before a check. |
limbo.warnings |
true |
Report warnings (limbo -w). |
limbo.emu.path |
|
The emulator. Empty: the tree's own build (emu/MacOSX/o.emu, ...). |
limbo.debug.board |
|
Debug on a board by default: the dial string its svc/debug serves. |
limbo.debug.boardAuth |
true |
Authenticate to boards with your keys; off only for svc/debug -A. |
limbo.emu.args |
["-c1"] |
Emulator options before -r<root> sh -l. -c0 interprets. Debugging takes them too, less -c and -r. |
Languages and files
| Language |
Files |
| Limbo |
.b; .m whose text is Limbo |
| Inferno shell |
#!/dis/sh scripts; .sh and suffixless files whose text is Inferno's |
| mk |
mkfile, mkconfig, mkfile-*, mkfile.*, mkfiles/mk* |
Debugging on a board
A program that needs a camera, a GPU or a panel is debugged where it runs.
On the board (an InferNode emu started with -D):
svc/debug # this machine's debugger, served with listen(1)'s keys
Then in VS Code, a launch entry with board builds the program here,
puts it on the board, and debugs it there:
{
"type": "limbo",
"request": "launch",
"name": "Debug on the Jetson",
"program": "${file}",
"board": "tcp!jetson!17020"
}
limbo.debug.board sends every F5 to a board. An attach entry debugs
Progs already running there, by pid or by module (as prog(3) names
it: Httpd); with neither, it asks. Detaching lets them go, running.
The editor's own emu mounts the board's debugger with your keys
(mount -k, listen(1)'s authentication and encryption) and passes it on
to VS Code on this machine alone. boardAuth: false mounts without
authentication, for a board started svc/debug -A on a network nobody
else is on.
A board running InferNode's native kernel (a Pi) allows debugging when
its boot command line (cmdline.txt on the card) has the word
progdebug, as an emu does when started with -D
(infernode-os/infernode#1322). Without it the board refuses everyone.
Developing
No npm dependencies. The tests run under plain node. The ones that check
against the real compiler need an InferNode tree with limbo built:
INFERNODE=/path/to/infernode npm test
To try the extension, open this folder in VS Code and press F5. CI
builds the InferNode commit pinned in .github/workflows/ci.yml
(headless) and runs every test against it, the debugger's too. When Limbo's lexer (limbo/lex.c) gains a
keyword or a literal form, update the grammar and move the pin.
Notices
Inferno® Operating System, originally by Bell Labs (Lucent), then Vita
Nuova Holdings. InferNode is a fork of it by infernode-os.
Inferno and Limbo are registered trademarks of Vita Nuova Holdings
Limited in the USA and other countries. They are used here only to name
the language this extension supports. This extension is not made or
endorsed by Vita Nuova. InferNode™ and its logo are trademarks of Peter
Finn.
MIT licensed. See LICENSE.