Skip to content
Open

r1 #4

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
163 commits
Select commit Hold shift + click to select a range
dd3d01b
Fix retina dpi scaling
skmp Mar 23, 2026
baa41a5
Enhance type inference for built-in functions and improve backpropaga…
skmp Mar 24, 2026
3b1f9df
refactor: phase 1
skmp Mar 24, 2026
37d881c
refactor: phase 2
skmp Mar 24, 2026
bf0424b
refactor: phase3
skmp Mar 24, 2026
1656fac
refactor: phase 3b
skmp Mar 24, 2026
0b30130
refactor: make pin ptrs stable
skmp Mar 24, 2026
6bcdad6
refactor: phase 4a
skmp Mar 24, 2026
b3bfee2
refactor: phase 4b
skmp Mar 24, 2026
0f5ab4e
refactor: Phase 5
skmp Mar 24, 2026
3686295
dpi: Better fix?
skmp Mar 24, 2026
b6f9459
refactor: bottom panel with tabbed error and build log display
skmp Mar 24, 2026
d194ea0
SelectBang: support three bang outputs
skmp Mar 24, 2026
8dd992d
more shadow node work
skmp Mar 24, 2026
5cbc049
expr parsing
skmp Mar 24, 2026
15c3ac8
expr rework
skmp Mar 24, 2026
70e7621
fixes in shadow
skmp Mar 24, 2026
bb3f254
fix expressions decaying references
skmp Mar 24, 2026
79189bd
correctly name inline exprs input pins
skmp Mar 24, 2026
290998c
name hints
skmp Mar 24, 2026
aec4917
fix for copy paste
skmp Mar 24, 2026
008975b
More flexible pin connections
skmp Mar 24, 2026
79b3a1f
rename BangInput -> BangTrigger, BangOutput -> BangNext
skmp Mar 24, 2026
3114712
CONNECTIONS TO BANGS AS INPUTS WORK NOW
skmp Mar 24, 2026
fce7e60
relax multi caller rules
skmp Mar 24, 2026
ed06b67
towards reusable lambas
skmp Mar 24, 2026
0552929
search bar, some fixes
skmp Mar 24, 2026
817a1bd
towards lambdas
skmp Mar 24, 2026
6325002
questionable progress
skmp Mar 24, 2026
4bd9269
tests
skmp Mar 24, 2026
3b7e936
this feels dodgy
skmp Mar 24, 2026
aa9d158
More complex, non compiling multifader
skmp Mar 25, 2026
ec4f533
towards canonical shadow nodes
skmp Mar 25, 2026
4438ba8
type system refactor
skmp Mar 25, 2026
4423514
fixes
skmp Mar 25, 2026
8f15cef
literal work
skmp Mar 25, 2026
095d426
progress in literals?
skmp Mar 25, 2026
974a5fa
more progress on literals
skmp Mar 25, 2026
ac639d5
more literal work
skmp Mar 25, 2026
ea4d696
literal unification, remove legacy stuff
skmp Mar 25, 2026
079fc8b
more literals
skmp Mar 25, 2026
da506db
more progress on literals?
skmp Mar 25, 2026
6c9c0cc
more literal work
skmp Mar 25, 2026
5f2f0be
more unvalued literals
skmp Mar 25, 2026
f310cf9
refactor: cjamge declaration handling and add utility for extracting …
skmp Mar 25, 2026
30f606b
refactor: enhance declaration name and type extraction with shadow no…
skmp Mar 25, 2026
57e6805
towards evaluated decls
skmp Mar 25, 2026
0eaf6fb
type parsing fixes
skmp Mar 25, 2026
e68219a
buildins are symbols
skmp Mar 25, 2026
b694f23
TypeApply
skmp Mar 25, 2026
483ccd7
enhance type parameter validation for arrays, maps, and tensors
skmp Mar 25, 2026
489adb7
klavier is now a clusterfuck
skmp Mar 25, 2026
f65b7c0
Organic Assembler / attolang
skmp Mar 25, 2026
0abee26
Update readme
skmp Mar 25, 2026
d637140
Update README with image
skmp Mar 25, 2026
3498b4c
# version instrument@atto:0
skmp Mar 25, 2026
1574c94
viewport in metafiles
skmp Mar 25, 2026
7ae0a55
wire management: add link name editing and auto-wire functionality
skmp Mar 25, 2026
6a2d5ab
named style
skmp Mar 25, 2026
76852d2
Migrate v1 arguments: strip $ from variable references and convert @N…
skmp Mar 25, 2026
a937964
first steps for graphbuilder
skmp Mar 25, 2026
b1dea6f
argument parsing changes: add split_args and parse_args_v2 functions,…
skmp Mar 25, 2026
9ff34c6
Initials steps for graphbuilder
skmp Mar 25, 2026
4772975
more graphbuilder work
skmp Mar 25, 2026
12d455c
Cleanups
skmp Mar 25, 2026
022c4a4
more graphbuilder work
skmp Mar 25, 2026
d0c9eb1
work on nets and nodes
skmp Mar 25, 2026
2e7b6c5
args2 to graphbuilder
skmp Mar 25, 2026
28bcd4c
more net work
skmp Mar 25, 2026
a7a7e00
Editor2Pane!
skmp Mar 25, 2026
925b808
Folding
skmp Mar 25, 2026
099e443
attolang.md update
skmp Mar 26, 2026
bf4d01f
towards editor2
skmp Mar 26, 2026
fb3d96d
not perfect, but progress is progress
skmp Mar 26, 2026
4120050
towards lambda link rendering
skmp Mar 26, 2026
3d66499
lambda grab rendering
skmp Mar 26, 2026
25cd373
Cleanup node_types2.h
skmp Mar 26, 2026
1855ab5
node drawing: add side-bang and lambda grab only for flow nodes
skmp Mar 26, 2026
db492f7
better output mappings
skmp Mar 26, 2026
21a2eab
better imports
skmp Mar 26, 2026
d2482e2
Add special handling for label and error nodes in editor rendering
skmp Mar 26, 2026
fe361ca
Add initial value support to decl_var input ports
skmp Mar 26, 2026
a2a0654
editor2: pin hovers
skmp Mar 26, 2026
7a73090
editor2: move styles out
skmp Mar 26, 2026
3d7904a
editor2: PinMapping
skmp Mar 26, 2026
0522f0f
optionals are indeed optionals now
skmp Mar 26, 2026
1768a5c
Split input_ports_optional
skmp Mar 26, 2026
789589e
hover on + pin.
skmp Mar 26, 2026
f4fb025
optionally scaled tooltips
skmp Mar 26, 2026
596bbcf
Increase default font size a bit
skmp Mar 26, 2026
44d53aa
Renumber auto strings
skmp Mar 26, 2026
f2b387e
next_id
skmp Mar 26, 2026
56f211b
Polymorphy for Nodes
skmp Mar 26, 2026
9a7b2bd
more editor2 cleanups
skmp Mar 26, 2026
85bc2fc
editor2: non overlap
skmp Mar 26, 2026
733c6fa
Add Liberation Mono font support and license files
skmp Mar 26, 2026
d480da9
graphbuilder -> graph_builder
skmp Mar 26, 2026
09d3d1f
ditry tracking
skmp Mar 26, 2026
ab32c54
Refactor dirty tracking methods in GraphBuilder
skmp Mar 26, 2026
43c99c2
editor2: ditry state visualization
skmp Mar 26, 2026
bf8c9cd
graph rename
skmp Mar 26, 2026
9104082
wire hovers
skmp Mar 26, 2026
87e083e
node selection.
skmp Mar 26, 2026
297bf7b
hover_item_ initial work
skmp Mar 26, 2026
31178ae
ArgNet2 w/ builders
skmp Mar 26, 2026
1812167
towards first class pins
skmp Mar 26, 2026
231d04c
graph_builder rework
skmp Mar 26, 2026
55ea34c
$empty, $unconnected
skmp Mar 26, 2026
fff59f8
$empty/$unconnected always
skmp Mar 26, 2026
5d98972
refactor: consolidate FlowNodeBuilder and NetBuilder pointer type def…
skmp Mar 26, 2026
3e9d3b1
alias fix from last commit
skmp Mar 26, 2026
1c68687
feat: add find_or_null_node method to GraphBuilder and update usages
skmp Mar 26, 2026
d6ce2bd
add remap and pin index methods to FlowArg2 and update GraphBuilder a…
skmp Mar 26, 2026
a0d3c33
FlowArg2::name
skmp Mar 26, 2026
d55cf36
wire -> net in grahp_builder
skmp Mar 26, 2026
5444e94
Wire has entry now
skmp Mar 26, 2026
cd8b1d6
cosmetics
skmp Mar 26, 2026
9771f1e
wire hover functionality to highlight all wires sharing the same entr…
skmp Mar 26, 2026
06177b0
mostly unified highlights
skmp Mar 26, 2026
c86850c
refine hover detection logic for pins, nodes, and wires; adjust thres…
skmp Mar 26, 2026
ed25319
multi select
skmp Mar 26, 2026
0915017
output_va_args groundwork
skmp Mar 26, 2026
b484ada
output handling for flow and banged expressions; separate fixed outpu…
skmp Mar 26, 2026
62c1a1d
fix non-bang nodes to have next post bangs
skmp Mar 26, 2026
3389cc3
add output ports and num_outputs to node types; adjust flow node hand…
skmp Mar 26, 2026
a4c6917
update FlowArg2 name handling and add fq_name method; update editor t…
skmp Mar 26, 2026
6c97640
enhance hover functionality to include +diamond pins in editor intera…
skmp Mar 26, 2026
626cf8b
refactor node ID and net name handling; introduce sentinel entries an…
skmp Mar 26, 2026
4a7d6c6
update node types to increase num_outputs from 1 to 2 for multiple nodes
skmp Mar 26, 2026
753c051
as_Node/Net -> as_node/net, dead code deletion
skmp Mar 26, 2026
1ae4778
Observer Pattern
skmp Mar 26, 2026
243dc4f
Refactor node rendering and editor structure
skmp Mar 26, 2026
0f5ca5c
Extract tooltip rendering functionality and style management for edit…
skmp Mar 26, 2026
21e950d
Refactor editor structure to introduce IEditorPane interface
skmp Mar 26, 2026
f296f08
editor->window.cpp/h
skmp Mar 26, 2026
9de4f08
Remove / #if LEGACY_EDITOR editor1
skmp Mar 26, 2026
a53d8a5
shift/alt + scroll = x/y pan
skmp Mar 26, 2026
7dd3656
further decoulping refactors
skmp Mar 26, 2026
722a591
move editor1 to legacy folder
skmp Mar 26, 2026
5838b34
nets_editor concept
skmp Mar 26, 2026
84dc2da
Add scroll pan speed to Editor2Style and update canvas panning logic
skmp Mar 26, 2026
2aaa7f4
fix: shorten node ids
skmp Mar 26, 2026
27617c5
in atto:0 import remove unconnected nets and replace with $unconnected
skmp Mar 26, 2026
5702ccf
implement wire connection functionality in Editor2Pane and VisualEditor
skmp Mar 27, 2026
f7bb2b7
Add functionality to delete hovered items in VisualEditor and Editor2…
skmp Mar 27, 2026
80bbd17
Merge branch 'rewrite'
skmp Mar 27, 2026
12b9747
1Merge branch 'skmp/rewrite'
skmp Mar 27, 2026
ec9f709
Merge branch 'skmp/wirring-and-networking'
skmp Mar 27, 2026
f33a0be
Add documentation
skmp Mar 27, 2026
073fe5b
Merge branch 'skmp/docs' into develop
skmp Mar 27, 2026
6bb8d6c
Add comprehensive instructions and naming guidelines for the Organic …
skmp Mar 27, 2026
3d9b6ad
Add comprehensive instructions and naming doc.
skmp Mar 27, 2026
26f9eef
Add introductory documentation for the Organic Assembler
skmp Mar 27, 2026
04bd88e
Add introductory podcast and notes for the Organic Assembler
skmp Mar 27, 2026
b7d0d56
Merge pull request #3 from nilware-io/podcast
skmp Mar 27, 2026
7f97ed6
Add podcast file for "Growing Instruments with the Organic Assembler"
skmp Mar 27, 2026
67f6b15
Merge pull request #2 from nilware-io/develop
skmp Mar 27, 2026
e5f63ce
Add YouTube link for the introductory podcast in README
skmp Mar 27, 2026
652b313
update README.md
skmp Mar 27, 2026
d3af94d
Update README.md
skmp Mar 27, 2026
a90f9f4
linux fix imgui
skmp Mar 28, 2026
0dea867
ci: Update CI workflow to trigger on stable and develop branches inst…
skmp Mar 28, 2026
447c115
Add session context documentation for Organic Assembler project
skmp Apr 6, 2026
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: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [main]
branches: [stable, develop]
pull_request:
branches: [main]
branches: [stable, develop]
Comment on lines +5 to +7
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI no longer runs for pushes/PRs targeting 'main'. If the default branch is still main (the workflow previously targeted it), this effectively disables CI for the primary branch. Consider including main as well (or confirm the repo default branch has been migrated to stable/develop).

