docs: some initial groundwork #2

Merged
multisamplednight merged 26 commits from :initial-docs into main 2024-01-20 19:00:52 +00:00
5 changed files with 152 additions and 22 deletions
Showing only changes of commit 3746726245 - Show all commits

79
docs/design/graphics.typ Normal file
View file

@ -0,0 +1,79 @@
#import "@preview/cetz:0.1.2"
#import cetz.draw: *
// quick reference
// - `graphic` is for inline icons/images
// - `canvas` is for centered more prominent stuff
// - `group` can be used in either of ^, but not standalone
#let graphic(what) = box({
cetz.canvas({
// any preamble-ish stuff can go here
set-style(
mark: (angle: 90deg)
)
what
})
})
#let canvas(what) = {
align(center, graphic(what))
}
// smaller stuff
#let arrow(length: 1cm, lift: 4pt, stroke: 1pt) = graphic({
line((0, lift), (rel: (length, 0)), mark: (end: ">", stroke: stroke))
// hack for the bounding box bottom
// so that `lift` even has any effect
line((0, 0), (0, 0), stroke: none)
})
// larger stuff
#let nodes(
distance: 3cm,
arrow-spacing: 0.15cm,
// cetz will support rounded rects in 0.2.0
style: (frame: "rect", padding: 0.1cm),
..labels,
) = group({
let labels = labels.pos()
// draw each label itself
for (i, label) in labels.enumerate() {
if i != 0 {
set-origin((distance, 0))
}
content((0, 0), name: "label-" + str(i), label, ..style)
}
// then draw an arrow from each to each
// since an arrow is between two, the last one can't be connected with the "next-to-last" one
// so we leave it out
for i in range(labels.len() - 1) {
line(
(rel: (arrow-spacing, 0), to: "label-" + str(i) + ".right"),
(rel: (-arrow-spacing, 0), to: "label-" + str(i + 1) + ".left"),
mark: (end: ">"),
)
}
})
#let stages-overview = canvas({
nodes(
[Source],
[Graph IR],
[Optimizer],
[Compiler],
[VM Bytecode],
[VM],
)
})
// literally just for standalone display of the graphics alone
#import "../template.typ": conf
#show: conf

View file

@ -0,0 +1,31 @@
#import "../template.typ": conf
#import "graphics.typ"
#show: conf.with(title: [iOwO design], subtitle: [don't worry, we're just dreaming])
#show ">": graphics.arrow()
= Type data model
== Requirements
multisamplednight marked this conversation as resolved Outdated

I think we should remove this entire section from this document for now, since I'm working on this in a different document

I think we should remove this entire section from this document for now, since I'm working on this in a different document
- Color-aware
- It can handle colors and colorspaces for images
- ocio????
- number/number type support
- custom types (structs/enums)
- algebraic enums
- traits (`Numeric`...)
= Execution stages
#graphics.stages-overview
multisamplednight marked this conversation as resolved Outdated

I really dislike using the word execution here, as it's a very common trigger word. Do you have any alternative ideas?

I **really** dislike using the word `execution` here, as it's a very common trigger word. Do you have any alternative ideas?

Parsing? Evaluation? Interpretation?

Parsing? Evaluation? Interpretation?

Those are all individual phases of execution.

Those are all individual phases of execution.

Hm. Thinking about it, Evaluation seems generic enough. I'll use that then.

Hm. Thinking about it, `Evaluation` seems generic enough. I'll use that then.
== Source > Graph IR
multisamplednight marked this conversation as resolved Outdated

This is fine, probably something we can work on further as the project progresses though and it gets more complex...

This is fine, probably something we can work on further as the project progresses though and it gets more complex...
== Graph IR > VM Bytecode
=== Optimizer
=== Compiler
== VM Bytecode > VM

View file

@ -1,16 +0,0 @@
#import "../template.typ": conf
#show: doc => conf(
doc
)
= Type data model
== Requirements
- Color-aware
- It can handle colors and colorspaces for images
- ocio????
- number/number type support
- custom types (structs/enums)
- algebraic enums
- traits (`Numeric`...)

View file

@ -1,12 +1,47 @@
// would also be interesting to try out IBM Plex Mono/Sans sometime
#let atk = "Atkinson Hyperlegible"
#let fonts = (
main: (font: atk, size: 12pt),
title: (font: atk, size: 20pt),
subtitle: (font: atk, size: 10pt),
heading: (font: "Montserrat", weight: "regular"),
)
#let conf( #let conf(
doc title: none,
subtitle: none,
doc,
) = { ) = {
set text(font: "Atkinson Hyperlegible"); set page(
show heading: it => [ numbering: "1 / 1",
#set text(font: "Montserrat", weight: "regular") header: locate(loc => {
datetime.today().display()
#it if counter(page).at(loc).first() > 1 {
] // on all pages other than the first, the title is useful to have at hand
h(1fr)
title
}
}),
)
set text(..fonts.main)
set heading(numbering: "A.1")
show heading: it => text(..fonts.heading, it)
// document title
if title != none {
align(
right,
text(..fonts.title, title)
+ v(-12pt)
+ text(..fonts.subtitle, subtitle)
)
v(0.25cm)
}
// content itself
doc doc
} }

View file

@ -3,3 +3,4 @@ docs:
typst compile $doc --root=docs; \ typst compile $doc --root=docs; \
mv "$(dirname $doc)/$(basename $doc .typ).pdf" docs/compiled/; \ mv "$(dirname $doc)/$(basename $doc .typ).pdf" docs/compiled/; \
done done