@shd101wyy/yo 0.0.32 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,6 +9,36 @@ Yo aims to be **Simple** and **Fast** (around 0% - 15% slower than C).
9
9
 
10
10
  > The name `Yo` comes from the Chinese word `柚` (yòu), meaning `pomelo`, a large citrus fruit similar to grapefruit. It's my daughter's nickname.
11
11
 
12
+ 📖 [My Story with Programming Languages](./docs/en-US/MY_STORY_WITH_PROGRAMMING_LANGUAGES.md) — the journey from Java at 16 to building Yo.
13
+
14
+ <!-- @import "[TOC]" {cmd="toc" depthFrom=2 depthTo=6 orderedList=false} -->
15
+
16
+ <!-- code_chunk_output -->
17
+
18
+ - [Features](#features)
19
+ - [Installation](#installation)
20
+ - [C Compiler Requirement](#c-compiler-requirement)
21
+ - [Installing Clang](#installing-clang)
22
+ - [Linux liburing Requirement](#linux-liburing-requirement)
23
+ - [Installing liburing (Linux)](#installing-liburing-linux)
24
+ - [pkg-config / vcpkg Requirement](#pkg-config--vcpkg-requirement)
25
+ - [Installing pkg-config (Linux)](#installing-pkg-config-linux)
26
+ - [Installing pkgconf (macOS)](#installing-pkgconf-macos)
27
+ - [Installing vcpkg (Windows)](#installing-vcpkg-windows)
28
+ - [Quick Start](#quick-start)
29
+ - [Prelude](#prelude)
30
+ - [Standard Library](#standard-library)
31
+ - [Code examples](#code-examples)
32
+ - [Hello World](#hello-world)
33
+ - [Example Projects](#example-projects)
34
+ - [Contributing](#contributing)
35
+ - [Setup](#setup)
36
+ - [Editor Support](#editor-support)
37
+ - [Star History](#star-history)
38
+ - [License](#license)
39
+
40
+ <!-- /code_chunk_output -->
41
+
12
42
  ## Features
13
43
 
14
44
  For the design of the language, please refer to [DESIGN.md](./docs/en-US/DESIGN.md).
@@ -79,6 +109,12 @@ $ brew install llvm
79
109
 
80
110
  **Windows:**
81
111
 
112
+ Clang on Windows requires a linker and Windows SDK headers. Install **Visual Studio** (Community edition is free) or the **Build Tools for Visual Studio** with the "Desktop development with C++" workload:
113
+
114
+ 1. Download from [https://visualstudio.microsoft.com/downloads/](https://visualstudio.microsoft.com/downloads/)
115
+ 2. In the installer, select **"Desktop development with C++"** (this includes MSVC, Windows SDK, and the linker)
116
+ 3. Then install LLVM/Clang:
117
+
82
118
  ```bash
83
119
  # Using Chocolatey
84
120
  $ choco install llvm
@@ -89,6 +125,16 @@ $ scoop install llvm
89
125
  # Or download from https://releases.llvm.org/
90
126
  ```
91
127
 
128
+ Alternatively, you can use `zig` as the C compiler (no Visual Studio needed):
129
+
130
+ ```bash
131
+ # Using Chocolatey
132
+ $ choco install zig
133
+
134
+ # Then compile with:
135
+ $ yo compile main.yo --c-compiler zig --release -o main
136
+ ```
137
+
92
138
  Alternatively, you can use other C compilers like `gcc` or `zig` by specifying the compiler with the `--c-compiler` flag.
93
139
 
94
140
  ### Linux liburing Requirement
@@ -109,33 +155,109 @@ $ sudo dnf install liburing-devel
109
155
  $ sudo pacman -S liburing
110
156
  ```
111
157
 
158
+ ### pkg-config / vcpkg Requirement
159
+
160
+ Yo's build system uses **pkg-config** (on Linux and macOS) or **vcpkg** (on Windows) to discover system C libraries when linking with external dependencies.
161
+
162
+ #### Installing pkg-config (Linux)
163
+
164
+ ```bash
165
+ # Ubuntu/Debian
166
+ $ sudo apt-get update
167
+ $ sudo apt-get install pkg-config
168
+
169
+ # Fedora/RHEL
170
+ $ sudo dnf install pkgconf-pkg-config
171
+
172
+ # Arch Linux
173
+ $ sudo pacman -S pkgconf
174
+ ```
175
+
176
+ #### Installing pkgconf (macOS)
177
+
178
+ ```bash
179
+ # Homebrew
180
+ $ brew install pkgconf
181
+ ```
182
+
183
+ #### Installing vcpkg (Windows)
184
+
185
+ ```bash
186
+ # Using Git
187
+ $ git clone https://github.com/microsoft/vcpkg.git
188
+ $ .\vcpkg\bootstrap-vcpkg.bat
189
+
190
+ # Then set the VCPKG_ROOT environment variable to the vcpkg directory
191
+
192
+ # Or using Scoop
193
+ $ scoop install vcpkg
194
+ ```
195
+
196
+ For more information, see the [vcpkg documentation](https://learn.microsoft.com/en-us/vcpkg/get_started/get-started).
197
+
198
+ ## Quick Start
199
+
200
+ ```bash
201
+ $ yo init my-project # Scaffold a new project
202
+ $ cd my-project
203
+ $ yo build run # Build and run
204
+ Hello, world!
205
+ ```
206
+
207
+ `yo init` generates a project with a build file, source, and tests:
208
+
209
+ ```
210
+ my-project/
211
+ ├── build.yo # Build configuration
212
+ ├── src/
213
+ │ ├── main.yo # Entry point
214
+ │ └── lib.yo # Library module
215
+ └── tests/
216
+ └── main.test.yo # Unit tests
217
+ ```
218
+
219
+ `src/main.yo`:
220
+
221
+ ```typescript
222
+ { println } :: import "std/fmt";
223
+
224
+ main :: (fn() -> unit)({
225
+ println("Hello, world!");
226
+ });
227
+
228
+ export main;
229
+ ```
230
+
231
+ Common build commands:
232
+
233
+ ```bash
234
+ $ yo build # Build all artifacts
235
+ $ yo build run # Build and run the executable
236
+ $ yo build test # Run tests
237
+ $ yo build --list-steps # List available build steps
238
+ ```
239
+
240
+ ## Prelude
241
+
242
+ Every Yo file automatically imports **[std/prelude.yo](./std/prelude.yo)**, which provides the core types, traits, and builtins available without any explicit import:
243
+
244
+ - **Primitive types**: `bool`, `i8`–`i64`, `u8`–`u64`, `f32`, `f64`, `isize`, `usize`, `str`
245
+ - **C-compatible types**: `int`, `uint`, `short`, `long`, `longlong`, `char`, etc.
246
+ - **Core traits**: `Eq`, `Ord`, `Add`, `Sub`, `Mul`, `Div`, `Iterator`, `IntoIterator`, `TryFrom`, `TryInto`, `Dispose`, `Send`, `Rc`, `Acyclic`, etc.
247
+ - **Metaprogramming**: `Type`, `Expr`, `ExprList`, `Var`
248
+ - **Async**: `IO`, `FutureState`, `JoinHandle`
249
+ - **Utilities**: `assert`, `unsafe`, `try`, `for`, `not`, `arc`, `Box`, `box`
250
+ - etc.
251
+
112
252
  ## Standard Library
113
253
 
114
254
  _Still In Design_
115
255
 
116
- Yo ships with a comprehensive standard library covering strings, collections, file I/O, networking, encoding, regex, crypto, and more. For the full module reference, see **[Standard Library Modules](./docs/STD_LIBRARY_MODULES.md)**.
117
-
118
- Key modules include:
119
-
120
- | Module | Import | Description |
121
- | ----------- | ------------------------------------------------------- | ----------------------------------------------------------- |
122
- | String | `import "std/string"` | UTF-8 strings with parsing, search, transform |
123
- | Collections | `import "std/collections/array_list"`, `hash_map`, etc. | ArrayList, HashMap, HashSet, BTreeMap, Deque, PriorityQueue |
124
- | File System | `import "std/fs/file"` | Async file I/O, directories, metadata |
125
- | Networking | `import "std/net/tcp"` | TCP/UDP sockets, DNS resolution |
126
- | HTTP | `import "std/http"` | HTTP types, async client, `fetch` function |
127
- | JSON | `import "std/encoding/json"` | Full JSON parser/stringifier |
128
- | TOML | `import "std/encoding/toml"` | TOML config file parser |
129
- | Regex | `import "std/regex"` | Regular expression engine |
130
- | Crypto | `import "std/crypto/sha256"` | SHA-256, MD5, random |
131
- | URL | `import "std/url"` | URL parsing and formatting |
132
- | Glob | `import "std/glob"` | Unix-style glob pattern matching |
133
- | Log | `import "std/log"` | Leveled logging |
134
- | Formatting | `import "std/fmt"` | `print`, `println` for any `ToString` type |
256
+ Yo ships with a comprehensive standard library covering strings, collections, file I/O, networking, encoding, regex, crypto, and more. For the full module reference, see **[Standard Library Modules](./docs/en-US/STD_LIBRARY_MODULES.md)**.
135
257
 
136
258
  ## Code examples
137
259
 
138
- Check the [./tests](./tests/) and [./std](./std/) folders for code examples.
260
+ Check the [./tests](./tests/) and [./std](./std/) folders for more code examples.
139
261
 
140
262
  ### Hello World
141
263
 
@@ -153,7 +275,15 @@ export main;
153
275
  // $ ./main
154
276
  ```
155
277
 
156
- ## Development
278
+ ### Example Projects
279
+
280
+ | Project | Description |
281
+ | ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
282
+ | [raylib_yo](https://github.com/shd101wyy/raylib_yo) | Comprehensive [raylib](https://www.raylib.com/) bindings — 35 struct types, 535 functions, 227 constants |
283
+ | [tetris_yo](https://github.com/shd101wyy/tetris_yo) | Classic Tetris game built with raylib_yo, demonstrating Yo's build system and C interop |
284
+ | [http_server_demo_yo](https://github.com/shd101wyy/http_server_demo_yo) | Simple HTTP/1.1 server — async I/O, algebraic effects, TCP networking, request parsing & routing |
285
+
286
+ ## Contributing
157
287
 
158
288
  The `Yo` compiler is written in [TypeScript](https://www.typescriptlang.org/) and uses [Bun](https://bun.sh/) as the runtime.
159
289