diff --git a/Cargo.lock b/Cargo.lock index 530bc9c2..e26674d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1016,6 +1016,16 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +[[package]] +name = "colored" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" +dependencies = [ + "lazy_static", + "windows-sys 0.59.0", +] + [[package]] name = "combine" version = "4.6.7" @@ -1509,6 +1519,19 @@ dependencies = [ "syn 2.0.113", ] +[[package]] +name = "dify" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ce0fb972943b4e88cd03b8f92953df0c71bb05e0bde8e5b684895d808013cc" +dependencies = [ + "anyhow", + "colored", + "getopts", + "image", + "rayon", +] + [[package]] name = "digest" version = "0.10.7" @@ -1708,12 +1731,12 @@ dependencies = [ [[package]] name = "ecolor" -version = "0.34.1" +version = "0.34.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "137c0ce4ce4152ff7e223a7ce22ee1057cdff61fce0a45c32459c3ccec64868d" +checksum = "a05fbfa222ffb51989d5ccf33e5f7aebfcf96c5023413856b0c3618a7f79896e" dependencies = [ "bytemuck", - "emath 0.34.1", + "emath 0.34.3", "serde", ] @@ -1758,14 +1781,14 @@ dependencies = [ [[package]] name = "egui" -version = "0.34.1" +version = "0.34.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f34aaf627da598dfadd64b0fee6101d22e9c451d1e5348157312720b7f459f0f" +checksum = "42112be0ae157289312b92b3dfaf20e911b5a3c4c65d4aab0e7c47fbc0ce16e3" dependencies = [ "accesskit", "ahash", "bitflags 2.10.0", - "emath 0.34.1", + "emath 0.34.3", "epaint", "log", "nohash-hasher", @@ -1844,6 +1867,22 @@ dependencies = [ "winit", ] +[[package]] +name = "egui_kittest" +version = "0.34.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cb65436bc6f214ecc8ef4d9056a9344f92e70e22c162dbc3d515913df0fd3c5" +dependencies = [ + "dify", + "egui", + "image", + "kittest", + "open", + "serde", + "tempfile", + "toml 1.1.2+spec-1.1.0", +] + [[package]] name = "either" version = "1.15.0" @@ -1858,9 +1897,9 @@ checksum = "9e4cadcff7a5353ba72b7fea76bf2122b5ebdbc68e8155aa56dfdea90083fe1b" [[package]] name = "emath" -version = "0.34.1" +version = "0.34.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a05cd8bdf3b598488c627ca97c7fe8909448ffa26278dd3c7e535cdb554d721" +checksum = "b53f0d33a479321da6b0caa71366c9f67e8a2c149762d90bdc0d16e601ee8ecb" dependencies = [ "bytemuck", "serde", @@ -1956,14 +1995,14 @@ dependencies = [ [[package]] name = "epaint" -version = "0.34.1" +version = "0.34.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04f3017dd67f147a697ee0c8484fb568fd9553e2a0c114be5020dbbc11962841" +checksum = "6675898a291ec212fc3df04f537d177fce8496120244590e6359dcaa4c25da79" dependencies = [ "ahash", "bytemuck", "ecolor", - "emath 0.34.1", + "emath 0.34.3", "epaint_default_fonts", "font-types", "log", @@ -1979,9 +2018,9 @@ dependencies = [ [[package]] name = "epaint_default_fonts" -version = "0.34.1" +version = "0.34.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e3b85a2bb775a3ab02d077a65cc31575c11b2584581913253cc11ce49f48bba" +checksum = "f8970033a4282a7bcf899b38b5ed3a58b732fe093d03785d58648515d8d309da" [[package]] name = "equivalent" @@ -3172,6 +3211,25 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9c13ae9d91148fcb4aab6654c4c2a7d02a15395ea9e23f65170f175f8b269ce" +[[package]] +name = "is-docker" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3" +dependencies = [ + "once_cell", +] + +[[package]] +name = "is-wsl" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5" +dependencies = [ + "is-docker", + "once_cell", +] + [[package]] name = "is_terminal_polyfill" version = "1.70.2" @@ -3320,6 +3378,16 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" +[[package]] +name = "kittest" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ceaa75eb0036a32b6b9833962eb18137449e9817e2e586006471925b727fd5" +dependencies = [ + "accesskit", + "accesskit_consumer", +] + [[package]] name = "kqueue" version = "1.1.1" @@ -4271,6 +4339,17 @@ version = "11.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" +[[package]] +name = "open" +version = "5.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fbaa89d2ddc8473c78a3adf69eea8cffa28c483b8e02a971ef31527cd0fc92c" +dependencies = [ + "is-wsl", + "libc", + "pathdiff", +] + [[package]] name = "option-ext" version = "0.2.0" @@ -4369,6 +4448,12 @@ dependencies = [ "windows-link 0.2.1", ] +[[package]] +name = "pathdiff" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" + [[package]] name = "pdfium-render" version = "0.9.0" @@ -5334,6 +5419,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" +dependencies = [ + "serde_core", +] + [[package]] name = "servo_arc" version = "0.4.3" @@ -5749,7 +5843,7 @@ dependencies = [ "cfg-expr", "heck 0.5.0", "pkg-config", - "toml", + "toml 0.8.2", "version-compare", ] @@ -6008,11 +6102,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" dependencies = [ "serde", - "serde_spanned", + "serde_spanned 0.6.9", "toml_datetime 0.6.3", "toml_edit 0.20.2", ] +[[package]] +name = "toml" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee" +dependencies = [ + "serde_core", + "serde_spanned 1.1.1", + "toml_datetime 1.1.1+spec-1.1.0", + "toml_parser", + "winnow 1.0.3", +] + [[package]] name = "toml_datetime" version = "0.6.3" @@ -6031,6 +6138,15 @@ dependencies = [ "serde_core", ] +[[package]] +name = "toml_datetime" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +dependencies = [ + "serde_core", +] + [[package]] name = "toml_edit" version = "0.19.15" @@ -6050,7 +6166,7 @@ checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ "indexmap", "serde", - "serde_spanned", + "serde_spanned 0.6.9", "toml_datetime 0.6.3", "winnow 0.5.40", ] @@ -6069,11 +6185,11 @@ dependencies = [ [[package]] name = "toml_parser" -version = "1.0.6+spec-1.1.0" +version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" dependencies = [ - "winnow 0.7.14", + "winnow 1.0.3", ] [[package]] @@ -7534,6 +7650,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1" + [[package]] name = "wit-bindgen" version = "0.46.0" @@ -7903,6 +8025,10 @@ dependencies = [ "zo-driver", ] +[[package]] +name = "zo-abi" +version = "0.4.0" + [[package]] name = "zo-analyzer" version = "0.4.0" @@ -8086,6 +8212,7 @@ dependencies = [ "hashbrown 0.16.1", "rustc-hash 2.1.2", "tempfile", + "zo-abi", "zo-analyzer", "zo-bundler", "zo-codegen", @@ -8447,6 +8574,7 @@ dependencies = [ "sha1", "sha2", "sysinfo", + "zo-abi", "zo-c-abi", "zo-error", "zo-reporter", @@ -8475,6 +8603,7 @@ name = "zo-runtime-native" version = "0.4.0" dependencies = [ "eframe", + "egui_kittest", "image", "libloading 0.9.0", "rustc-hash 2.1.2", diff --git a/Cargo.toml b/Cargo.toml index 62760120..3c7045e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -79,6 +79,7 @@ zo-emitter-arm = { path = "crates/compiler/zo-emitter-arm", version = "0.4.0" } zo-emitter-x86 = { path = "crates/compiler/zo-emitter-x86", version = "0.3.11" } zo-error = { path = "crates/compiler/zo-error", version = "0.4.0" } zo-executor = { path = "crates/compiler/zo-executor", version = "0.4.0" } +zo-abi = { path = "crates/compiler/zo-abi", version = "0.4.0" } zo-host-paths = { path = "crates/compiler/zo-host-paths", version = "0.4.0" } zo-interner = { path = "crates/compiler/zo-interner", version = "0.4.0" } zo-linker = { path = "crates/compiler/zo-linker", version = "0.4.0" } @@ -230,16 +231,14 @@ objc2-ui-kit = { version = "0.3", features = [ "UIVisualEffectView", "UIGlassEffect", "UIButtonConfiguration", + "UISwitch", + "UISegmentedControl", "UIImage", "UIImageView", "objc2-core-foundation", "objc2-quartz-core", "objc2-core-graphics", ] } -# The glass panel's specular rim is drawn on the effect view's -# `CALayer` (`setBorderColor` takes a `CGColor`), so quartz-core needs -# its `objc2-core-graphics` feature — `objc2-ui-kit` pulls quartz-core -# but only with default features, so enable it here for the whole graph. objc2-quartz-core = { version = "0.3", features = [ "CALayer", "objc2-core-graphics", diff --git a/README.md b/README.md index c6f9e1ac..43664ca8 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,5 @@ # zo. - ``` - [zo] lines processed (including blank lines and comments) — 499998. - │ - ├── "Why accept slow compilers? Just make them faster." — Jonathan Blow - │ - ├── ✓ [zo@front-end] time — 301.591 ms (42.5%). - │ ├── ⏺ [zo@tokenizer] time — 57.064 ms (8.0%). - │ │ └── ⏺ processed — 2399990 tokens. - │ ├── ⏺ [zo@parser] time — 36.126 ms (5.1%). - │ │ └── ⏺ parsed — 2350646 nodes. - │ └── ⏺ [zo@analyzer] time — 208.401 ms (29.3%). - │ └── ⏺ annotated — 349996 nodes. - ├── ✓ [zo@back-end] time — 408.614 ms (57.5%). - │ ├── ⏺ [zo@codegen:arm64-apple-darwin] time — 391.537 ms (55.1%). - │ │ └── ⏺ generated — 1 artifacts. - │ └── ⏺ [zo@linker] time — 17.076 ms (2.4%). - │ └── ⏺ linked — 1 files. - └── ✓ [zo@total] time — 710.205 ms (100.0%). - - ⚡ speed: 704.02K LoC/s. - ``` - [![CI](https://github.com/invisageable/zo/workflows/CI/badge.svg)](https://github.com/invisageable/zo/actions) [![Discord](https://img.shields.io/badge/discord-compilords-7289DA?logo=discord)](https://discord.gg/JaNc4Nk5xw) --- @@ -30,7 +8,7 @@ THE AiM OF THE PROJECT iS TO ENHANCE THE DEVELOPER EXPERiENCE, MAKiNG iT SEAMLESS TO BUiLD SOFTWARE THAT REFLECTS YOUR CREATiViTY. WE FOCUS ON DETAiLS THAT MATTER, WHERE TRANSFORMiNG YOUR THOUGHTS iNTO PROGRAMS iS NOT JUST EASY, BUT ENJOYABLE. -zo (pronounced `/zuː/` just like "zoo") iS A SiMPLE, LiGHTWEiGHT, CROSS-PLATFORM, GENERAL-PURPOSE PROGRAMMiNG LANGUAGE. TO SHiP, RUN AND BUiLD TYPED-SAFE DESKTOP, MOBiLE AND WEB APPLiCATiONS WiTH ONE CODE SOURCE. THE CORE LiBRARY iNCLUDES SEVERAL PACKAGES. PROViDERS ARE AVAiLABLE TO EXPAND THE LANGUAGE's CAPABiLiTiES. +zo (pronounced `/zuː/` just like "zoo") iS A PRACTiCAL, LiGHTWEiGHT, CROSS-PLATFORM, GENERAL-PURPOSE PROGRAMMiNG LANGUAGE. TO SHiP, RUN AND BUiLD TYPE-SAFE DESKTOP, MOBiLE AND WEB APPLiCATiONS WiTH ONE CODE SOURCE. THE CORE LiBRARY iNCLUDES SEVERAL PACKAGES. PROViDERS ARE AVAiLABLE TO EXPAND THE LANGUAGE's CAPABiLiTiES. **JOiN THE DEVOLUTiON.** @@ -38,7 +16,7 @@ zo (pronounced `/zuː/` just like "zoo") iS A SiMPLE, LiGHTWEiGHT, CROSS-PLATFOR ## usage. -THiS PROGRAM DECLARES A COMPONENT (`counter`) COMPOSED BY TWO BUTTONS (` + {when open ? :

closed

} + ; + + #render page; +}"#, + |sir| { + let (commands, bindings) = sir + .iter() + .filter_map(|i| match i { + Insn::Template { + commands, bindings, .. + } => Some((commands, bindings)), + _ => None, + }) + .next_back() + .expect("page template"); + + assert_eq!(bindings.conditional.len(), 1, "one conditional region"); + + let cond = &bindings.conditional[0]; + + let blob_text = |cmds: &[UiCommand]| -> String { + cmds + .iter() + .filter_map(|c| match c { + UiCommand::Text(t) => Some(t.as_str()), + _ => None, + }) + .collect() + }; + + assert!( + blob_text(&cond.on_true).contains("menu items"), + "true branch compiled: {:?}", + cond.on_true + ); + assert!( + blob_text(&cond.on_false).contains("closed"), + "false branch compiled: {:?}", + cond.on_false + ); + + // `open` starts false → the false branch is inline. + assert_eq!(cond.len, cond.on_false.len()); + + let region_text: String = commands[cond.cmd_idx..cond.cmd_idx + cond.len] + .iter() + .filter_map(|c| match c { + UiCommand::Text(t) => Some(t.as_str()), + _ => None, + }) + .collect(); + + assert!( + region_text.contains("closed"), + "inline region is the initial branch: {region_text}" + ); + + // The branch blobs never leak into the SIR stream. + assert!( + !blob_text(commands).contains("menu items"), + "inactive branch must not be inline" + ); + }, + ); +} + +#[test] +fn tier2_conditional_missing_else_is_an_error() { + // `when` always takes both branches — `?` without `:` is an + // error, never an implicit empty fragment. + assert_execution_error( + r#" +fun main() { + mut open := true; + + imu page ::=
+ + {when open ? } +
; + + #render page; +}"#, + ErrorKind::ExpectedExpression, + ); +} + +#[test] +fn compile_time_conditional_keeps_the_tier1_fold() { + // `imu` condition: no runtime swap — the general path folds it + // and no conditional binding is recorded. + assert_sir_structure( + r#" +fun main() { + imu fancy := true; + + imu page ::=
+ {when fancy ? bold :

plain

} +
; + + #render page; +}"#, + |sir| { + let bindings = sir + .iter() + .filter_map(|i| match i { + Insn::Template { bindings, .. } => Some(bindings), + _ => None, + }) + .next_back() + .expect("page template"); + + assert!( + bindings.conditional.is_empty(), + "compile-time conditions stay tier 1" + ); + }, + ); +} + +#[test] +fn tier2_conditional_rejects_non_bool_condition() { + // Conditions are `bool` — an int flag is a type error, never a + // truthy coercion. + assert_execution_error( + r#" +fun main() { + mut open := 0; + + imu page ::=
+ + {when open ? :

closed

} +
; + + #render page; +}"#, + ErrorKind::TypeMismatch, + ); +} + +#[test] +fn per_instance_state_gives_each_instance_its_own_cell() { + // Two `` instances must NOT share a `count` cell. The + // executor re-materializes the body `mut` under a synthetic + // per-instance name (`count$N`); the page must carry two + // distinct reactive text bindings, each with its own init. + assert_sir_structure( + r#" +fun counter() -> { + mut count := 0; + + return
+ + {count} +
; +} + +fun main() { + imu page ::=
+ + +
; + + #render page; +}"#, + |sir| { + // The page template carries two text bindings (one per + // instance's `{count}`), and they target distinct symbols. + let bindings = sir + .iter() + .filter_map(|i| match i { + Insn::Template { bindings, .. } => Some(bindings), + _ => None, + }) + .next_back() + .expect("page template"); + + assert_eq!( + bindings.text.len(), + 2, + "two instances → two independent text bindings: {:?}", + bindings.text + ); + + let (a, b) = (bindings.text[0].1, bindings.text[1].1); + + assert_ne!(a, b, "the two instances must bind DISTINCT state symbols"); + }, + ); +} + +#[test] +fn form_controls_emit_their_tags_and_attrs() { + // HTML-faithful surface: checkbox/radio are ``, + // dropdowns are ` + + + ; + + #render page; +}"#, + |sir| { + let page = sir + .iter() + .filter_map(|i| match i { + Insn::Template { commands, .. } => Some(commands), + _ => None, + }) + .next_back() + .expect("page template"); + + let tag_of = |tag: &ElementTag, name: &str| { + page + .iter() + .filter(|c| { + matches!(c, UiCommand::Element { tag: t, attrs, .. } + if t == tag + && attrs.iter().any(|a| a.name() == "type" + && a.as_str() == Some(name))) + }) + .count() + }; + + assert_eq!(tag_of(&ElementTag::Input, "checkbox"), 1, "checkbox"); + assert_eq!(tag_of(&ElementTag::Input, "radio"), 1, "radio"); + + let selects = page + .iter() + .filter(|c| { + matches!(c, UiCommand::Element { tag, .. } + if *tag == ElementTag::Select) + }) + .count(); + let options = page + .iter() + .filter(|c| { + matches!(c, UiCommand::Element { tag, .. } + if *tag == ElementTag::Option) + }) + .count(); + + assert_eq!(selects, 1, "one select"); + assert_eq!(options, 2, "two options"); + + // The radio's group name + value survive as attributes. + let radio_named = page.iter().any(|c| { + matches!(c, + UiCommand::Element { attrs, .. } + if attrs.iter().any(|a| a.name() == "name" + && a.as_str() == Some("size"))) + }); + + assert!(radio_named, "radio carries its group name"); + }, + ); +} diff --git a/crates/compiler/zo-liveness/src/tests.rs b/crates/compiler/zo-liveness/src/tests.rs index 591057e1..b926c26d 100644 --- a/crates/compiler/zo-liveness/src/tests.rs +++ b/crates/compiler/zo-liveness/src/tests.rs @@ -17,6 +17,7 @@ fn array_store_uses_three_values() { index: ValueId(1), value: ValueId(2), ty_id: TyId(8), + owner: None, }; let mut uses = Vec::new(); @@ -71,6 +72,7 @@ fn array_store_produces_no_value() { index: ValueId(1), value: ValueId(2), ty_id: TyId(8), + owner: None, }]; let ids = compute_value_ids(&insns); diff --git a/crates/compiler/zo-notes/public/grammar/README.md b/crates/compiler/zo-notes/public/grammar/README.md new file mode 100644 index 00000000..b7c3046c --- /dev/null +++ b/crates/compiler/zo-notes/public/grammar/README.md @@ -0,0 +1,3 @@ +# grammar. + +> *C'est une grammaire amère sa mère.* diff --git a/crates/compiler/zo-notes/public/guidelines/00-prologue.md b/crates/compiler/zo-notes/public/guidelines/README.md similarity index 99% rename from crates/compiler/zo-notes/public/guidelines/00-prologue.md rename to crates/compiler/zo-notes/public/guidelines/README.md index a1148497..f389b348 100644 --- a/crates/compiler/zo-notes/public/guidelines/00-prologue.md +++ b/crates/compiler/zo-notes/public/guidelines/README.md @@ -1,4 +1,4 @@ -# prologue. +# guidelines. > *The guidelines catalog.* diff --git a/crates/compiler/zo-notes/public/docs/error-message-argument-structure.md b/crates/compiler/zo-notes/public/spec/error-message-argument-structure.md similarity index 100% rename from crates/compiler/zo-notes/public/docs/error-message-argument-structure.md rename to crates/compiler/zo-notes/public/spec/error-message-argument-structure.md diff --git a/crates/compiler/zo-notes/public/zo.md b/crates/compiler/zo-notes/public/zo.md new file mode 100644 index 00000000..cbf4b310 --- /dev/null +++ b/crates/compiler/zo-notes/public/zo.md @@ -0,0 +1,203 @@ +# zo. + +> *Turn your thoughts into type-safe software and Ui instantly.* + +This reference manual is for the zo programming language. + +@author — invisageable +@author — compilords + +> *DiSCLAiMER — zo is in early development. We are opening gates, testing some paths. Changes will be made, certain parts work, certain parts don't. Some of them will be removed.* +> +> *Some features described in this manual may not be available yet. It crafts the foundation as a draft. This document is not the final specification.* +> +> *For any suggestion, keep your focus on reductions to the language. What feature can be combined or omitted? At this point, every ``additive'' feature we're likely to support is already on the table. The task ahead involves combining, trimming, and implementing.* + +## introduction. + +zo is a Rust-prehistory's child. It inherits most of its concepts and philosophy. Without being an erzatz, zo is way far from Rust and find its niche with zsx (zo Syntax Extension) as builtin to build cross-platform user interfaces. It's a general-purpose programming language so you can create and maintain any kind of application. + +zo is a mix of imperative, concurrent actor, functional styles. It supports generics, foreign function interfaces, ... + +## goals. + +The language design pursues the following goals: + + - Compile-time error detection and prevention. + - Run-time fault tolerance and containment. + - Clarity and precision of expression. + - Implementation simplicity. + - Run-time efficiency. + - High concurrency. + +> *NOTE — zo is inspired by technologies that have been used earlier in other languages. These engineering goals are already been prove and are pretty solid. zo do not reivent the wheel, it assembles thing accordingly.* + +Like all new langages developped in a technological context. zo's goals focus on writing large programs that interact with internet (server & client), user interfaces and are thus much more concerned with safety and concurrency than older generations of program. + +## features. + +### no-pointer. + +... + +### lightweight tasks with no shared mutable state. + +... + +### ui template as builtin. + +... + +### cross-platform. + +... + +### direct interface to C code. + +... + +### generic code. + +... + +### local type inference. + +... + +### dynamic metaprogramming. + +... + +### static metaprogramming. + +... + +### idempotent failure. + +... + +### type inference. + +... + +### static control over mutability. + +... + +### helpful error messages. + +... + +## influences. + +> *"Why accept slow compilers? Just make them faster." — Jonathan Blow* + +> *"Semantic is king." — Robert Virding* + +> *""Simplicity is a prerequisite for reliability." — Edsger W. Dijkstra* + +> *""Re-think traditional compiler design." — Chandler Carruth"* + +> *""The faster your software runs, the less power his consumed." — Chandler Carruth"* + +> *""Challenge assumptions with aggressive goals." — Chandler Carruth"* + +> *""Performance is king!" — Mike Acton"* + +> *""People don't get it! People don't know how fast computers are!" — Jonathan Blow"* + +--- + +zo is not a particularly original language. It may however appear unusual by contemporary standards, as its design elements are drawn from a number of `historical` languages that have, with a few exceptions, fallen out of +favour. Five prominent lineages contribute the most: + +**-rust-prehistory** + +... + +**-jai** + +... + +**erlang** + +... + +**-cyclone-and-ada** + +Cyclone is a programming language to make a low-level C-like language safe made by Nikhil Swamy, Michael Hicks, Greg Morrisett, Dan Grossman and Trevor Jim. zo adopt Cyclone's static lifetime analysis, unique/affine pointer semantics, and lexical region drop boundaries. + +Ada is an extremely strong typing programming language and is designed for developing very large software systems. + +**-imba** + +Imba is a fascinating Web programming language, the right fit to build frontend and backend made by Sindre Aarsaether and (...). zo integrated a similar styling system coupled to zsx, it includes shorthands `d == display`, `bg == background`, etc. + +**-es4-and-e4x** + +... + +Additional specific influences can be seen from the following languages: + + - The structural algebraic types and compilation manager of SML. + - The syntax-extension systems of Camlp4 and the Common Lisp readtable. + - The deterministic destructor system of C++. + +## tutorial. + +See the [initiation](https://zo.compilords.house/initiation) + +## reference. + + - Lexical structure. + - Grammar. + - zsx. + +### lexical structure. + +... + + - Ignored characters. + - Identifier tokens. + - Keyword tokens. + - Numeric tokens. + - String and character tokens. + - Syntactic extension tokens. + - Special symbol tokens. + +**-ignored-characters** + +... + +**-identifier-tokens** + +... + +**-keyword-tokens** + +... + +**-numeric-tokens** + +... + +**-string-and-character-tokens** + +... + +**-syntactic-extension-tokens** + +... + +**-special-symbol-tokens** + +... + +### grammar. + +See the EBNF [grammar](crates/compiler/zo-notes/public/grammar/zo.ebnf). + +### zsx. + +... + diff --git a/crates/compiler/zo-profiler/src/quotes.rs b/crates/compiler/zo-profiler/src/quotes.rs index 94ba2ef3..339ac25d 100644 --- a/crates/compiler/zo-profiler/src/quotes.rs +++ b/crates/compiler/zo-profiler/src/quotes.rs @@ -26,7 +26,7 @@ pub(crate) const QUOTES: &[&str] = &[ "\"Lies — code is more important than data.\" — Mike Acton", "\"Performance equals Efficiency.\" — Eskil Steenberg", "\"I don't know why linkers are so slow, but they are slow.\" — Jonathan Blow", - "\"People don't get it ! People don't know how fast computers are!\" — Jonathan Blow", + "\"People don't get it! People don't know how fast computers are!\" — Jonathan Blow", "\"Simplicity is the ultimate sophistication.\" — Leonardo da Vinci", "\"If you can't make a tool your primary workflow then you didn't build a tool.\" — Rik Arends", "\"Insanely faster, Usain Bolt would be jealous.\" — i2N", diff --git a/crates/compiler/zo-runtime-ios/src/app.rs b/crates/compiler/zo-runtime-ios/src/app.rs index 6c4d4e7c..f02fa2e9 100644 --- a/crates/compiler/zo-runtime-ios/src/app.rs +++ b/crates/compiler/zo-runtime-ios/src/app.rs @@ -24,8 +24,8 @@ use objc2::{ClassType, MainThreadMarker, MainThreadOnly, define_class, sel}; use objc2_core_foundation::{CGFloat, CGPoint, CGRect, CGSize}; use objc2_foundation::{ - NSBundle, NSData, NSDictionary, NSObjectProtocol, NSOperatingSystemVersion, - NSProcessInfo, NSString, + NSArray, NSBundle, NSData, NSDictionary, NSObjectProtocol, + NSOperatingSystemVersion, NSProcessInfo, NSString, }; #[cfg(target_os = "watchos")] use objc2_ui_kit::UIScreen; @@ -33,8 +33,9 @@ use objc2_ui_kit::{ UIApplication, UIApplicationLaunchOptionsKey, UIButton, UIButtonConfiguration, UIButtonType, UIColor, UIControlEvents, UIControlState, UIFont, UIGlassEffect, UIGlassEffectStyle, UIImage, - UIImageView, UILabel, UITextBorderStyle, UITextField, UIView, - UIViewContentMode, UIViewController, UIVisualEffectView, UIWindow, + UIImageView, UILabel, UISegmentedControl, UISwitch, UITextBorderStyle, + UITextField, UIView, UIViewContentMode, UIViewController, UIVisualEffectView, + UIWindow, }; #[cfg(target_os = "ios")] use objc2_ui_kit::{ @@ -121,6 +122,13 @@ enum PlacedView { /// An editable text input (`` / `