Copilot uses AI. Check for mistakes.

jobs:
linux:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
/.vs
.generated/
output/
imgui.ini
imgui.ini
.atto/
92 changes: 59 additions & 33 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.25)
project(nanolang LANGUAGES C CXX)
project(attolang LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -12,59 +12,85 @@ if(NOT WIN32)
endif()
endif()

option(NANOLANG_BUILD_EDITOR "Build the nanoflow visual editor (requires SDL3 + imgui)" ON)
option(ATTOLANG_BUILD_EDITOR "Build the attoflow visual editor (requires SDL3 + imgui)" ON)

# nanolang: core language library (no UI dependencies)
add_library(nanolang STATIC
src/nano/types.cpp
src/nano/args.cpp
src/nano/expr.cpp
src/nano/type_utils.cpp
src/nano/serial.cpp
src/nano/inference.cpp
# attolang: core language library (no UI dependencies)
add_library(attolang STATIC
src/atto/types.cpp
src/atto/args.cpp
src/atto/expr.cpp
src/atto/type_utils.cpp
src/atto/serial.cpp
src/atto/inference.cpp
src/atto/graph_index.cpp
src/atto/shadow.cpp
src/atto/symbol_table.cpp
src/atto/graph_builder.cpp
)
target_include_directories(nanolang PUBLIC
target_include_directories(attolang PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/nano
${CMAKE_CURRENT_SOURCE_DIR}/src/atto
)

# nanoc: standalone compiler
add_executable(nanoc
src/nanoc/main.cpp
src/nanoc/codegen.cpp
# attoc: standalone compiler
add_executable(attoc
src/attoc/main.cpp
src/attoc/codegen.cpp
)
target_include_directories(nanoc PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/nanoc
target_include_directories(attoc PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/attoc
)
target_link_libraries(nanoc PRIVATE
nanolang
target_link_libraries(attoc PRIVATE
attolang
)

# test_inference: unit tests
add_executable(test_inference
tests/test_inference.cpp
)
target_link_libraries(test_inference PRIVATE
nanolang
attolang
)

# nanoflow: visual flow editor (optional, requires SDL3 + imgui)
if(NANOLANG_BUILD_EDITOR)
set(NANO_NEEDS_IMGUI ON)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/NanoDeps.cmake)
# attoflow: visual flow editor (optional, requires SDL3 + imgui)
if(ATTOLANG_BUILD_EDITOR)
set(ATTO_NEEDS_IMGUI ON)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/AttoDeps.cmake)

add_executable(nanoflow
src/nanoflow/main.cpp
src/nanoflow/editor.cpp
# Embed Liberation Mono font as C array
set(FONT_TTF "${CMAKE_CURRENT_SOURCE_DIR}/src/attoflow/fonts/LiberationMono-Regular.ttf")
set(FONT_HDR "${CMAKE_CURRENT_BINARY_DIR}/generated/LiberationMono_Regular.h")
file(READ "${FONT_TTF}" FONT_HEX HEX)
string(LENGTH "${FONT_HEX}" FONT_HEX_LEN)
math(EXPR FONT_SIZE "${FONT_HEX_LEN} / 2")
string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," FONT_BYTES "${FONT_HEX}")
file(WRITE "${FONT_HDR}"
"// Liberation Mono Regular - SIL Open Font License (auto-generated)\n"
"#pragma once\n"
"static const unsigned int LiberationMono_Regular_size = ${FONT_SIZE};\n"
"static const unsigned char LiberationMono_Regular_data[] = {\n"
"${FONT_BYTES}\n};\n"
)
target_include_directories(nanoflow PRIVATE

add_executable(attoflow
src/attoflow/main.cpp
src/attoflow/window.cpp
src/attoflow/editor2.cpp
src/attoflow/nets_editor.cpp
src/attoflow/visual_editor.cpp
src/attoflow/node_renderer.cpp
src/attoflow/tooltip_renderer.cpp
src/attoflow/editor_style.cpp
)
target_include_directories(attoflow PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/nanoflow
${CMAKE_CURRENT_SOURCE_DIR}/src/attoflow
${CMAKE_CURRENT_BINARY_DIR}/generated
)
if(WIN32)
target_link_libraries(nanoflow PRIVATE nanolang SDL3::SDL3 imgui::imgui)
target_link_libraries(attoflow PRIVATE attolang SDL3::SDL3 imgui::imgui)
else()
target_link_libraries(nanoflow PRIVATE nanolang SDL3::SDL3-static imgui_all)
target_link_libraries(attoflow PRIVATE attolang SDL3::SDL3-static imgui_all)
endif()
add_dependencies(nanoflow nanoc)
add_dependencies(attoflow attoc)
endif()
32 changes: 23 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
# nanolang
# Organic Assembler

A visual dataflow programming language with a node-based editor, standalone compiler, and runtime. Programs are authored as flow graphs in `.nano` files and compiled to C++. See an [example program](scenes/klavier/main.nano) and the full [language specification](nanolang.md).
An Operating System for Instruments (Όργανα), written in attolang. Instruments are multimodal dataflow programs — authored as node graphs possibly using the **attoflow** editor, compiled, and run in real time.

![nanolang](https://github.com/skmp/nanolang/blob/main/docs/nanolang.png)
Each instrument is a self-contained `.atto` program that defines its Functionality. The System compiles these programs runs them with hot-reload support.
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence has capitalization inconsistencies and a missing conjunction/punctuation, which makes it harder to read.

Suggested change
Each instrument is a self-contained `.atto` program that defines its Functionality. The System compiles these programs runs them with hot-reload support.
Each instrument is a self-contained `.atto` program that defines its functionality. The system compiles these programs and runs them with hot-reload support.

Copilot uses AI. Check for mistakes.

<img width="3840" height="2088" alt="nanolang" src="https://github.com/user-attachments/assets/8cdf22fc-34e3-4b70-9df0-a1fdd2024ec4" />

[![Youtube/the Organic Assembler](https://img.youtube.com/vi/ymzuD-oekFM/0.jpg)](https://www.youtube.com/watch?v=ymzuD-oekFM)

Listen to the [introductory podcast](docs/podcasts/introducing-orgasm.md) — *Growing Instruments with the Organic Assembler* ([SoundCloud](https://soundcloud.com/poiitidis/growing-instruments-with-the), [YouTube](https://youtu.be/ymzuD-oekFM)).

See an [example instrument](scenes/klavier/main.atto) and the full [language specification](docs/attolang.md).

## Components

| Target | Description |
|--------|-------------|
| **nanolang** | Core library — type system, expression parser, type inference, serialization |
| **nanoflow** | Visual node editor (SDL3 + Dear ImGui) |
| **nanoc** | Standalone compiler (`.nano` → C++) |
| **nanoruntime** | Runtime with GUI and ImGui bindings |
| **attolang** | Core language library — type system, expression parser, type inference, serialization |
| **attoflow** | Visual node editor for authoring instruments (SDL3 + Dear ImGui) |
| **attoc** | Standalone compiler (`.atto` → C++) |
| **attoruntime** | Instrument runtime with GUI and audio bindings |

## Language Highlights

- **Sigil-based value categories** — `%` data, `&` reference, `^` iterator, `@` lambda, `#` enum, `!` bang (trigger), `~` event
- **Rich type system** — scalars (`u8`–`s64`, `f32`/`f64`, `bool`, `string`), containers (`vector`, `map`, `list`, `set`, `queue`), fixed-size arrays, tensors, named struct types, function types
- **First-class literals, symbols, and types** — `literal<T,V>`, `symbol<name,type>`, `type<T>` as compile-time values
- **Bidirectional type inference** with automatic integer upcasting and iterator-to-reference decay
- **Bang-driven control flow** — nodes postfixed with `!` have explicit execution ordering via bang signals
- **Inline expressions** — node arguments can embed literals, variable refs, and sub-expressions directly
- **Lambda construction** — expression nodes can be captured as callable lambdas with automatic capture/parameter resolution
- **FFI support** — declare external C functions and call them from the graph
- **Standard library modules** — e.g. `decl_import std/imgui` for ImGui bindings
- **Standard library modules** — e.g. `decl_import "std/imgui"` for ImGui bindings

## Building

Expand All @@ -48,6 +56,12 @@ cmake -B build -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build build --parallel --config Release
```

## Instructions

New to the project? Start with the [Instructions](docs/instructions.md) — a guide to interpreting and following instructions, operating on the codebase, and building instruments with the Organic Assembler. It covers everything from the build system and architectural layers to the anatomy of an instrument and the audio callback pattern.

For naming philosophy, see [Names](docs/names.md). For the full documentation suite: [Architecture](docs/architecture.md), [Language Spec](docs/attolang.md), [Patterns](docs/patterns.md), [Thinking](docs/thinking.md), [Style](docs/style.md), [Coding](docs/coding.md), [Changelog](docs/changelog.md).

## License

MIT — see [LICENSE](LICENSE).
2 changes: 1 addition & 1 deletion nanostd/gui.nano → attostd/gui.atto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# GUI/AV runtime FFI bindings for nanolang
# GUI/AV runtime FFI bindings for attolang
# Import with: decl_import std/gui

# Create a window with audio and video callbacks.
Expand Down
2 changes: 1 addition & 1 deletion nanostd/imgui.nano → attostd/imgui.atto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ImGui FFI bindings for nanolang
# ImGui FFI bindings for attolang
# Import with: decl_import std/imgui

# Window management
Expand Down
8 changes: 4 additions & 4 deletions cmake/NanoDeps.cmake → cmake/AttoDeps.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# NanoDeps.cmake — Fetch SDL3 + imgui via FetchContent (non-Windows) or vcpkg (Windows)
# AttoDeps.cmake — Fetch SDL3 + imgui via FetchContent (non-Windows) or vcpkg (Windows)
#
# Provides:
# SDL3::SDL3 — SDL3 target
# imgui_all — imgui core + SDL3 backends (only if NANO_NEEDS_IMGUI is set)
# imgui_all — imgui core + SDL3 backends (only if ATTO_NEEDS_IMGUI is set)

if(WIN32)
# On Windows, use vcpkg (user must set CMAKE_TOOLCHAIN_FILE)
find_package(SDL3 CONFIG REQUIRED)
if(NANO_NEEDS_IMGUI)
if(ATTO_NEEDS_IMGUI)
find_package(imgui CONFIG REQUIRED)
endif()
else()
Expand All @@ -25,7 +25,7 @@ else()
set(SDL_TESTS OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(SDL3)

if(NANO_NEEDS_IMGUI)
if(ATTO_NEEDS_IMGUI)
FetchContent_Declare(imgui
GIT_REPOSITORY https://github.com/ocornut/imgui.git
GIT_TAG v1.92.6
Expand Down
135 changes: 135 additions & 0 deletions docs/2026-04-06.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Continuation — Organic Assembler Session Context

*Date: 2026-04-06*

This file captures the active context, open threads, and memory state for the Organic Assembler project, for use as a handoff document or NotebookLM/LLM context seed.

---

## Project Identity

**Organic Assembler (orgasm)** is an **Operating System for Instruments** — a platform where instruments are multimodal dataflow programs authored as `.atto` node graphs, compiled by `attoc`, and run in real time by `attoruntime`. The visual editor is `attoflow`. The language is `attolang`.

- "Instrument" = a `.atto` program (not just audio — multimodal)
- "OS" = the runtime + editor + compiler ecosystem managing instrument lifecycle
- Repo: `nilware-io/orgasm` (GitHub)

---

## Session Work (this conversation)

### Podcast documentation
- Created [docs/podcasts/introducing-orgasm.md](docs/podcasts/introducing-orgasm.md) — the podcast landing page
- Links: [SoundCloud](https://soundcloud.com/poiitidis/growing-instruments-with-the), [YouTube](https://youtu.be/ymzuD-oekFM), and the local [m4a file](docs/podcasts/Growing_instruments_with_the_Organic_Assembler.m4a)
- References [notes/introducing-orgasm.md](docs/podcasts/notes/introducing-orgasm.md) as the NotebookLM source
- Updated [README.md](README.md) to surface the podcast with both SoundCloud and YouTube links, right after the screenshot

---

## Active Project Threads (from memory)

### 1. Type System Redesign (partially complete as of 2026-03-25)

**Completed:**
- `literal<T,V>` type representation; expression parser produces `ExprKind::Literal` for all literals
- Removed all legacy ExprKind values (IntLiteral, F32Literal, etc.)
- `symbol<name,type>` and `undefined_symbol<name>` types
- `TypeApply`: `$0<$1,$2>` parsed as speculative `<>` on identifiers resolving to types
- All nodes except `label` get shadow nodes; `decl_var` descriptor redesigned
- `build_context` and `build_registry` removed — replaced by future `decl` bang chain

**TODO:**
- Implement `decl` bang chain evaluation (compile-time interpreter)
- `decl_type` outputs `type<T>`
- Event names without `~` prefix
- Namespace `::` operator in expressions
- Type construction via calling (e.g. `f32(42)` as cast)
- Rewrite tests for new declaration/inference flow

---

### 2. Editor2 & GraphBuilder Refactor

**Completed:**
- `BuilderEntry` inheritance base with `IdCategory` (Node/Net)
- `FlowArg2` inheritance hierarchy: `ArgNet2`, `ArgNumber2`, `ArgString2`, `ArgExpr2`
- Dirty tracking: `GraphBuilder::mark_dirty()` / `is_dirty()`
- Sentinels: `$empty` (FlowNodeBuilder), `$unconnected` (NetBuilder)
- `NodeKind2`: Flow, Banged, Event, Declaration, Special
- v0→v1 migration: name-based port mapping, shadow folding, lambda `-as_lambda` stripping
- Hover system: `hover_item_` variant, `detect_hover()`, `draw_hover_effects()`
- Pin shapes: Circle (data), Square (bang), Triangle (lambda), Diamond (va_args/optional)
- Liberation Mono font embedded via CMake `file(READ HEX)`

---

### 3. DLL Host & Wire Architecture (design phase)

**attohost.exe:**
- Separate host process — editor spawns it, it owns SDL window/audio/ImGui
- attoc generates `.dll` (SHARED); attohost does `LoadLibrary` → `on_start`
- Crash isolation; hot-reload without restarting editor

**wire\<T\>:**
- Release: typedef to `T` (zero overhead)
- Inspect: wraps value with metadata, notifies IPC channel
- Enables live inspection, value injection, oscilloscope view per wire

**First-class wires in .atto format:**
- `[[wire]]` top-level entities with `guid`, `from`, `to`
- Replace current `connections` array on nodes
- guid stable across node renames — used for inspector subscriptions

**IPC:**
- attoflow owns named pipe; attohost connects on startup
- attohost publishes wire table on connect; sends dirty updates per frame
- attoflow sends back: value overrides, reload signal, shutdown

---

### 4. Nested Lambda Scope Bug (open)

**Problem:** `collect_lambda_params` doesn't respect lambda boundaries — outer stored lambda params leak into inner `lock`/`iterate` lambdas. A `param` node reachable through an inner lambda's subgraph is incorrectly treated as belonging to the inner lambda.

**Proper fix:** Pre-inference pass that:
1. Identifies all lambda boundaries (every `as_lambda` → Lambda pin connection)
2. Assigns each node to its innermost lambda scope
3. `collect_lambda_params` only collects from nodes owned by the current scope

---

### 5. node.args Elimination (future work)

`node.args` is still a string tokenized at runtime ~40+ times across codegen, inference, type_utils, editor, serial. Goal: pre-extract all metadata into structured fields at load time; `node.args` becomes display/serialization only.

Migration order: codegen first (highest call count), then inference, then editor.

---

### 6. Web Target (deferred design)

- Editor compiled to Emscripten, runs in browser
- "Run" posts `.atto` to compile server on hardened Pi
- Server: attoc → C++ → emcc → returns `.wasm`
- Container: no network inside, 60s timeout, 512MB RAM, read-only rootfs
- Attack surface bounded to `.atto` input (no arbitrary C++ injection)

---

## Key Files

| Path | Purpose |
|------|---------|
| [README.md](README.md) | Project overview, components, build instructions |
| [docs/attolang.md](docs/attolang.md) | Full language specification |
| [docs/architecture.md](docs/architecture.md) | Architectural layers |
| [docs/instructions.md](docs/instructions.md) | Guide for operating on the codebase |
| [docs/patterns.md](docs/patterns.md) | Instrument patterns |
| [docs/thinking.md](docs/thinking.md) | Design philosophy |
| [docs/style.md](docs/style.md) | Code style |
| [docs/coding.md](docs/coding.md) | Coding conventions |
| [docs/changelog.md](docs/changelog.md) | Change history |
| [docs/names.md](docs/names.md) | Naming philosophy |
| [docs/podcasts/introducing-orgasm.md](docs/podcasts/introducing-orgasm.md) | Podcast landing page |
| [docs/podcasts/notes/introducing-orgasm.md](docs/podcasts/notes/introducing-orgasm.md) | NotebookLM source notes |
| [scenes/klavier/main.atto](scenes/klavier/main.atto) | Example instrument |
Loading
Loading