diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..451c437 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[env] +LLVM_SYS_181_PREFIX = "/usr/lib/llvm18" diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..b1ba031 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,28 @@ +* text=auto + +*.rs text eol=lf +*.toml text eol=lf +*.md text eol=lf +*.yml text eol=lf +*.yaml text eol=lf +*.json text eol=lf +*.aelys text eol=lf +*.aasm text eol=lf +*.sh text eol=lf + +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.ico binary +*.pdf binary +*.dll binary +*.lib binary +*.a binary +*.so binary +*.dylib binary +*.exe binary + +# exclude from github language detection +*.inc linguist-vendored +*.cpp linguist-vendored diff --git a/.gitignore b/.gitignore index fff8465..0d1f131 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,17 @@ Cargo.lock /aelys/target/ \target .idea/ -AELYS_TECHNICAL_REFERENCE.md \ No newline at end of file +architecture.md +backend_status.md +aelys/tests/exploration/* +*.ps1 +**/*.obj +**/*.exe +main.aelys +main.ll +torture/ +audit/** +audit_tmp/** +.vs/** +.idea/** +tests_e2e/** \ No newline at end of file diff --git a/ACKNOWLEDGEMENTS.md b/ACKNOWLEDGEMENTS.md index 9e2255d..84c3523 100644 --- a/ACKNOWLEDGEMENTS.md +++ b/ACKNOWLEDGEMENTS.md @@ -1,35 +1,17 @@ # Acknowledgements -## Helps and Contributions +## Helps and Indirect Contributions -**[Keggek](https://codeberg.org/gek)** - For the discussions about the project and language design <3 -**[Lekebabiste](https://github.com/Lekebabiste)** - For helping with the UDP implementation <3 -**[SpaceGame](https://github.com/SpaceGame-wq)** - For making an Aelys syntax highlighting [VSCode extension](https://marketplace.visualstudio.com/items?itemName=SpaceGame.aelys-lang) <3 - -## Inspirations - -**Rust** - The syntax style, `let mut` for mutability, range expressions (`..` and `..=`). -Also happens to be what Aelys is written in lol - -**Go** - Automatic semicolon insertion, the philosophy of simplicity, fast compilation. - -**Lua** - Lightweight VM design, embeddability goals. The original inspiration for trying to build something small and fast. - -**Python** - Readability focus. The `and`/`or`/`not` keywords. - -Honestly I really want do make a language that feels like a blend of all these things, taking the best ideas from each. -Some sort of « python but that treats you as an adult » +**[Keggek](https://codeberg.org/gek)** - For the discussions about the project and language design. You are more than a mentor, thank you. --- -## Usage of AI - -Debugging sessions, architectural discussions, and keeping me sane when the VM decides to just.. not work. +**[SpaceGame](https://github.com/SpaceGame-wq)** - For making an Aelys syntax highlighting [VSCode extension](https://marketplace.visualstudio.com/items?itemName=SpaceGame.aelys-lang) -AI also wrote most of the tests for Aelys, some stuff in the examples/ folder (notably the benchmarks), and also some parts of the stdlib, which saved a lot of time. -I prefer not to focus too much on that and instead work on the VM rather than anything else +## Inspirations +TODO: -Without AI assistance this would've taken 10x longer, maybe more. +## Usage of AI -This whole thing started as a way to actually understand how compilers work beyond just reading about them, and turns out building one is the best way to learn +TODO: \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f111580..abe3ce0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,43 @@ All notable changes to Aelys, roughly grouped by version. I don't always tag releases perfectly, so this is reconstructed from git history +## 0.21.x - LLVM backend implementation + +**0.21.5-a** +- LLVM codegen: Windows x64 MSVC sret ABI fix for struct returns (fixes bootstrap println segfault) +- string comparison (==, !=), logical not (!), println` accepts i64/f64/bool (bootstrap to_string) +- Delete the legacy VM backend + +#### Note about that : + +The previous VM served its purpose for prototyping, but Aelys is a systems programming language, not a scripting engine. + +A compact alternative VM will return later once LLVM is mature enough (meta-programming?) + +**0.21.4-a** +- LLVM codegen: SSA-aware local lowering, no more round-tripping with alloca/store/load +- LLVM backend hardening, no panic/todo path now, unsupported AIR node will give a compile time error +- Stable native entrypoint for LLVM: `__aelys_user_main` + C runtime main + +**0.21.3-a** +- Hardened Aelys string ABI: `str` is now consistently lowered as `{ ptr, len }` +- Temporary `print/println` bootstrap, they're reserved during LLVM bootstrap and lowered to `__aelys_write(ptr, len)`; added regression tests for IR ABI and internal `\0` handling. +- Added `s.len` field access on `Str` (untiil proper bootstrapping) + +**0.21.2-a** +- Added `core/` crate (`aelys-core`) as a C runtime static library built via `cc` (`build.rs` + `src/aelys_core.c`). +- LLVM native linking now auto-resolves and links `aelys-core` for `--backend llvm` executables. + +**0.21.1-a** +- AIR pass `copy_elim`: élimination des copies paramètre -> local en single-assignment. +- AIR pass `dead_locals`: suppression des `AirLocal` jamais référencés. + +**0.21.0-a** +- LLVM backend bootstrap: inkwell integration, AIR->LLVM type lowering, function declaration/body codegen, `module.verify()`, and `--backend llvm --emit-llvm-ir`. + ## 0.20.x - Preparing for LLVM -Groundwork for LLVM: sized types, structs, generics, monomorphization, and a new intermediate representation (AIR) with System V AMD64 layout. Nothing implemented in the VM though. I'd rather focus on the new backend than on that. +Groundwork for LLVM: sized types, structs, generics, monomorphization, and a new intermediate representation (AIR) with System V AMD64 layout. Nothing implemented in the VM though. I'd rather focus on the new backend than on that. is mature enough. **0.20.4-a** - AIR pretty-printer, `--emit-air` CLI flag for `compile` command @@ -60,7 +94,7 @@ Language maturity: arrays, vecs, compound operators, dot-syntax string methods, - String indexing with `s[i]` (unicode-aware, returns single-character string) - `for c in "hello" { }` iteration syntax -**0.19.10-a** (i'll squash all of these updates) +**0.19.10-a** - fn foo(mut param: type) now working **0.19.9-a** (not a "real" update again sorry, needed a new tag @@ -109,7 +143,7 @@ Language maturity: arrays, vecs, compound operators, dot-syntax string methods, ## 0.18.x - Native Binary Data Manipulation -This update adds real memory manipulation for @no_gc mode +This update adds real memory manipulation for @no_gc mode & some bug fixes **0.18.6-a** - Fixed call site cache using stale entries after global mutation diff --git a/Cargo.toml b/Cargo.toml index 34ab0f8..38fd831 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,24 +2,20 @@ resolver = "3" members = [ "aelys", + "core", "common", "syntax", "frontend", "sema", "opt", "air", - "bytecode", - "backend", - "runtime", - "modules", + "codegen", "driver", "cli", - "native", - "native-macros", ] [workspace.package] -version = "0.20.3-a" +version = "0.21.8-a" [profile.release] lto = "fat" @@ -30,4 +26,4 @@ strip = true debug = false overflow-checks = false debug-assertions = false -rpath = false \ No newline at end of file +rpath = false diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..256a98c --- /dev/null +++ b/NOTICE @@ -0,0 +1,4 @@ +This project uses LLVM (https://llvm.org/). +Copyright (c) 2003-present, LLVM Contributors. +Licensed under the Apache License 2.0 with LLVM Exceptions. +See https://llvm.org/LICENSE.txt for license information. \ No newline at end of file diff --git a/README.md b/README.md index d0bd251..fa65d81 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,119 @@
-
+