r/Jai

A complete Jai toolchain (compiler, lsp, linter, formatter)
▲ 0 r/Jai

A complete Jai toolchain (compiler, lsp, linter, formatter)

Try it in your browser →

Repository: https://github.com/matteopolak/jai

The code was written almost entirely by AI. I of course steered it, reviewed a lot of the code, had many parts rewritten, added fuzzing+benchmarks+tests in CI (among other things), and spent a dozen hours using it myself and fixing all of the developer experience until it felt good to use.

It has four parts:

jaic (the compiler). The whole language is implemented, including #run, macros, #insert, polymorphism, #asm and the Compiler module with workspaces and the message loop. It builds native executables for macOS, Linux and Windows (x86-64 and arm64) through LLVM, and it can also target WebAssembly. About 40 open-source Jai projects build and run in CI. It's fast: a 100k+ line project type-checks in about a second and a debug build takes under 2.

jailsp (the language server). On top of the usual stuff, you can hover a #run to see its value and anything it printed, hover a macro or #insert to see the expanded code, hover an #if to see if it's true or false, and hover a struct to see its size, padding and field offsets. Hover and completion take 1–2 ms on 100k+ line projects.

jailint (the linter). It knows the types of everything, so it can catch real bugs: a loop that reads one past the end of an array, removing from an array while iterating over it, 1 << n - 1 not meaning what it does in C, or a defer in a loop that won't run when you think. It also flags unused variables and imports, and fixes what it safely can, both from the command line and as quick fixes in your editor.

jaifmt (the formatter). A good ol' formatter with the common formatting options. Nothing too special, but it's written in Jai so you can easily use it at compile-time to format generated code, for example.

Let me know what you think :)

u/matteopolak — 5 days ago
▲ 19 r/Jai

Jais perfomance on Order of the sinking star seems to be a sinking star

For all the talk of Johns optimization excellence OOTSS seems to have major performance problems on Steam Deck and PS5. Those are systems that can run well optimized Unreal Engine 5 / Cry Engine games, which have way way more graphics and complex worlds going on. IMO there is no excuse to not have a 80s sokoban game running at 60 FPS minimum on any PC from this century. He always talks about how badly all software is optimized and everything is so broken because nobody does it the right way (his way) and now this.

Where is Johns data oriented magic and JAIs power when you need it? This isn't the best possible showing for the new tech.

reddit.com
u/kragil — 7 days ago
▲ 26 r/Jai

I'm building a GUI framework in Jai and writing about it!

forbear is a GUI framework I'm building. Goal is to be what the operating system should provide to create GUIs. I first wrote it in Zig, and now I'm rewriting it from scratch in Jai and keeping a dev log as I go.

- 001, why I'm rewriting it (again), and why Jai: https://www.forbear.dev/log/001-im-rewriting-everything-again.html

- 002, text, macOS and nodes: https://www.forbear.dev/log/002-text-macos-and-nodes.html

Some things made Jai feel much better for the project than Zig, especially keying and macro creation. I talk more about this on the first entry. On Linux I also wrote my own Wayland client over the socket instead of using libwayland, and I render with OpenGL through EGL and dmabufs.

I'd love feedback, especially from people who've built UI in Jai before.

Code is public (https://github.com/gabrielmfern/forbear), and I intend in making it a dynamically linked library so that people can still use it from other languages through thin wrappers I'll provide.

https://preview.redd.it/t7dzz9emc8th1.png?width=1920&format=png&auto=webp&s=7097a1a3fec884271fc46994f7f0f094fc929e35

reddit.com
u/gabrielmfern — 12 days ago